[AC-3680] Windows: Ti.Locale.getString()/L() does not reflect Ti.Locale.setLanguage()
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | n/a |
| Status | Closed |
| Resolution | Duplicate |
| Resolution Date | 2016-06-02T16:20:37.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | n/a |
| Labels | n/a |
| Reporter | Jonas Bjurhult |
| Assignee | Shak Hossain |
| Created | 2016-06-01T08:35:11.000+0000 |
| Updated | 2016-06-02T16:20:37.000+0000 |
Description
Setting language via Ti.Locale.setLanguage() changes language in the app, but it does not affect the language returned in Ti.Locale.getString()/L()like on iOS or Android.
The following code shows the problem:
index.js
Ti.Locale.setLanguage('en');
Ti.API.info('current language is: ' + Ti.Locale.getCurrentLanguage());
Ti.API.info('before change ' + L('test'));
Ti.Locale.setLanguage('sv');
Ti.API.info('new language is: ' + Ti.Locale.getCurrentLanguage());
Ti.API.info('after change ' + L('test'));
i18n/en/strings.xml
<?xml version="1.0" encoding="UTF-8"?><resources>
<string name="test">This is a test string in English</string>
</resources>
i18n/sv/strings.xml
<?xml version="1.0" encoding="UTF-8"?><resources>
<string name="test">This is a test string in Swedish</string>
</resources>
Hello, I am able to reproduce this issue with given code and given steps. *Steps:* 1. Create a default classic project for Windows Phone. 2. Replace the app.js file with following code.
3. Createvar win= Titanium.UI.createWindow({ title:'Tab 1', backgroundColor:'#fff' }); win.open(); Ti.Locale.setLanguage('en'); Ti.API.info('current language is: ' + Ti.Locale.getCurrentLanguage()); Ti.API.info('before change ' + L('test')); Ti.Locale.setLanguage('sv'); Ti.API.info('new language is: ' + Ti.Locale.getCurrentLanguage()); Ti.API.info('after change ' + L('test'));i18n/enandi18n/svfolder. 4. In thei18n/encreate strings.xml file with following content.5. In thei18n/svcreate strings.xml file with the following content.4. Build and run the app . Following log is produced.Thanks *Environment*: *OS :* Microsoft Windows 8.1 Enterprise N *Device info:* Microsoft Lumia 640 (Windows Phone 8.1) *Node.js Version:* 0.12.7 *npm Version:* 2.11.3 *Titanium SDKs:* 5.4.0.v20160429102159 *Java Development Kit Version:* 1.8.0_73 *Titanium CLI Version:* 5.0.5 *Appcelerator CLI Version:* 5.2.2 *Appcelerator Studio:* 4.5.0