Titanium Locale Module for Both (Android and iOS)

In this post I am going to introduce to Locale module. This module helps to force the phone language only in your application. And you can just follow same i18n folder with your locale strings XML files (For example :- “en” folder >  strings.xml …).

Locale Titanium module
Locale Titanium module

To load Locale module into your app, write below one line code.
var locale = require("com.shareourideas.locale");

After loading you need to force locale in your application, just call setLocale method with language.
locale.setLocale("es");

This above code helps to refer Spanish locale strings. Then if you try some thing like this.
Ti.API.info("This is just for test" + L("welcome_message"));

It will print Spanish locale string (from “es” folder > strings.xml). To get current locale you can use default Titanium property Ti.Locale.currentLanguage.

You can see example code in module folder and documentation as well. By the way make sure you tested your app after adding this locale module.

This module is free to trial and available for both Android and iOS from Appcelerator Titanium marketplace. Here are the download links.

Download Android Locale Module
Download

Download iOS Locale Module
Download