[Fwd: Re: gettext and utf-8 in Gnome 2]



-----Mensaje reenviado-----

From: Carlos Perelló Marín <carlos@gnome-db.org>
To: Gediminas Paulauskas <menesis@delfi.lt>
Cc: gnome-18n@gnome.org, gnome-2-0-list@gnome.org
Subject: Re: gettext and utf-8 in Gnome 2
Date: 27 Nov 2001 15:52:40 +0100

El mar, 27-11-2001 a las 15:08, Gediminas Paulauskas escribió:
> 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.


This is not correct.

I was playing with this && glade2 some weeks ago and it's only true for
glibc <= 2.1 (I think).

The glibc >= 2.2 recode your .po catalog to the locale you have ser at
LC_*.

For example. I have this locale, set by gdm when i choose Spanish:

carlos@Bilbo:~$ locale
LANG=es_ES.ISO-8859-1
LC_CTYPE="es_ES"
LC_NUMERIC="es_ES"
LC_TIME="es_ES"
LC_COLLATE="es_ES"
LC_MONETARY="es_ES"
LC_MESSAGES="es_ES"
LC_PAPER="es_ES"
LC_NAME="es_ES"
LC_ADDRESS="es_ES"
LC_TELEPHONE="es_ES"
LC_MEASUREMENT="es_ES"
LC_IDENTIFICATION="es_ES"
LC_ALL=es_ES


I have installed the glade2 catalog as UTF-8 encode and when I run
glade2 without bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); I get
errors like:

glade2 (pid:2176): ** WARNING **: Invalid UTF8 string passed to
pango_layout_set_text()


With the .po catalog as iso-8859-1 I get the same error.

But if I change LC_ALL=es_ES.UTF-8, the problem is fixed with both .po
encoding.


So, If we want that all users get the correct strings we MUST use
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
We cannot set it's locale to LOCALE.UTF-8 (for example all gdm2 for
GNOME 1.4 versions will show wrong strings in GNOME 2.0 applications)

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


All apps && libraries MUST call bind_textdomain_codeset to work ok with
glibc >= 2.2 and also, translators must convert their translations to
utf-8 to get them ok with glibc < 2.2

> 
> -- 
> Gediminas Paulauskas
> Kaunas, Lithuania
> _______________________________________________
> gnome-2-0-list mailing list
> gnome-2-0-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gnome-2-0-list
-- 
Carlos Perelló Marín
mailto:carlos@gnome-db.org
http://www.gnome-db.org
http://www.Hispalinux.es
Valencia - Spain

PGP signature

PGP signature



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