[TIMOB-5614] MobileWeb: Ti.Locale.currentLanguage returns undefined. Should be readonly property.
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Trivial |
| Status | Closed |
| Resolution | Duplicate |
| Resolution Date | 2012-01-11T23:13:52.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | MobileWeb |
| Labels | n/a |
| Reporter | Misha Vasko |
| Assignee | Chris Barber |
| Created | 2011-06-28T02:14:17.000+0000 |
| Updated | 2014-01-28T23:44:48.000+0000 |
Description
Ti.Locale.currentLanguage value is 'undefined' by default. It should return current language for the device based on the user's settings. Also, Ti.Locale.currentLanguage have to be readonly property ([Ti.Locale manual](http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Locale-module)). It can be changed only by changing language in system preferences of the device.
Additional information: in iOS_SDK and Android_SDK Ti.Locale.currentLanguage property is readonly and returns value defined in system preferences of the device.
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 = 'Current Language: ' + Ti.Locale.currentLanguage + '\r\n';
});
Covered by TIMOB-7121.