Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Maemo: Developers

how to change the language of the program during run time?

 

 

Maemo developers RSS feed   Index | Next | Previous | View Threaded


mohamed.ismael at asgatech

Nov 18, 2009, 5:48 AM

Post #1 of 3 (485 views)
Permalink
how to change the language of the program during run time?

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");
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"

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?

thanks



_______________________________________________
maemo-developers mailing list
maemo-developers [at] maemo
https://lists.maemo.org/mailman/listinfo/maemo-developers


khaledhosny at eglug

Nov 18, 2009, 7:04 AM

Post #2 of 3 (436 views)
Permalink
Re: how to change the language of the program during run time? [In reply to]

On Wed, Nov 18, 2009 at 03:48:11PM +0200, 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

Just a quick note, the Arabic locale is 'ar' only not 'ar_AR', AFAIK
there is no such glibc locale.


--
Khaled Hosny
Arabic localiser and member of Arabeyes.org team
Free font developer
Attachments: signature.asc (0.19 KB)


mohammed.2.hassan at nokia

Nov 19, 2009, 4:11 AM

Post #3 of 3 (428 views)
Permalink
Re: how to change the language of the program during run time? [In reply to]

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.

Cheers,

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

_______________________________________________
maemo-developers mailing list
maemo-developers [at] maemo
https://lists.maemo.org/mailman/listinfo/maemo-developers

Maemo developers RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.