Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23207] Android: Can't get localized app_name from L

GitHub Issuen/a
TypeBug
PriorityMedium
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
LabelsAndroid, Location
ReporterAndrey Tkachenko
AssigneeUnknown
Created2016-04-04T07:55:38.000+0000
Updated2018-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.

Comments

  1. Nazmus Salahin 2016-04-04

    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.
       <resources>
       	<string name="appname">Australian APP</string>
       </resources>
       
    5. Replaced app.js code with following code.
       var win1 = Titanium.UI.createWindow({  
           title:'Tab 1',
           backgroundColor:'#fff'
       });
       
       win1.open();
       
       Ti.API.warn(L("app_name", "I'm default value"));
       
       
    6. Build and run the app. 7. Got the following console log.
       [WARN] :   Australian APP
       
    *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
  2. Andrey Tkachenko 2016-04-14

    But why Ti.Locale.getString("app_name") and L("app_name") has not identical value in my case?

JSON Source