Re: i18n question



Dermot,

Thanks - this is helpful.  I´m just learning the i18n stuff myself.  There is
a perl module for gettext on CPAN which accesses the c gettext functions, but
you answered a few questions I didn´t ask :-)

Jim

Dermot Musgrove wrote:

Hi Jim,

Jim Edwards wrote:

Can anyone tell me the perl equivalent of c functions

bindtextdomain
textdomain

which tell a package where to look for it´s NLS language bindings?

I am sure that you know more about I18N and NLS than I do so please
excuse me if I am missing the point of your question.

I don't know if you are still using Glade-Perl but there are several I18N
utilities in Glade::PerlRun to load and use .mo files. Have a look at
the Glade::PerlRun perldoc/manpage but briefly:

 load_translations()
   Load a translation file (.mo) for later use as language type

 with args $class, $domain, $language, $locale_dir, $file, $key, $merge

 e.g. To load translations in current LANG from default locations
      $class->load_translations('MyApp');

 OR   $class->load_translations('MyApp', 'pt_BR', undef,
          '/home/dermot/Devel/Glade-Perl/ppo/en.mo');

 OR   $class->load_translations('MyApp', 'fr', '/usr/local/share/locale/',
          undef, '__D', 'Merge with already loaded translations');

Here $key allows you to use several languages in parallel - in Glade-Perl
I use different keys for diagnostics and source generation so that:
  D_('message') translates diagnostic messages to one language and
  S_('message') translates source code messages to another language

Within the source code all widgets' text is set to _('text') so that
it is translated to the current language when the UI is constructed.
This is usually $ENV{LANG} but can be set explicitly the same way.

There is a FAQ on my website that explains how to produce I18N apps
using Glade and Perl at http://www.glade.perl.connectfree.co.uk/FAQ.i18n

Regards, Dermot

_______________________________________________
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]