Giter Club home page Giter Club logo

json.i18n-for-titanium-mobile's Introduction

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:

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 value

A shortcut also exists for the getFormattedString method as follows:

I('parent.child.value3','value') -> Supports interpolation value

EXAMPLE 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

Redux 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

json.i18n-for-titanium-mobile's People

Contributors

mattheworiordan avatar

Stargazers

Loren Hsu avatar

Watchers

Loren Hsu avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.