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

Rockbox mail archive

Subject: RE: .lang files
From: Stuart Tedford (
Date: 2002-09-16

I have used multiple run-time language support in an embedded system before.

That system used an id to lookup a string in a language file, basically the
same principle as Daniel is proposing.

I see no issues using this system for RockBox. The only thing is that the
id needs to be very descriptive - preferably implement some naming
convention for the id constants. I think this has been discussed before.
ie. LANG_ID_NNN where NNN is as close to the actual string as possible, eg.
LANG_ID_HELLO_WORLD. The embedded system I had the pleasure of working with
before just used magic numbers which was a complete and utter nightmare.

I beleive we should use an id to lookup the string, rather than string
matching - we just don't have that much processing time to waste. As long
as an id convention is policed :-), then this is a far better solution for

Question: How will this system handle printf format strings? - eg. we can't
put %d in the id macro name.


> -----Original Message-----
> From: Florian Mösch []
> Sent: 16 September 2002 10:46
> To:
> Subject: Re: .lang files
> > Ok, we've had some time to discuss and think things over,
> and now I really
> > only want really well-thought objections with motivations
> why this language
> > file format is bad:
> You've already got my well-thought objections before. I told
> you precisely
> why I would prefer using a standard format with exactly the
> same benefits
> as your proprietary approch. I won't repeat it again.
> > A single file for each language. Plain text.
> Exactly what I was thinking of...
> > Example:
> > [...]
> > o id would be the ID to use in the source when this string
> is wanted. The
> > code should use str(id) to get the particular string.
> gettext sources usually use something like
> #include "gettext.h"
> and
> #define _( x ) gettext( x )
> and in the sources something like
> printf( _("Hello World.\n") );
> which is (I think so) very readable and very compact.
> I like it more than
> printf( str(HELLO_WORLD) );
> but this is only my opinion...
> > o desc would be a volountary/optional description of the phrase
> ... which I think is not necessary if you use "speaking" IDs
> or use the
> original string as ID and include a reference to the sources as a
> comment in the language file. The reference to the source
> should not be
> optional but mandatory.
> > [...]
> > The order of these keywords are important. They should only
> come in the order
> > as stated above (to make writing scripts for this easier).
> I really don't want to restart tis discussion .....
> > I'll soon bring on my initial scripts and language files
> that follow this
> > format.
> .... as *big boss* (TM) seems to have made his decision. Sorry for my
> complaints. But I'm still wondering why he sends "requests
> for comments"
> if he doesn't like critics.
> Florian.

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