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

From: mohamed ismael mohamed.ismael at asgatech.com
Date: Wed Nov 18 15:48:11 EET 2009
hello ,
i am trying to change the language during run time.
i road the documentation of the 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");
             		bindtextdomain(GETTEXT_PACKAGE, localedir);
			bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");

i added the following line to configure.ac file


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

the application run and display my language but when i click on a button which contain the following code 

setlocale(LC_ALL, "en_GB");

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?
2- how to change the language during run time?


More information about the maemo-developers mailing list