[TIMOB-18816] Android: Region support for i18n directory
| GitHub Issue | n/a |
|---|---|
| Type | Improvement |
| Priority | High |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2015-05-21T20:36:45.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 4.1.0 |
| Components | Android |
| Labels | language |
| Reporter | Cristian Cepeda |
| Assignee | Ashraf Abu |
| Created | 2015-04-08T17:35:34.000+0000 |
| Updated | 2017-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
| File | Date | Size |
|---|---|---|
| TestApp.zip | 2015-06-23T18:22:05.000+0000 | 2490 |
To test: -Scons the to get the Appcelerator SDK -Install in Studio -Do the following steps below Test code:
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:-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();for the first strings.xml andFor the second strings.xml[~emerriman] Attached sample code to test region support.
Closing ticket as the issue has been fixed.