Re: i18n question

Hi Jim,

Jim Edwards wrote:

Can anyone tell me the perl equivalent of c functions


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

 OR   $class->load_translations('MyApp', 'pt_BR', undef,

 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

Regards, Dermot

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