Re: Multi language support



On Wed, 2004-09-29 at 07:38, Dirk van der Walt wrote:
Hi,

Hello,

I'm looking for ways to build in internationalization into
my application. (read multi language support)

i18n... mmm fun...

How does one do it?

What you are looking for is the following library:
http://search.cpan.org/~guido/libintl-perl-1.11/

In particular this POD will help explain things:
http://search.cpan.org/~guido/libintl-perl-1.11/lib/Locale/TextDomain.pm

but how do you actually do it in your perl/Gtk application?

Well, it works something like this (taken from the above POD with
comments by me):

<code>
# The first thing we do is use the module and provide it with a name
# that relates to a .po file, in this case it'd be package-name.po
# which has all the translations for the entire application.
use Locale::TextDomain qw( package-name );

# Now we're able to have text strings translated for us using the __()
# function. One of the beauties of this setup is that if you've already
# got the application built for one language, you should only need to
# go through all the user-visible strings and add __ to the "" for
# everything to work.
my $translated_string = __"Hello World\n";
</code>

Working with Glade files is however a little different and requires 
"Project->Options->C Options->Gettext Support" to be enabled along with
altering the way the Glade is initially used within the Perl.

Making the .po file(s) and the translations is identical to how you'd
use gettext in C and as such is beyond the scope of this email.

-- 
Kevin C. Krinke <kckrinke opendoorsoftware com>
Open Door Software Inc.




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