Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mattheworiordan/json.i18n-for-titanium-mobile
Localization library for Titanium Mobile using JSON
https://github.com/mattheworiordan/json.i18n-for-titanium-mobile
Last synced: 3 months ago
JSON representation
Localization library for Titanium Mobile using JSON
- Host: GitHub
- URL: https://github.com/mattheworiordan/json.i18n-for-titanium-mobile
- Owner: mattheworiordan
- Created: 2011-08-03T20:23:18.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2012-01-27T08:34:06.000Z (almost 13 years ago)
- Last Synced: 2024-04-13T07:29:44.202Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 2.04 MB
- Stars: 32
- Watchers: 2
- Forks: 7
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG
Awesome Lists containing this project
README
json.i18n has a simple goal:
To provide a more robust, easier to use, and generally nicer looking localization solution for Titanium based on JSON.To use its features, include the json.i18n.js file before you require access to localized resources.
Ti.include('vendor/json.18n.js');SETUP
====================You will need to create your localised resources as JSON files in /Resources/i18n/*.json
Example:* default.json (used for fallback values for any requests)
* en.json (2 letter language code, refer to http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes)
* en-US.json (2 letter language code & 2 letter country code, refer to http://en.wikipedia.org/wiki/ISO_3166-1)In each JSON file, you can define any object structure you like for the resources such as, but you must ensure you use valid JSON (i.e. enclosed in double quotation marks)
{
"parent": {
"child": {
"value1": "1",
"value2": "2".
"value3": "Supports interpolation %s"
}
}
}USE WITHIN YOUR APP
-------------------
i18n.getString('parent.child.value1') -> "1"
i18n.getFormattedString('parent.child.value3','value') -> Supports interpolation valueA shortcut also exists for the getFormattedString method as follows:
I('parent.child.value3','value') -> Supports interpolation valueEXAMPLE APP
-----------I strongly urge you to look at the sample application that is included at https://github.com/mattheworiordan/json.i18n-for-Titanium-Mobile/tree/master/example.
It is very straightforward and provides good examples of how the localized resources fallback to defaults.CONTACT INFORMATION
===========================json.i18n was made by Matthew O'Riordan (www.mattheworiordan.com).
Please provide feedback, I will happily add to this very simple little library.
I can be contacted through my website -- www.mattheworiordan.com