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: TP Diffenbach <>
Date: Sun, 27 Apr 2003 12:15:29 -0400

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.

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

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( LANG_SET_BOOL_YES )
    } ;
    char* display_option[] = {
    } ;
    char* character_class_option[] = {
    } ;
Archos FM needs a Rockbox!
Received on 2003-04-27

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