Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-5614] MobileWeb: Ti.Locale.currentLanguage returns undefined. Should be readonly property.

GitHub Issuen/a
TypeBug
PriorityTrivial
StatusClosed
ResolutionDuplicate
Resolution Date2012-01-11T23:13:52.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsMobileWeb
Labelsn/a
ReporterMisha Vasko
AssigneeChris Barber
Created2011-06-28T02:14:17.000+0000
Updated2014-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';
});

Comments

  1. Chris Barber 2012-01-11

    Covered by TIMOB-7121.

JSON Source