[maemo-developers] how to change the language of the program during run time?

From: Mohammed Hassan mohammed.2.hassan at nokia.com
Date: Thu Nov 19 14:11:02 EET 2009
On Wed, 2009-11-18 at 14:48 +0100, ext mohamed ismael wrote:
> hello ,
> i am trying to change the language during run time.
> i road the documentation of the localization 
> http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/Application_Development/Maemo_Localization
> i generated the *.po file using the command
> xgettext -f po/POTFILES.in -C -a -o po/template.po
> and then made a en_GB.po copy of the template then made the ar_Ar.po file which contain my localization the i generated 
> the *.mo file using the following command
> msgfmt po/fi_FI.po -o debian/myapp/usr/share/locale/fi_FI/LC_MESSAGES/myapp.mo
> i made the path by hand and run the command so i get myapp.mo file
> i added the following line on the main before gtk_init()
>                         setlocale(LC_ALL, "ar_AR");
setlocale(LC_ALL, ""); // Note the empty string.

>              		bindtextdomain(GETTEXT_PACKAGE, localedir);
> 			bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
> 			textdomain(GETTEXT_PACKAGE);
> i added the following line to configure.ac file
> ALL_LINGUAS="en_GB ar_AR" 

It should be ar only. The PO file should also be ar.po not ar_AR.po

> i built a package and deployed it on N900 device  when  i setup the package
> i get the following error
> but i run the program with the following command
> LANGUAGE="ar_Ar" myapp

LANGUAGE=ar myapp

> the application run and display my language but when i click on a button which contain the following code 
> setlocale(LC_ALL, "en_GB");

You have to go through all the widgets and set the text strings again.

> it does not make any thing .
> i have two questions:
> 1- how to make my program launch with the desired language without the line LANGUAGE="ar_Ar" myapp?
Maybe save the desired locale to a configuration file which you parse
before you call ANY MAEMO5 specific API ?

P.S. I don't think the Arabic locale already exists. It needs to be
generated for maemo5.


> 2- how to change the language during run time?
> thanks 
> _______________________________________________
> maemo-developers mailing list
> maemo-developers at maemo.org
> https://lists.maemo.org/mailman/listinfo/maemo-developers
Senior Software Engineer
Maemo Software

More information about the maemo-developers mailing list