Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3639] Android and iOS: Localization issues for Chinese dialects

GitHub Issuen/a
TypeBug
PriorityHigh
StatusResolved
ResolutionCannot Reproduce
Resolution Date2015-12-30T07:24:34.000+0000
Affected Version/sRelease 1.7.0, Release 3.5.0
Fix Version/sn/a
ComponentsAndroid, iOS, Tooling
Labelsn/a
ReporterKevin Whinnery
AssigneeFeon Sua Xin Miao
Created2011-04-21T11:27:03.000+0000
Updated2016-09-08T12:21:22.000+0000

Description

Our internationalization facilities for Chinese localizations has a problem where the required naming conventions for the folders in the i18n directory are different for one platform versus the other. The example that was brought to my attention required the following set up for iOS: /i18n /zh-Hant /zh-Hans and the following setup for Android /i18n /zh-rTW /zh-rCN When trying to use the iOS configuration for Android, the Python build scripts report an error that the "resource directory name is invalid". Both configurations work on their platforms, but not when tested on the other platform. It's a major problem for localizations in East Asian markets.

Attachments

FileDateSize
Chinese.zip2014-09-03T11:29:40.000+00003311829
TiBountyHunter220.zip2011-04-21T11:58:36.000+00002771471

Comments

  1. Marshall Culpepper 2011-08-05

    It looks like zh-Hant and zh-Hans locales aren't supported by Android, so I'm not sure that anything can be done on the Android side. Have you tried using zh-TW / zh-CN (without the "r" prefix) on both, to see if that fixes the problem?
  2. Marshall Culpepper 2011-08-22

    Moving forward to 1.9.0 TBS, workaround should exist (see comments), and there isn't a clear path of support from Android for the alternative locales
  3. Brandon DuRette 2011-09-16

    It would be nice if the build tools simply ignored (or perhaps issued a warning) about i18n directories that it does not understand rather than failing outright. This would at least allow for a single project to include zh-hans and zh-rcn and not have it fail to build. The workaround suggested above (zh-CN) does not work. Works fine on Android, but not in iOS.
  4. Mark Henderson 2012-12-12

    Can I champion this issue.. It seems straight forward that any build script simply ignore unsupported folder names.. At the moment I'm in a non-cross-platform compliant project situation because my app supports chinese localisation? I'm going to have to swap the folders out each time I want to build?
  5. Eric Hu 2013-01-25

    Even nicer would be if a build script allowed one folder to be used for ios/android, perhaps with symlinking or setting config flags on the iOS/Android side
  6. Seven Bai 2013-02-18

    I tried to modify Titanium Mobile SDK build script, localecompiler.py, as below and it works (tested on SDK 3.0.2).
       def compile_for_ios(self,file):
                       locale = self.get_locale(file)
       >                if locale == 'zh-TW': locale = 'zh-Hant'
       >                if locale == 'zh-CN': locale = 'zh-Hans'
                       build_dir = self.get_ios_dir()
       
    Hopefully this issue can be fixed officially by Appcelerator soon.
  7. Jeff Haynie 2013-02-18

    we need to re-test with the new CLI / 3.0.2 release.
  8. Jeff Haynie 2013-02-18

    @Steven Bai -- i'm not sure that localecompiler.py is used in 3.0.2 since we are now using the new CLI project at http://github.com/appcelerator/titanium and for iphone and the ios build script for locale is at https://github.com/appcelerator/titanium_mobile/blob/master/iphone/cli/commands/_build.js#L1818.
  9. Chris Barber 2013-02-18

    localecompiler.py is still used by Android's build script. iOS and Mobile Web use the new i18n mechanism. We need to gather some data about the various platform's Chinese dialect names. I'm concerned that the fix forces the locale to "zh-Hant" when Marshall's first comments says it doesn't look like Android supports zh-Hant.
  10. Seven Bai 2013-02-18

    @Jeff Haynie - My fault! You are right, I tested my above solution in 2.1.4 instead of 3.x. For 3.x, it can be solved by similar approach - create .lproj with correct file name, and it works too. @Chris Barber - Agree, it is better to gather and handle all the difference between these platforms inside Titanium Mobile SDK, and define a uniform rule for Titanium Mobile SDK user.
  11. Caleb Cox 2013-12-23

    With Titanium SDK 3.2.0, I found that using zh-rCN works on both iOS and Android.
  12. Ingo Muschenetz 2014-05-01

    Need more information before we are able to prioritize properly.
  13. Eduardo Gomez 2014-09-03

    Locale strings for Chinese simplified and Chinese traditional work on Android. I have used the folder names 'zh-rCN' for Simplified Chinese and 'zh-rTW' for Traditional Chinese. Attached Sample "Chinese.zip" for verification. Titanium Command-Line Interface, CLI version 3.3.0, Titanium SDK version 3.3.0.GA, Xperia Play device with Android 4.0.4 (API level 14)
        //Sample Code:
        var str = Ti.Locale.getString('holiday_greeting');
        alert(str);
        alert(Ti.Locale.getCurrentLanguage());
        //Output:
        [INFO] :   ALERT: (KrollRuntimeThread) [241,241] 新年快乐!
        [INFO] :   ALERT: (KrollRuntimeThread) [0,241] zh
        
  14. grebulon 2014-12-01

    There's a suggested fix at [the support site](https://developer.appcelerator.com/question/148383/language-code-if-include-country-code#answer-257000). Personally, I think it's about time to fix this...
  15. Vishal Duggal 2015-03-05

    The android system is pretty simple as explained here http://developer.android.com/guide/topics/resources/providing-resources.html#AlternativeResources The language is defined by a two-letter ISO 639-1 language code, optionally followed by a two letter ISO 3166-1-alpha-2 region code (preceded by lowercase "r"). iOS seems to be all over the place. Following standards when possible otherwise doing their own thing. For example chinese in Taiwan would be zh-rTW on Android. On iOS according to xcode settings it would be zh-Hant-TW.(Traditional chinese taiwan) iOS also seems to support non ISO 639-1 language codes. One thing me might do is restrict the i18n folder to only allow ISO 639-1 language codes. Then allow region specific localization strings in the platform specific folder under Resources//i18n. Or we could allow the Android standard in i18N(without the r prefix) and also allow platform specific localization stings under Resources//i18n.
  16. Ingo Muschenetz 2015-03-12

    Everyone, to confirm, the workaround specified https://developer.appcelerator.com/question/148383/language-code-if-include-country-code#answer-257000 does NOT work? Also, I'd like to know if there is a preference based on Vishal's suggestions.
  17. Ingo Muschenetz 2015-03-13

    Moving this to 4.1.0 while we await feedback. If we can find an appropriate workaround or solution before then, we will release in a patch update.
  18. Jérémy Tonneau 2015-05-06

    Hi, Any news on this ? Is it not possible to backport this feature in 3.5.2 for instance ? Thanks !
  19. Ingo Muschenetz 2015-05-06

    [~Cryde] I asked if the workaround continued to work. Does it?
  20. Ingo Muschenetz 2015-06-18

    Still awaiting feedback. Moving to 4.1.1 while we wait.
  21. Mark Henderson 2015-08-17

    To confirm the workaround specified above will NOT work. The function compileI18N has changed significantly in the 2 years since it was first proposed. Also to add, a lot of Android device manufacturers put in extra localisations into their devices. For example I have a client who can choose Hong Kong Chinese as an option on a standard Samsung tablet device. The only way Traditional Chinese will work with my app is if they change the device to Taiwan Chinese (again another localisation not supported natively by Android). See [here](http://stackoverflow.com/a/4250246/181197)
  22. Shawn Lan 2015-09-14

    I use zh_TW for iOS. Today I found that when building for Android, there is no longer an error! What happened? SDK 4.1.1
  23. Hans Knöchel 2015-10-16

    Can other users confirm this?
  24. Srikanth Sombhatla 2015-12-15

    Using zh_TW did work on iOS and Android. Appcelerator Studio build: 4.4.0.201511241829 CLI: 5.1.0 iOS: 9.1 Android: 5.1.1
  25. Feon Sua Xin Miao 2015-12-17

    I can't reproduce this.
  26. Mark Henderson 2016-09-08

    I got this when submitting to Apple: Unrecognized Locale - The directory located at ( 'Payload/YouRApp.app/zh-rCN.lproj' ) has an unrecognized locale name. Refer to the Language and Locale Designations guide for more information on naming your language-specific directories.
  27. Ingo Muschenetz 2016-09-08

    [~fmiao] FYI

JSON Source