Re: Volunteer needed (was Re: Short question about german special characters with GTK 2)



On Wed, 2003-03-05 at 11:04, Filip Van Raemdonck wrote:
On Wed, Mar 05, 2003 at 10:36:06AM -0500, Owen Taylor wrote:
It would be wonderful if someone would:

 - Write up a FAQ entry on this

   (Maybe explain what is UTF-8, that GTK+ uses UTF-8 everywhere,
    short example of g_locale_to_utf8(), short example of g_convert(),
    mention that you could just encode your source file as 
    UTF-8 if your editor supports it.)

 - File it as a bug in bugzilla, CC'ing gale gtk org

This certainly seems to be the most frequently asked question
these days.

Actually, if the OP would do proper i18n/l10n initialization with gettext,
and mark the strings for translation instead of passing them in as-is,
would this still be a problem?

Well, there is a different set of somewhat-less-frequently asked
questions that come up when using gettext(); in particular,
the need to use bind_textdomain_codeset() and a newer version
of libintl. (*)

On Wed, 2003-03-05 at 10:03, Christian Schneider wrote:

dateiauswahl = gtk_file_selection_new ("Auswahl der zu
Ãbertragenden Datei");

This may work:

bindtextdomain (PACKAGE, LOCALEDIR);
bind_textdomain_codeset (PACKAGE, "UTF-8"); /* <-- This is the one */
textdomain (PACKAGE);
...
dateiauswahl = gtk_file_selection_new (_("...Ãbertragenden Datei"));

Don't forget to define PACKAGE & LOCALEDIR and _().

I said "may work", because in my case I'm passing in plain ASCII strings
and the latin-1 ones are in the .po files. Does anyone know if it still
works when passing in latin-1 in the code itself?

When using gettext(), the keys must be ASCII only. The gettext tools
enforce this.

Regards,
                                          Owen

(*) It turns out that if you encode your .po files in UTF-8, then 
    you can also use an older version of libintl, and only call
    bind_textdomain_codeset() if the system has it, but that
    get's a little complicated for a FAQ answer. Just saying
    "use a sufficiently modern gettext() implementation" is 
    probably simpler.






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