[TIMOB-3639] Android and iOS: Localization issues for Chinese dialects
GitHub Issue | n/a |
Type | Bug |
Priority | High |
Status | Resolved |
Resolution | Cannot Reproduce |
Resolution Date | 2015-12-30T07:24:34.000+0000 |
Affected Version/s | Release 1.7.0, Release 3.5.0 |
Fix Version/s | n/a |
Components | Android, iOS, Tooling |
Labels | n/a |
Reporter | Kevin Whinnery |
Assignee | Feon Sua Xin Miao |
Created | 2011-04-21T11:27:03.000+0000 |
Updated | 2016-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
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?
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
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.
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?
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
I tried to modify Titanium Mobile SDK build script, localecompiler.py, as below and it works (tested on SDK 3.0.2).
Hopefully this issue can be fixed officially by Appcelerator soon.
we need to re-test with the new CLI / 3.0.2 release.
@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.
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.
@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.
With Titanium SDK 3.2.0, I found that using zh-rCN works on both iOS and Android.
Need more information before we are able to prioritize properly.
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)
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...
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/
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.
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.
Hi, Any news on this ? Is it not possible to backport this feature in 3.5.2 for instance ? Thanks !
[~Cryde] I asked if the workaround continued to work. Does it?
Still awaiting feedback. Moving to 4.1.1 while we wait.
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)
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
Can other users confirm this?
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
I can't reproduce this.
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.
[~fmiao] FYI