[Gambas-user] How to write a multilingual application

wig wig at ...1809...
Mon Mar 9 10:33:35 CET 2009


The language is selected on project start; it depends on the language of
the system you work on (shell: echo $LANG)

If you programmed your project in English, and made translations for
French and German then a French system runs the French version, a German
system runs the German version

If the language is not available (or the translation for a particular
string is missing) you get the English version/string.

The language files are stored in .po files in the .lang directory of the
project (as is said in http://gambasdoc.org/help/howto/translate); all are
included if you make a source archive etc.

If a language seems to miss, check the language name (e.g. nl_BE for Dutch
in Belgium might not be found, while being the same translation as nl_NL
for Dutch of the Netherlands, that might be available).

You can force gambas to start with a language; start gambas with a
parameter as this: LANG=nl_NL.UTF-8 to start in Dutch.

Switching only works "from then on" when you change the language under
program control with

  System.Language = "de_DE"

But all Forms that are open already (e.g. Main) will stay in startup
language.

I tend to let the user choose a language (at first start-up and later
changeable from a menu) and store it with the system of settings:
(http://gambasdoc.org/help/comp/gb.settings)
Settings["Language"] = fr_FR

First thing to do is read the language setting and use it, only then start
to load Forms that display text.

It is a little bit more comfortable than to multi-boot Linux systems with
other languages installed, just to check the languages as developer...

Hope this gets you started!



> I've seen the built-in translator for Gambas, but I don't know how could I
> switch languages inside an application. Is it possible to use multiple
> translations inside a package, or I have to create package for English,
> German... version?
> Is it possible to pack some additional text or language files inside the
> packages?
> Thanks!
> Csaba
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco,
> CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the
> Enterprise
> -Strategies to boost innovation and cut costs with open source
> participation
> -Receive a $600 discount off the registration fee with the source code:
> SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>






More information about the User mailing list