Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Add Localization into binary ?

Hello,

Is possible to make a MultiLanguage App with severals localizations ? (English,French ..

Thanks

Julien

— asked April 15th 2010 by Julien MOUAZAN
0 Comments

2 Answers

  • I used a separate include file with all the strings in arrays.

    For example,

    Welcome = ["English","French","Chinese"]

    Then, I used a app property names lang_id, which can be set to 0,1 or 2.

    So, for every instance of string display,

    I used something like Display Welcome[lang_id]

    — answered April 15th 2010 by Peter Lum
    permalink
    0 Comments
  • We're doing a similar thing as Peter in Golingo.
    However we're using one sqlite database per language, and only load the current language's database.

    This database is basically a key-value pair storage comparable to:

    fre.js

    // French
    var t = {
        hi: 'salut',
        bye: 'au revoir'
    }
    

    eng.js

    // English
    var t = {
        hi: 'hi',
        bye: 'bye'
    }
    

    Then you could run Ti.include(lang + '.js')
    And use your translations like Ti.UI.createLabel({ text: t.hi }); which would give you a label reading either 'hi' or 'salut' depending on wheter the lang variable is 'eng' or 'fre'.

    /Jacob

    — answered April 16th 2010 by Jacob Waller
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.