[TIMOB-23207] Android: Can't get localized app_name from L
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android |
Labels | Android, Location |
Reporter | Andrey Tkachenko |
Assignee | Unknown |
Created | 2016-04-04T07:55:38.000+0000 |
Updated | 2018-02-28T19:55:22.000+0000 |
Description
Steps to reproduce:
Create
app/i18n/ru/app.xml
<resources>
<string name="appname">Мое приложение</string>
</resources>
Build app and look at the build/android/res/values-ru/strings.xml
You can find localized value app_neme
there.
In app.js
add Ti.API.warn(L("app_name", "I'm default value"));
You can see: *I'm default value*
But must be: *Мое приложение*
But Ti.Locale.getString("app_name");
works as expected.
Hello, I think the issue here is the language selected in your android phone. If the language in your android phone is not selected as Russian then "L("app_name", "I'm default value")" will return the default value which happened in your case and I am able to reproduce also. I am actually able to get localized app name by doing the following steps. 1. Selected the language of my android phone as English-Australian 2. Created a default classic project for android. 3. Created folder "i18n/en-AU" in the project folder. 4. Created app.xml in that folder with following content.
5. Replaced app.js code with following code.
6. Build and run the app. 7. Got the following console log.
*Environment*: *Device info:* Nexux7 (android 6.0.1) *Node.js Version:* 0.12.7 *npm Version:* 2.11.3 *Titanium SDKs:* 5.2.0.GA and 5.2.1.GA *Java Development Kit Version:* 1.8.0_73 *Titanium CLI Version:* 5.0.5 *Appcelerator CLI Version:* 5.2.0 *Appcelerator Studio:* 4.4.0.201511241829
But why Ti.Locale.getString("app_name") and L("app_name") has not identical value in my case?