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

Rockbox mail archive

Subject: Re: What function loads a .lang file?

Re: What function loads a .lang file?

From: Linus Nielsen Feltzing <>
Date: Mon, 28 Apr 2003 12:15:33 +0200

TP Diffenbach wrote:
> Quoting Linus Nielsen Feltzing <>:
>> [Your] current concept depends on the order of the strings. Use the
>> str() macro and stay out of trouble.
> And admittedly that's safer. But by using str() exclusively, I find
> that I repeat the same code in many functions to copy pointers from
> language_strings to a local array. It's tedious, and error-prone, and
> it bloats the code. I think we code save a non-trivial amount of code
> by insisting the lang strings be ordered.

They are ordered. All strings are in the same order for every language.
It's just the pointers that change.

> My first thought was to do the copying, in one function, into static
> arrays, and call that function whenever a new lang file was loaded.
> My code would then refer to my static arrays. You objected to that as
> well, as it means keeping pointers to the internationalized strings.
> (Which is bad why? Will those strings be relocated at any tme other
> than when a lang file is loaded?)

It is bad, because we currently have no mechanism that can tell you when
the language has been reloaded.

> Below is the code that gets repeated; note that even with what I'm
> doing, I can't remove the first ("chop_option") because "YES" comes
> before "NO" in language_strings:
> char* chop_option[] = { str( LANG_SET_BOOL_NO ), str(
> char* display_option[] = { str( LANG_FILE_PREFIX_OFFSET_AT ), str(

We could do it a little different if we want to, by allowing the
language string ID in the options list instead of the actual string pointer.

We should be able to use static strings as well, so we would need some
mechanism for that too, like setting the most significant bit or something.

Received on 2003-04-28

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy