UTF characters from gettext not displaying properly



Hello,
I am in need of assistance with creating an i18n enabled GTK2/Perl application. I am able to have widgets created from a GladeXML file display translations properly from a message catalog I have created. But those widgets I create by hand do not display the correct characters for the translated text from the catalog. (There are the correct number of characters, unlike when UTF characters are being displayed as bytes)
Below is a simple test case that exhibits this behavior:

--- SNIP ---
#!/usr/bin/perl -w

use strict;
use Gtk2 -init;
use POSIX qw(setlocale);
use Locale::gettext;

my $locale_domain = "i18ntest";

bindtextdomain($locale_domain, "./locale");
textdomain($locale_domain);
setlocale(LC_MESSAGES,"");

my $text = gettext("This is not translated\n");

my $dialog = Gtk2::MessageDialog->new(
undef,
'modal' ,
'info',
'ok',
"Message: %s", $text);

$dialog->run;
$dialog->destroy;
--- /SNIP ---

And the po file:
--- SNIP ---
#
msgid ""
msgstr ""
"Project-Id-Version: i18ntest 1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2004-11-03 13:49-0600\n"
"PO-Revision-Date: 2004-11-11 12:43-0600\n"
"Last-Translator: TEST NAME <EMAIL ADDRESS com>\n"
"Language-Team: Bulgarian <blah example com>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit"

#: i18ntest.pl:13
msgid "This is not translated\n"
msgstr "ÐÐÐÐ Ð ÐÑÐÐÐÐ\n"
--- /SNIP ---

I run the program like this:
LANG=bg_BG ./i18ntest2.pl

All textual aspects of the MessageDialog are in Bulgarian cyrillic,
but the message text is not. It displays:
Message: ÃÃÃÃ Ã ÃÃÃÃÃÃ

Also, if I embed a string of cyrrilic text into the code and do 'use utf8' the text
is displayed properly. :
Message/ÐÐÐÐÑÑÐÐ: ÃÃÃÃ Ã ÃÃÃÃÃÃ
Message/(correct cyrillic): (transation with incorrect characters)

This thread leads me to believe that there may be a bug in gettext
causing this:
http://mail.gnome.org/archives/gtk-perl-list/2004-June/msg00121.html
In the thread it is sid that gettext is not marking returned UTF-8 as
such. I tried doing as the author did: using Unicode::MapUTF8 to
change the text back to IOS-8859-1. The results seem to indicate this
is not the problem.

Is this the case? If so, how do I work around this. If not, what am I
missing?

Thanks.

----
Perl:
v5.8.4 built for i386-linux-thread-multi
Debian packages:
ii libgtk2-perl 1.061-1 Perl interface to the 2.x series of the Gimp Toolkit library
ii libgtk2.0-0 2.4.13-1 The GTK+ graphical user interface library
ii liblocale-gettext-perl 1.01-17 Using libc functions for internationalization in Perl





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