how to use external language files to display text in the user's preferred language.

Objective
Contents
Language strings
Resource file structure
Getting a localized string
Replacing values in a localized string
iOS-specific localizations
Localize system buttons and submit to international App Stores
Localize property list keys
Set default language
Internationalizing the app's name
Changing locale for testing
App name localization
Android app name localization with Titanium SDK 3.1.x and older
Reference
Links
Internationalizing image and file resources
Date and time formatting
Other formatting and locale functions
Testing languages
Hands-on practice
Goal
Steps
Summary
References and further reading

 

 


Objective
In this section, you will learn how you can seamlessly internationalize your Titanium apps. We'll look specifically at how you can use external language files to display text in the user's preferred language.

 

Contents
Titanium provides a number of JavaScript functions in the Titanium.Locale namespace for use in localization. It also provides String formatting functions to handle dates, times, currencies, and more. You can even internationalize the name of your app itself. We'll look at those features, as well as how to test your language settings in this section.

Language strings
Rather than hard-coding strings into your project, you can use localized strings. Localized strings are replaced at runtime with values appropriate to the user's language. Titanium relies on resources files and string placeholders to accomplish this task.

In your Alloy project create a directory called i18n. Inside the i18n folder, create folders for each language your application will support. Name the folder according to the ISO 639-1 standard. For example, use en for English, es for Spanish, fr for French, etc.

You can also add a suffix to the language directories for variants of languages. However, if you don't plan on adding multiple suffix-ed directories omit the suffix completely. Suffix the folder name with a dash followed by the country's ISO 3166-1 Alpha-2 code.  For example, use en-US for American English, en-CA for Canadian English, en-GB for British English, etc.  Note that the OS may not support all regional languages.

Please reload

Featured Posts

EVENT CALENDAR 2018 Asia

December 27, 2017

1/10
Please reload

Recent Posts

February 10, 2018

Please reload

Search By Tags
Please reload

Follow Us
  • Facebook Classic
  • Twitter Classic
  • Google Classic

© 2016 by UP technologies International Pte. Ltd.

Version-R-0011 Released effect Jun 2020 Singapore