Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Re: .lang files
From: Björn Stenberg (bjorn_at_haxx.se)
Date: 2002-09-16


Florian Mösch wrote:
> Aren't those defines resulting in simple text substitutions by the
> preprocessor ?

No. In the code it will look something like this:

---language.h---

#define LANG_VERSION 0
#define LANG_BROWSE 1

#define str(_x_) lang_strings[_x_]

extern unsigned char* lang_strings[];

---language.c---

unsigned char* lang_strings[] = {
 "Version",
 "Browse"
};

---apps/main.c---

 lcd_puts(0,0,str(LANG_VERSION));

> How do you plan to implement a run-time version of your design ?

We simply link several different arrays (lang_sv, lang_en, lang_fr, lang_de) and then assign the lang_strings pointer to the currently selected one.

-- 
Björn



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