bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Accessing a message catalog independently of the system locales


From: Sylvain Beucler
Subject: Accessing a message catalog independently of the system locales
Date: Sat, 23 Oct 2010 21:52:02 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

Hi,

I'm loading a message catalog in my application.  It generally works
ok.  I'm initializing the locale using 'setlocale(LC_MESSAGES, "");'.
The application is the FreeDink(.org) game engine.

Now, I'm writing a front-end to start FreeDink with the game that the
user selected.  If the game comes with translations, the user can
select one, and the front-end sets the LC_ALL environment variable
accordingly: fr_FR, da_DK, etc (and empty LANGUAGE).

However (under GNU/Linux):

- If that locale is not enabled in the system, gettext will fail to
  use it.
  (I typically use 'dpkg-reconfigure locales' to enable a locale.)

- More irritatingly, if the locale is enabled, but with a different
  encoding (e.g. '.UTF-8'), then gettext will also fail to use it.

I'm not sure whether that a gettext limitation or something more
low-level.

Interestingly, gettext for windows does not have any of these
limitations.

Note that I'm only using 'dgettext' and 'dpgettext_expr' in the game
engine code, and I only get UTF-8 strings.  I just need to access the
content of the .mo file, nothing fancy.

Is there a way to access a .mo file without asking the user to enable
a specific encoding of a specific locale at the system level?

Cheers!

-- 
Sylvain





reply via email to

[Prev in Thread] Current Thread [Next in Thread]