Open jidesoft opened 5 years ago
Thanks @jidesoft for this!
Adding support for a script code will be a lengthy task and unsure which languages will this aid beyond Chinese (maybe Japanese, Korean, and other Asian languages?), what do you think @long1eu?
I suspect this may take up to an hour, including testing, so maybe we can put it on the to-do list for an upcoming minor release?
@jidesoft by any chance, do you want to submit a pr to add this functionality?
@noordawod @long1eu Since I need it anyway, I can do it if you can tell me where to modify the code as I am not familiar with the way IDEA plugin works. Here are the list of tasks I can think of.
I also need a way to support the scriptCode (Hans and Hant). Do you have plans to add this ability?
The code is written in Kotlin and you'd need to open the project in some Kotlin- and Gradle-capable IDE. I use, as part of normal work, IntelliJ IDEA and can certainly recommend it.
Thank you for your time for this answer and such a helpful library. You wrote above that you need about one hour to add this functionality. It's required because of without it it's impossible to support all Chinese languages, Traditional and Simplified. It works with Android, but not with iOS. Do you still have plans to add this feature?
One reason this doesn't work just on iOS is that you didn't added the supported languages to your Info.plist
@long1eu @noordawod Thank you for the answers. I added the supported languages to Info.plist, and all of them work fine except Chinese. But if I understand right, we can't fix it. Google wrote: "As of April 2019, the global localization classes support about 52 languages." And as we could see here https://github.com/flutter/flutter/tree/master/packages/flutter_localizations/lib/src/l10n language resource names can contain only lang code and country code, like zh_HK. In the settings of the iOS, you can select a few variants of Chinese language: Simplified, Traditional, Traditional (Hong Kong), Traditional (Macau), Traditional (Taiwan). So, I should use zh, zh_HK, zh_MO, zh_TW. And only if the user selected Traditional (without specifying country), it could be anything like zh_Hant_RU, the app will choose zh (simplified). It’s wrong, but we can't do anything in that case. What do you think about it?
The locale comes into GeneratedLocalizationsDelegate_resolve method is 'zh_Hant_TW' on an Android phone that was set to Chinese (Taiwan). The arb file is strings_zh_TW.arb which is Traditional Chinese. We also have strings_zh.arb which is Simplified Chinese.
It looks like we should have one more if statement to check for language and country locale.
For Chinese, there are also zh_Hant_HW and zh_Hant_MO in addition to zh_Hant_TW. So we need a way to support the scriptCode (Hans or Hant for Simplified Chinese and Traditional Chinese respectively) so that we don't need an arb for each of them. Two arbs for Hant and Hans would be good enough.