dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Rockbox mail archive

Subject: Re: .lang files
From: Florian Mösch (
Date: 2002-09-18

> 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 ?


Page was last modified "Jan 10 2012" The Rockbox Crew