channdara / flutter_localization

BSD 3-Clause "New" or "Revised" License
10 stars 17 forks source link

need script code support in MapLocale. #10

Closed dujiepeng closed 6 months ago

dujiepeng commented 6 months ago

Chinese is divided into simplified and traditional. In translation language support, the Chinese characters are recognized as zhh-hans and zhh-hant, respectively. Based on UNICODE LOCALE Data Markup Language (LDML), hopefully you can provide unicode_script_subtag in MapLocale, thanks.

channdara commented 6 months ago

Hello. Thank you for reporting. There's a bunch of things that I'm not really clear about the unicode_script_subtag you have mentioned. I have try to add the scriptCode in the MapLocale already but not yet publish to pub.dev because I will need some confirmation from you that it's work.

Please use the remote repo package from GitHub by add it directly to your pubspec.yaml like below:

  flutter_localization:
    git:
      url: https://github.com/channdara/flutter_localization.git
      ref: feature/script-code
dujiepeng commented 6 months ago

It's worked! thanks. Locale local = Localizations.localeOf(context);, when i call the method.in 0.1.13 version, local without property scriptCode, now is backed.

dujiepeng commented 6 months ago

here is why i need scriptCode: https://learn.microsoft.com/en-us/azure/ai-services/translator/language-support in my apps, i using the mirrosoft translator services. in Language code, it define zh-Hans and zh-Hant. In flutter, language code don't include Hans, it define in scriptCode. so, thx again!

channdara commented 6 months ago

I'm glad that it worked. It was a blind fix for me. I will deploy this fix to pub.dev so you can use the normal package from it.