{ "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.

\n

Add to Ti.Locale:

\n

getCurrentLanguage() - returns language string such\nas \"en\".

\n

getCurrentCountry() - returns \"US\" for example.

\n

getCurrentLocale() - returns \"en-US\" for\nexample.

\n

getCurrencyCode(locale_string) - e.g., pass \"en-US\"\nand it will return \"USD\"

\n

getCurrencySymbol(currency_code) - e.g., pass \"USD\"\nand it will return \"$\"

\n

getLocaleCurrencySymbol(locale_string) - e.g., pass\n\"en-US\" and it will return \"$\"

\n

Locale and format string support for\nString.formatDecimal:

\n

String.formatDecimal(2.5) - returns 2.5 formatted\nin current locale. If a european locale, for example, will return\n\"2,5\".

\n

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.

\n

String.formatDecimal(2.5, 'de-AT') - returns\n\"2,5\"

\n

String.formatDecimal(2.5, 'de-AT', '000.0000') -\nreturns \"002,50000\"

\n

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
{html}", "attachment": [], "flagged": false, "summary": "iOS: Several localization enhancements", "creator": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "comment": { "comments": [ { "id": "128365", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

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.

{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T03:18:43.000+0000", "updated": "2011-04-15T03:18:43.000+0000" }, { "id": "128366", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

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.

{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T03:18:43.000+0000", "updated": "2011-04-15T03:18:43.000+0000" }, { "id": "128367", "author": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "body": "{html}

(from [5d84d4aaa3503788da996a4f7846f60c31255f28])\n[#2401 state:fixed-in-qa] Localization\nenhancements for iOS. \nhttps://github.com/appcelerator/titanium_mobile/commit/5d84d4aaa350...

{html}", "updateAuthor": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:18:44.000+0000", "updated": "2011-04-15T03:18:44.000+0000" }, { "id": "128368", "author": { "name": "thomashuelbert", "key": "thomashuelbert", "displayName": "Thomas Huelbert", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

[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

{html}", "updateAuthor": { "name": "thomashuelbert", "key": "thomashuelbert", "displayName": "Thomas Huelbert", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:18:44.000+0000", "updated": "2011-04-15T03:18:44.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }