gettext and utf-8 in Gnome 2



In Gtk+ 2 all user-visible text is in Unicode. This includes
translations which come from po files. There are two ways to achieve
this:

bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");  /* add this call */
textdomain (GETTEXT_PACKAGE);

or force all po files to be in utf-8.

I have added bind_textdomain_codeset () to gnome-games, and saw correct
translations. But then I understood it may be not correct/sufficient.
There are other things which work with the same translation, namely:

1. intltool
2. libglade
3. libbonoboui

intltool reads various text files, and adds translatable strings to pot
file. Later libglade (.glade2 files) and libbonoboui (.xml files) call
gettext for these strings to get translations. They use dgettext
(domain, string) for that. But they do not call bind_textdomain_codeset
(), so get translations in the codeset which po file is saved in.

intltool-merge, however, makes .desktop, .keys, .schema, .server and
other files encoded in utf-8 correctly (if used with -u option).

Gtk+-2.0 itself always gets strings in utf-8. So the, question is, do
all apps and libraries need to call bind_textdomain_codeset (), or
should all translators be forced to convert their translations to utf-8?

-- 
Gediminas Paulauskas
Kaunas, Lithuania



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