{ "id": "63033", "key": "TIMOB-2401", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "11235", "name": "Release 1.6.0 M02", "archived": true, "released": true, "releaseDate": "2010-12-27" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T01:59:00.000+0000", "created": "2011-04-15T03:18:43.000+0000", "priority": { "name": "Trivial", "id": "5" }, "labels": [ "feature", "ios", "iphone", "release-1.6.0" ], "versions": [], "issuelinks": [], "assignee": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-17T01:59:00.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "{html}
See #1870 for the initial, Android implementation\ndirectives from our customer.
\nAdd to Ti.Locale:
\ngetCurrentLanguage()
- returns language string such\nas \"en\".
getCurrentCountry()
- returns \"US\" for example.
getCurrentLocale()
- returns \"en-US\" for\nexample.
getCurrencyCode(locale_string)
- e.g., pass \"en-US\"\nand it will return \"USD\"
getCurrencySymbol(currency_code)
- e.g., pass \"USD\"\nand it will return \"$\"
getLocaleCurrencySymbol(locale_string)
- e.g., pass\n\"en-US\" and it will return \"$\"
Locale and format string support for\nString.formatDecimal
:
String.formatDecimal(2.5)
- returns 2.5 formatted\nin current locale. If a european locale, for example, will return\n\"2,5\".
String.formatDecimal(2.5, \"000.000\")
- e.g.,\nreturns \"002.500\" if current locale is en_US, or \"002,500\" if\ncurrent locale is de_AT.
String.formatDecimal(2.5, 'de-AT')
- returns\n\"2,5\"
String.formatDecimal(2.5, 'de-AT', '000.0000')
-\nreturns \"002,50000\"
You can exercise these with this simple program (app.js):
\n\n/*global Ti, Titanium, alert, JSON */\nTitanium.UI.setBackgroundColor('#000');\nvar win = Titanium.UI.createWindow({ \n title:'Test',\n backgroundColor:'#fff',\n fullscreen: true,\n exitOnClose: true\n});\n\nvar rows = [];\nfunction makeRow(title) {\n rows.push(Ti.UI.createTableViewRow({title: title}));\n}\n\nvar statements = \n ['Ti.Locale.getCurrentLanguage()',\n 'Ti.Locale.getCurrentCountry()',\n 'Ti.Locale.getCurrentLocale()',\n 'Ti.Locale.getCurrencyCode(Ti.Locale.getCurrentLocale())',\n 'Ti.Locale.getCurrencyCode(\"en-GB\")',\n 'Ti.Locale.getCurrencyCode(\"-GB\")',\n 'Ti.Locale.getCurrencySymbol(\"EUR\")',\n 'Ti.Locale.getCurrencySymbol(\"GBP\")',\n 'Ti.Locale.getLocaleCurrencySymbol(\"en-US\")',\n 'String.formatDecimal(2.5)',\n 'String.formatDecimal(2.5, \"000.00\")',\n 'String.formatDecimal(2.5, \"de-DE\")',\n 'String.formatDecimal(2.5, \"de-DE\", \"000.00\")'\n ];\n \nfor (var i = 0; i < statements.length; i++) {\n makeRow(statements[i] + \" = \" + eval(statements[i]));\n}\n\nwin.add(Ti.UI.createTableView({data:rows}));\n\nwin.open();
\n
NOTE: I put a locale.js test suite into the drillbit/tests\nfolder. It's okay that it won't pass for iOS (based on Ralf's\ncomment in his e-mail, namely all tests must pass except \"tests for\nfeatures or bugs not scheduled for the next release. For example I\ndon't want to slow down test creation.\") Since we're not sure yet\nwhen this feature will be scheduled, this rule applies.
I decided to go ahead and do the api doc additions for the\n#1870 changes; I just know I'd never get around\nto it otherwise, and I didn't want you guys to have to do it. I\nmarked them Android Only, so if you do get this into 1.5,\nbe sure to just open apidoc/Titanium/Locale/Locale.tdoc and search\nfor 'Android' and take out those comments.
(from [5d84d4aaa3503788da996a4f7846f60c31255f28])\n[#2401 state:fixed-in-qa] Localization\nenhancements for iOS. \nhttps://github.com/appcelerator/titanium_mobile/commit/5d84d4aaa350...
[INFO] Titanium SDK version: 1.6.0 (01/12/11\n09:38 db09d1e) 4GT ipod touch, 3G iphone 3.1.3. English and Spanish\nchecked for langs, and usa and japan checked for locale. moved test\nto QATests