How to set Titanium.Platform.locale
If I set -
Titanium.Platform.locale = 'ja'
it is not getting updated.
\project-name\i18n\en\strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="m1">ENG-111</string>
<string name="m2">ENG-222</string>
</resources>
\project-name\i18n\ja\strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="m1">JA-111</string>
<string name="m2">JA-222</string>
</resources>
app.js
Ti.API.info('Titanium.Platform.locale : ' + Titanium.Platform.locale);
Titanium.Platform.locale = 'ja';
Ti.API.info('currentLanguage : ' + Ti.Locale.currentLanguage + '. ~~But I expect ja here' );
Ti.API.info('Localized string m1 : '+L("m1") + '. ~~But I expect JA-111 here' );
Results:
Titanium.Platform.locale : en-US
currentLanguage : en. ~~But I expect ja here
Localized string m1 : ENG-111. ~~But I expect JA-111 here
2 Answers
-
Rajeswari
From what I understand, the user sets their required locale via the device's system config applet, and the Titanium.Platform.locale property simply returns that value. I am not sure it makes much sense for the developer to make this choice for the user.
Having said that, I will confirm that this is true because, if so, the apidocs need to be updated to reflect the property's read-only nature.
Cheers
-
To change the Android emulator languge – "Open menu=>Setting=>Language& Keyboard=>Select Language"
http://stackoverflow.com/questions/5755460/how-to-change-the-default-language-of-android-emulator