Titanium Community Questions & Answer Archive

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

Localization with i18n - Default language?

Hi guys,

I'm localizing my app with this blog post

So how do I set the "fallback" (= default) language? I have a German and an English file, but if I set the Simulator's language to Spanish, the app defaults to German (should be English). How do I set the default language if the right i18n file does not exist?

Thanks for your help!

— asked June 16th 2011 by Felix Baaken
  • i18n
  • localization
  • translation
1 Comment
  • An issue that addresses this has been created: TIMOB-4881. Unfortunately it has been created over 2 years ago and it still doesn't have any scheduled release date.

    — commented February 9th 2014 by Dario Marcelino

5 Answers

  • Felix

    See Getting a localized string for an example of using the hint text parameter when no key exists.

    Cheers

    — answered June 17th 2011 by Paul Dowsett
    permalink
    5 Comments
    • But with that method I would have to go through all L() and put in the English string a second time.

      I was rather looking for a Ti.Locale.defaultLanguage = 'en' and that's it. If the language folder does not exist in i18n, take the en one, not the de one.

      — commented June 17th 2011 by Felix Baaken
    • Have you found a solution?

      Thx

      — commented July 12th 2011 by Romain Salles
    • Hi, is there any update on this ??

      Because this is really missing….
      In fact Felix is right, we are offered to internationize the app using the strings.xml, but if the device language doesn't match one define….then we are in dark waters..

      We are going far from an easy to maintain code if we have to set the hint for each text…(and we can easily forgot some)…

      Any update on this "issue" subject ??

      Thanks

      — commented July 14th 2011 by abbdoul ab
    • I am also looking for a solution for this. I need to properly direct the default language if the device is set in a language I don't have localization files for.

      — commented February 8th 2012 by Jean-Rene Auger
    • Same problem here. I've an app that is only in italian language and i don't want to translate it in english, i can create an it folder inside i18n with the italian strings, but if some non-italian user launches the app appcelerator tries to search for an "en" folder (because the default language is en) and if don't find my strings are showed as "null". So i need a way to set "italian" as default language, so that if a non-italian user launch the app appcelerator uses the "it" folder.

      In xcode there is a way to do that inside the Info.plist…it's very strange that there no way to set the default language in Appcelerator for bot iOS and Android!!

      Any clues ?

      — commented February 12th 2012 by Marco Siino
  • I could use some help on this too. What if the app is in two languages (dutch and french) and the device is in English. Is there a way to let the user select which is their preferred language?

    If the language is not found it automatically uses french - since "fr" comes before "nl" in alphabetical sorting or something, a stupid way to fall back!!

    The only solution I have found so far is:

    1. Create your i18n xml files
    2. Choose your default language
    3. copy the default language with a language code that comes first in the alphabet (I think it must be an existing code, like "aa" or something)
  • Any one find a solution ??

    — answered January 3rd 2013 by François Coppey
    permalink
    0 Comments
  • Anybody have an update or solution on this?
    To set the "Localization native development region" to English in the plist doesn't help :(

    — answered September 24th 2013 by Fab Ian
    permalink
    0 Comments
  • Answers above no longer apply, in Titanium alloy the folder that the language files go to is compiled from i18n to en.lproj and from strings.xml into Localizable.strings, therefore all that code above just breaks bcs the titanium XML parser can not parse the .strins file anymore.

    — answered October 21st 2013 by Stevo Perisic
    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.