Re: GLib gettext and UTF-8



On Tue, 27 Sep 2005, The Saltydog wrote:
On 9/27/05, David Rosal <david rosal upf edu> wrote:
In my GTK2 program, I use the macro _(str) to translate the strings.
"str" is in english (ASCII), but the translation may be encoded in an
arbitrary codeset (e.g. ISO-8859-1 or KOI-8...). The question is: Does
the glib macro _(str) convert the strings to UTF-8 encoding, or I have
to make g_locale_to_utf8(_(str), ...) everytime I have to deal with a
translatable string?
you should ask translators to use UTF-8 encoding, and set it in the
.po file settings.

Have a look at the manpage for bind_textdomain_codeset. In a nutshell, calling:
        bind_textdomain_codeset ("mydomain", "UTF-8")
will cause gettext to convert all translated strings to UTF-8 before returning them.

JV



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