{ "id": "165311", "key": "TIMOB-24312", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "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": [], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2018-12-04T15:33:40.000+0000", "created": "2017-01-16T13:35:04.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [], "versions": [ { "id": "18154", "name": "Release 6.0.1", "archived": false, "released": true, "releaseDate": "2016-12-21" } ], "issuelinks": [], "assignee": null, "updated": "2018-12-04T15:33:40.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": [], "description": "Hi,\r\nL() function not working on 6.0.1.GA but working as expected on 5.5.1.GA on android. \r\n\r\nStep to reproduce:\r\n1. Create a test project.\r\n2. Add the following code on app.js\r\n{code}\r\nTi.UI.setBackgroundColor('white');\r\nvar win = Ti.UI.createWindow({\r\n\ttitle : 'Click window to test',\r\n\tbackgroundColor : 'white',\r\n\texitOnClose : true,\r\n\tfullscreen : false\r\n});\r\n\r\nwin.open();\r\n\r\nfunction L(text) {\r\n\tif (Ti.App.languageXML === undefined || Ti.App.languageXML === null) {\r\n\t\tvar langFile = Ti.App.Properties.getString('last_lang'); \r\n\t\tvar file = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory,+langFile + '/string.xml'); \r\n\t\tif (!file.exists()) {\r\n\t\t\tvar langFile = \"en\"; // Fall back to english as the default\r\n\t\t\tfile = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory,'lang/' + langFile + '/string.xml');\r\n\t\t}\r\n\t\tvar xmltext = file.read().text;\r\n\t\tvar xmldata = Titanium.XML.parseString(xmltext); // Parse the xml\r\n\t\tTi.App.languageXML = xmldata; // Store the parsed xml so that we don't\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t}\r\n\r\n\t// Get the localised string from xml file\r\n\tvar xpath = \"/resources/string[@name='\" + text + \"']/text()\";\r\n\tTi.API.info(\"PAROLE PATH: \" + JSON.stringify(xpath));\r\n\tvar result = Ti.App.languageXML.evaluate(xpath).item(0);\r\n\r\n\tif (result) {\r\n\t\treturn result.text;\r\n\t} else {\r\n\t\treturn text;// Return the text if localised version not found\r\n\t}\r\n}\r\n\r\nalert(\"MICRO: \"+JSON.stringify(L('microscope')));\r\n\r\nTi.API.info(\"MICRO: \"+JSON.stringify(L('microscope')));\r\n\r\nwin.open();\r\n{code}\r\n4. Add attached string.xml on i18n/en \r\n\r\n5. Now build with 5.5.1.GA\r\n{code}\r\n[INFO] : PAROLE PATH: \"/resources/string[@name='microscope']/text()\"\r\n[INFO] : MICRO: \"MICROSCOPE\"\r\n{code}\r\n6. Now build with 6.0.1.GA\r\n{code}\r\n[INFO] : PAROLE PATH: \"/resources/string[@name='microscope']/text()\"\r\n[INFO] : MICRO: undefined\r\n{code}\r\n", "attachment": [ { "id": "61255", "filename": "strings.xml", "author": { "name": "nsalahin", "key": "nsalahin", "displayName": "Nazmus Salahin", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2017-01-16T13:36:59.000+0000", "size": 16634, "mimeType": "text/xml" } ], "flagged": false, "summary": "Android: L() function not working in 6.0.1.GA but working as expected in 5.5.1.GA(Regression)", "creator": { "name": "nsalahin", "key": "nsalahin", "displayName": "Nazmus Salahin", "active": true, "timeZone": "Asia/Dhaka" }, "subtasks": [], "reporter": { "name": "nsalahin", "key": "nsalahin", "displayName": "Nazmus Salahin", "active": true, "timeZone": "Asia/Dhaka" }, "environment": "Operating System\r\n Name = Mac OS X\r\n Version = 10.11.6\r\n Architecture = 64bit\r\n # CPUs = 4\r\n Memory = 8589934592\r\nNode.js\r\n Node.js Version = 4.4.4\r\n npm Version = 2.15.1\r\nTitanium CLI\r\n CLI Version = 5.0.11\r\nTitanium SDK\r\n SDK Version = 6.0.1.GA", "comment": { "comments": [ { "id": "404645", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hey [~nsalahin],\r\n\r\nam I missing something or why don't you store you language keys in i18n/en/strings.xml?", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-16T16:06:16.000+0000", "updated": "2017-01-16T16:06:16.000+0000" }, { "id": "404650", "author": { "name": "nsalahin", "key": "nsalahin", "displayName": "Nazmus Salahin", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Hi,\r\nI store language keys in i18n/en/strings.xml", "updateAuthor": { "name": "nsalahin", "key": "nsalahin", "displayName": "Nazmus Salahin", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2017-01-16T18:24:09.000+0000", "updated": "2017-01-16T18:24:09.000+0000" }, { "id": "404652", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Sorry, I don't get that. Why are you creating an own {{L()}} function to the one that already exists and handles all this? If you followed [this guide|https://wiki.appcelerator.org/display/guides2/Internationalization], the keys should work fine. ", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-16T18:27:30.000+0000", "updated": "2017-01-16T18:27:30.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }