[TIMOB-5548] MobileWeb: Ti.Locale.currentLocale returns incorrect value. Should be readonly property.
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-06-29T01:23:09.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Sprint 2011-41 |
Components | MobileWeb |
Labels | n/a |
Reporter | Misha Vasko |
Assignee | Andrew Kulinich |
Created | 2011-06-28T02:39:33.000+0000 |
Updated | 2017-03-03T23:34:11.000+0000 |
Description
Ti.Locale.currentLocale returns 'en' value by default. It have to return value in such format 'ru-RU', 'en-US', etc([Ti.Locale documentation](http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Locale-module)). This property should be readonly.
Additional details:
1. Ti.Locale.currentLocale specified only for Android. Value of Ti.Locale.currentLocale defined by Custom Locale properties in Android OS. Property is readonly.
2. Ti.Locale.currentLocale not specified for iOS. It returns 'undefined' and can be programmatically changed.
var win = Titanium.UI.currentWindow;
win.backgroundColor = '#EEE';
var show = Ti.UI.createButton({
title: 'Show',
left: 90,
top: 10,
width: 140,
height: 45,
fontSize: 20
});
var close = Ti.UI.createButton({
title: 'Close',
left: 90,
top: 60,
width: 140,
height: 45,
fontSize: 20
});
var ta = Ti.UI.createTextArea({
top: 110,
left: 10,
width: 300,
height: 180,
backgroundColor: 'white',
fontSize: 18
});
win.add(show);
win.add(close);
win.add(ta);
close.addEventListener('click', function(){
Titanium.UI.currentWindow.close();
});
show.addEventListener('click',function(){
ta.value = ta.value + 'Current Locale: ' + Ti.Locale.currentLocale + '\r\n';
});
Property left writable - because this is not device and it can be usable to change locale in app because we can't know user's locale. now using Ti.Locale.currentLanguage to change app language
Closing ticket as MobileWeb is no longer supported.