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

Rockbox mail archive

Subject: Re: .lang files

Re: .lang files

From: Heikki Hannikainen <>
Date: Mon, 16 Sep 2002 13:14:03 +0300 (EEST)

On Mon, 16 Sep 2002, Florian Mösch wrote:

> > 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.

  Not quite as compact in the running binary.

> I like it more than
> printf( str(HELLO_WORLD) );
> but this is only my opinion...

  HELLO_WORLD will translate to a very short integer in the running code
(by the compiler / preprocessor since HELLO_WORLD is a #define somewhere
in the headers). The gettext approach has "Hello World.\n" in the target
code, a rather long string instead of a couple bytes for the ID. That
string will then be searched in the language file, and searching strings
is much slower and hard to do than searching integers in a table.

  This is an issue of compactness in the rather small memory space and CPU
speed which we have, not just source code compactness and readability.
We're talking about an order of magnitude of more CPU and memory usage

  I honestly think criticism and comments have been well handled and
implemented in this project so far, at least the good ones. Not every
comment and suggestion can be easily implemented, and not all suggestions
are actually wise to do exactly as suggested, and it's really hard to
please everyone (and many people are not pleased if their suggestions are
not implemented just as suggested).

  - Hessu
Received on 2002-09-16

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