语言

Menu
Sites
Language
Get current language setting

Hi,
Using :
system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale); 
the language locale is returned as :

en_US, de_DE, fr_FR. i.e. the encoding information is missing which according to the API documentation of elm_language_set is required.
"The lang passed must be the full name of the locale to use, for example "en_US.utf8" or "es_ES@euro"."

Same behaviour from : 
runtime_info_get_value_string(RUNTIME_INFO_KEY_LANGUAGE, &locale);

I had to use char *lang = vconf_get_str(VCONFKEY_LANGSET);
to get the full name of the language locale (en_US.UTF-8, de_DE.UTF-8 etc.


 

响应

6 回复
Alex Dem

Hi,
Thank you for useful info! In all guides / examples is used this code:

    system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
    elm_language_set(locale);

I hope it will be fixed.
Alexey.

Manos Theocharopoulos

Hi Alexey,
I gave the localization API a try and nothing works.
I have created the .po files and translatable strings as described in the PO File Editor instructions and both :

elm_object_translatable_text_set(ad->parseButton1, "IDS_IRIS");

i18n_get_text("IDS_IRIS");

Return the original string IDS_IRIS instead of the translated one.
I have tried with different variations of system_settings_get_value_string but nothing works.

Do you have any ideas ?

 

Alex Dem

Hi,
Try to look at native example 'LanguageChange UI sample application'. But I was able to see translations only for some languages from this example.
Also, try to look at: Settings app ->Language and input->Display language , to see avialable languages. I suspect that only these languages are available to set with elm_language_set.
Unfortunately elm_language_set api does not returns any error.
For example I was able to call elm_language_set("ko_KR.UTF-8"); (as you had described) and see Korean translation but was unable to see for fr_CA .
afaik i18n_get_text try to get translations for current language. But if language is not supported in device then you get just your 'message' instead of.
On my device I was able to to see translations for some languages : English & Korean were available exactly.
Alexey.

Manos Theocharopoulos

Hi Alexey,
I can't get it to work on the Emulator and I don't have a device available at the moment.
Have you tried it on the Emulator at all ?

Thanks
manos

Alex Dem

Hi Manos, 
On emulator 'LanguageChange UI sample application' looks like ok. I tried with elm_language_set or via Settings app. Lanuage has been changed.
Alexey.

Manos Theocharopoulos

Hi Alexey
Indeed the  'LanguageChange UI sample application' works fine. 
However there seems to be several issues when creating and editing the *.po files.
I had to copy the ones from LanguageChange UI sample application to get my translations to work eventhough the *.po files had the correct filenames and format and were edit in the SDK PO editor.

Also not all messages of the 'LanguageChange UI sample application' are shown on the PO editor.
The contents of 
en_US.po are :
 

msgid "IDS_LANGUAGE"
msgstr "Display language"

msgid "IDS_DONE"
msgstr "Done"

msgid "IDS_CURRENT"
msgstr "Current Status"

msgid "IDS_SELECT_ITEM"
msgstr "Select item"

however the IDS_LANGUAGE is not shown on the PO editor but it's translated correctly on runtime.

Additionally for any change in a translation to take effect, a clean and rebuild is required. Occasionally I also have to delete the application and reinstall for translation changes to take effect.
 

Thanks for your support so far.
Manos