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.

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 iOS Locale Module

53 thoughts on “Titanium Locale Module for Both (Android and iOS)

      1. Any chance you could open source this module, as we would submit a PR to make this 64 bit compatible. We have some new apps that require this asap. Thanks.

  1. We need to publish our application asap, and Appstore will reject it because the module is lacking 64-bit support. It takes 3 minutes to update, but there is no source code 🙁

  2. We are using your com.shareourideas.locale modules for iOS.
    While running on different simulator devices,It is working on few devices only not in all devices.
    We are getting below error.

    Script Error Couldn’t find module: com.shareourideas.locale for architecture: x86_64

    Please update the iOS module for 64-bit support.

    1. Hi we also need a 64-bit version of this module asap. Could you upload to Github or mail me at robert-jan at media-artists dot nl? Thanks!

    1. Thanks for the support!

      The file behind the OneDrive link does not seem to be shared. Or do I have to create a Microsoft account to download it?

  3. Hi, sorry to ask for help here, but I couldn’t find another way. Is it a bug or I’m doing something wrong that I can’t change locale using country codes in android. I have en, us, pt-rBR and pt-rPT locales. They work fine using the system locale but when I try to change it does nothing for the pt languages. I’ve tried multiple things (pt, pt-BR, pt-rBR).
    In iOS it works fine, the folders are differente but the module changes correctly.

        1. Yeah, the guide says that but I got country code working with the default phone language both in android and iOS. It is still very badly supported but it works. The language change doesn’t work on android though.

  4. Hi,
    I am thinking of purchasing this module for one of my application, but before i do, I have a few questions. Hopefully I will get reply as soon as possible:

    1) Is this module compatible with Alloy?
    2) Can we use titanium L method with this module?
    3) If I buy this module, it will work for a single application and does not matter how many times that application is installed?
    4) Is this module compatible with latest SDK 5.x?
    5) Can i use this module to change the application language without reloading the complete application? I mean in-app language change?

    Kindly reply me asap.

    Thank you

    1. Hi @Altaf Hussain ,
      First Thank you for buying!

      1) Yes, It will work same you have to use titleid textid in .tss and .XML or L(“STRING_NAME”) in .tss, .js

      2) Yes L method only helps to return string

      3) Yep, current policy is like that only. I hope this policy will not change.

      4) Recent tested with latest SDK and it works same.

      5) Yes, you no need to close the app and open again. But after changing the language, we have to re-render text, title values again.. then only it will effect.

      Thank you,
      Naga Harish.

      1. Hello Naga Harish,
        Thanks for your eply. I did not understand the answer 5. Is not your module rendering the text, titles for the selected language itself?


        1. Hi @disqus_h6YAputdVm:disqus ,

          I mean, if windows is opened already UI will be render (displayed) and it will add title or text based on currently. After that if you changed locale lang and came back to this screen by click back button it will still show old rendered labels texts only. For that we need re open the window or just update labels based on locale changed. I will recommend to show loader saving applying changes… in background close the current window or nav group and open it again. Than it will work as it is.

          I hope you understand now. Feel free if you still need my help..!

          Thank you,
          Naga Harish.

          1. Hi Naga Harish,

            What about the currently opened window, on which I change the language? Will it be displayed in the selected language when the language is changed, or I have to reload it also?


          2. You have to reload.. That is what I want to saying.. But I am missing somewhere.. (It is not possible, because ui already render by OS on screen before you changing language)…

          3. This is something i want to do, to reload the windows seamlessly so that the user of the app dont know. Like in native apps, or other apps, if you change the language, all titles are changed accordingly. They may be reloading the windows, but it is so seamless and fast that it does not effect the display.

            Do you think there is any module which can do this for me using that module with yours?


          4. I don’t think it is possible in native app also. with out reassigning value, title and texts to views.

            There is another without re opening windows:
            function init(){

            Helps to render text, values and titles
            function renderLocales(){
            $.label.text = L(“WELCOME”);

            function onWindowFocus(){
            if(Alloy.Globals.localeChanged) //This localeChanged value will be true when user changed the locale in setting screen..
            Alloy.Globals.localeChanged = false;

            or instead of window focus, you can also use Global event listeners.

            Think of those above approaches. Rendered UI can’t changed until reassign values to them again.

            Thank you,
            Naga Harish.

    1. Hi Dude,

      I updated the module to Appc store. They had issue with my account so removed my previous marketplace modules. And they asked me to upload newly. I did that one month back itself. Please subscribe new version Locale for Android and use. From two users I got personal feedback saying the new module works fine with Ti SDK 6.0.
      if you need more details please contact me in mail nagaharish.movva[@]gmail dot com

      Thank you,
      Naga Harish.

  5. “Found incompatible Titanium Modules” for android 0.1 version on Ti 6.0 SDK, can you give a download link for android version that works fine with Ti 6.0?

Leave a Reply