Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18816] Android: Region support for i18n directory

GitHub Issuen/a
TypeImprovement
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2015-05-21T20:36:45.000+0000
Affected Version/sn/a
Fix Version/sRelease 4.1.0
ComponentsAndroid
Labelslanguage
ReporterCristian Cepeda
AssigneeAshraf Abu
Created2015-04-08T17:35:34.000+0000
Updated2017-03-16T21:54:21.000+0000

Description

Following are the issues found around the modification of language at runtime in Android app: * Titanium module LocaleModule does not offer support for changing the language (it is supported on iOS) * Compilation script does not support regions (i.e. es-CO, es-CL) In the current task it’s required to allow the modification of language + region for Android platform. Github PR: https://github.com/appcelerator/titanium_mobile/pull/6772

Attachments

FileDateSize
TestApp.zip2015-06-23T18:22:05.000+00002490

Comments

  1. Ashraf Abu 2015-05-20

    To test: -Scons the to get the Appcelerator SDK -Install in Studio -Do the following steps below Test code:
       var win = Ti.UI.createWindow();
       
       var button = Titanium.UI.createButton({
          title: 'Press Me for ja',
          top: 10,
          height: 50
       });
       
       var button2 = Titanium.UI.createButton({
          title: 'Press Me for en',
          top: 60,
          height: 50
       });
       
       button.addEventListener('click',function(e)
       {
          Titanium.API.info("You clicked the button");
          Ti.Locale.setLanguage("ja");
          var str1 = L('timobtest');
          var str2 = Ti.Locale.getString('timobtest');
          Titanium.API.info(str1);
          Titanium.API.info(str2);
       });
       
       button2.addEventListener('click',function(e)
       {
          Titanium.API.info("You clicked the button");
          Ti.Locale.setLanguage("en");
          var str1 = L('timobtest');
          var str2 = Ti.Locale.getString('timobtest');
          Titanium.API.info(str1);
          Titanium.API.info(str2);
       });
       
       win.add(button);
       win.add(button2);
       
       win.open();
       
    Please put 2 strings.xml in the following folder: /platform/android/res/values-en/strings.xml /platform/android/res/values-ja/strings.xml It should contain:-
       <?xml version="1.0" encoding="utf-8"?>
       <resources>
       	<string name="timobtest">Cat</string>
       </resources>
       
    for the first strings.xml and
       <?xml version="1.0" encoding="utf-8"?>
       <resources>
       	<string name="timobtest">猫</string>
       </resources>
       
    For the second strings.xml
  2. Benjamin Hatfield 2015-06-23

    [~emerriman] Attached sample code to test region support.
  3. Lee Morris 2017-03-16

    Closing ticket as the issue has been fixed.

JSON Source