Re: L10n in Gtk2-perl with Locale::Maketext::Lexicon



Hi Gavin,

I'm quite a novice when it comes to l10n, so I appreciate the input.
Actually, I am using Locale::Maketext::Lexicon::Gettext , so I am 
able to use the same .mo files that are generated by the GNU gettext
system. So what does it matter whether I read these files with 
Locale::Gettext or with Locale::Maketext::Lexicon::Gettext ? Note that
I will use .mo files instead of .po files as I did in my last example.

Regards,
Dov

Sorry for drifting outside of 
On Sun, May 08, 2005 at 05:21:08PM +0100, Gavin Brown wrote:
I just wrote the following example of how to do localization of a
Gtk2-perl program and thought it might be useful for others. Perhaps
we should put it somewhere in the wiki:

Although Locale::Maketest is a nice system, and much easier to use in
Perl, l in my experience it's better to use GNU gettext for l10n. Using
gettext means that auto-generated strings like those from Glade get
automagically generated.

e.g.:

        use POSIX qw(setlocale);
        use Locale::gettext;
        
        # name of your program:
        my $APP_NAME = 'foobar';
        
        # get language from environment:
        my $LANGUAGE = $ENV{LANG} || 'en_US';
        
        # put your .mo files in /usr/share/locale/$APP_NAME/LC_MESSAGES:
        my $DIRECTORY = '/usr/share/locale';
        
        setlocale(LC_ALL, $LANGUAGE);
        bindtextdomain($APP_NAME, $DIRECTORY);
        textdomain($APP_NAME);

        print gettext('Hello World!');

Gavin.

-- 
Gavin Brown
e: gavin brown uk com
w: http://jodrell.net/
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list



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