Rockbox mail archiveSubject: Re: .lang files / I'm out
Re: .lang files / I'm out
From: Heikki Hannikainen <hessu_at_hes.iki.fi>
Date: Mon, 16 Sep 2002 13:49:29 +0300 (EEST)
On Mon, 16 Sep 2002, Florian Mösch wrote:
> library to the SH processor. *That* would probably be a problem. Right.
> My suggestion was to reuse the .po file format for the .lang files.
> There are tools to generate those files from te sources automagically
> and other tools that help the translators. I think that *this* is not a
> proble but a good idea, because in .po files all the information is
> included that Daniel wants to include in his proprietary format. The
> only difference is that things are called different.
There is a difference, we want an integer ID for the string. We don't
want long character constants in the source code and running binary. The
gettext format would mandate using long character constants in the binary,
and searching for those in the language file.
gettext works by searching for the "English text" string in the language
file and using the translation there. If you want to do
printf( gettext("Hello World.\n") );
you'll have "Hello World\n" in the binary, eating up precious memory
space, and you will have to do a search in the language file for that
string, which will again eat up precious CPU time.
If you have printf_localized(ID_HELLO_WORLD); the ID_HELLO_WORLD will be
translated to a single integer by the C preprocessor before compiling.
After that it is very fast to search the string identified by the integer
in the language file. The approach saves us
- the amount of memory used by the english strings which would be in the
memory even if we're running another language
- the amount of code needed to efficiently search for strings in the
language file (instead of simply picking entry number 5)
- the CPU time it takes to search for the string
We can't have C preprocessor directives containing "'s or whitespace on
the left side - we can do
#define ID_FOO 5
#define ID_FOO "English text"
but we can't do
#define "English text" 5
so we'll have to use ID_ENGLISH_TEXT for the identifier, instead of
This is why implementing the gettext format wouldn't be practical on
Received on 2002-09-16
Page was last modified "Sat May 23 08:12:40 2020" The Rockbox Crew