|
Rockbox mail archiveSubject: Re: .lang filesRe: .lang files
From: Florian Mösch <fmoesch_at_web.de>
Date: Wed, 18 Sep 2002 13:19:14 +0200 > Personally, I would prefer to have a string which could be automagically > translated in a ID, but such a thing demands some tools to do so. Using IDs > through macro is not very clean (I mean less readable) but enough for what > we need. So let us go and see. I suggest the following format for the string identifiers: MSGID_<automatically generated id> I suggest the following rules for the automatic conversion from strings to identifiers: - The identifier should only consist of o uppercase letters, o digits and o underscores. - Lower case letters from the string are converted to upper case letters in the identifier. - Upper case letter are preceded by a single underscore. - Digits are not converted. - Spaces are converted to two underscores. - All other characters are "escaped" to a single underscore followed by the the ascii value (3 digits) followed by another underscore. So a "Hello World\n" will become MSGID__HELLO___WORLD_092_N. Identifiers generated this way can be easily converted back to the original string but are still good readable. You may of course change the identifier after the automatic conversion (e.g write MSGID_HELLO_WORLD instead of MSGID__HELLO___WORLD_092_N). Those IDs will probably look better but will of course not translate back to the original string (to "hello world" in this example which is still OK). I think a rather simple regular expression for sed will do the job. I know that perl handles regexps very good too, but I'm not a perl programmer. I'll write a regexp as a basis for a discussion. Someone else may port it to perl if needed. Any suggestions ? Florian Received on 2002-09-18 Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy |