Re: Apply gettext to Gtk2::GladeXML
- From: Chris Debenham - RSD Engineer <Chris Debenham Sun COM>
- To: Adrien BUSTANY <madcat mymadcat com>
- Cc: gtk-perl-list gnome org
- Subject: Re: Apply gettext to Gtk2::GladeXML
- Date: Mon, 14 Nov 2005 10:29:06 +1100
I'm doing this in one of my applications (lyricue, see
www.adebenham.com/lyricue)
The relevant bit is:
--- begin code ---
eval { require Locale::gettext };
if ($@) {
print "Gettext not available, english text only\n";
sub gettext {
return $@;
}
} else {
import Locale::gettext;
textdomain('lyricue');
# Hack to get this working under mandrake
use lib qw(/usr/lib/libDrakX);
eval { require c::stuff };
if ($@) {
bind_textdomain_codeset('lyricue', "UTF-8");
} else {
c::stuff::bind_textdomain_codeset('lyricue', "UTF-8");
}
}
--- end code ---
Then to translate you extract the strings from the .glade file using
'intltool-update -p' which will create a .pot file which you use for
translation.
Have a look at the source code for lyricue (relevant translations are in
the 'po' directory) to see an example of usage
Let me know if you need anymore help, I know how hard this is to figure
out (took me ages :-) )
Chris
Adrien BUSTANY wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi there,
I recently developed a Gtk-Perl application, using Gtk2::GladeXML.
Now I'd like to make i18n work. I used Locale::TextDomain to translate
strings in my perl strict, but didn't find a way to translate strings
in the Glade interface. I've been able to extract them using xgettext,
but I still don't know how to tell GladeXML to use gettext at loading,
strings entered directly in Glade are still in English (except for
stock buttons).
Maybe you got a piece of advice...
Regards
Adrien BUSTANY
- --
Vous utilisez encore outlook et internet explorer ?
Et votre ordinateur, il est à pédales ?
- --> http://frenchmozilla.org <--
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFDc7Q4UXEmMUTYdsERAr6sAJ93fquN4SjfUG+BW06zGZkiRMr8VQCfVs22
071bs8uwRxK95l4G7vXParY=
=tmun
-----END PGP SIGNATURE-----
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list
--
-------------------------------------------------------------------------------
,-_|\ RSD Engineer E-mail : debenham sun com
/ \ Sun Microsystems Australia Pty Ltd. Direct : +61 (2) 9844 5188
\_,-\_* 828 Pacific Highway Phone : +61 (2) 9844 5000
v Gordon, N.S.W. 2072 Fax : +61 (2) 9844 5189
Mobile : +61 (40) 9844 514
-------------------------------------------------------------------------------
When The Chips Are Down, The Buffalo Is Empty.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]