> 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: [EMAIL PROTECTED]
w: http://jodrell.net/
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

Reply via email to