Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-5548] MobileWeb: Ti.Locale.currentLocale returns incorrect value. Should be readonly property.

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2011-06-29T01:23:09.000+0000
Affected Version/sn/a
Fix Version/sSprint 2011-41
ComponentsMobileWeb
Labelsn/a
ReporterMisha Vasko
AssigneeAndrew Kulinich
Created2011-06-28T02:39:33.000+0000
Updated2017-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';
});

Comments

  1. Andrew Kulinich 2011-06-29

    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
  2. Lee Morris 2017-03-03

    Closing ticket as MobileWeb is no longer supported.

JSON Source