I have been trying to configure crowdin cli to match with the flutter gen-l10n config.
My current crowdin translation export is
"translation" : "/lib/l10n/arbs/app_%locale_with_underscore%.arb", and flutter accepts in the
%two_letters_code% format only. If I change the crowdin export to %two_letters_code% as well, then special languages such as zh_TW won’t get downloaded. Using osx_locale downloads it in zh-Hant format and rest translations are downloaded fine.
Any help is appreciated.
Do you use flutter SDK?
There’s a trick with Chinese GitHub - crowdin/flutter-sdk: Crowdin Flutter SDK for instant translation delivery Over-The-Air directly to your application
If you want to avoid SDK, then you can do a custom codes or language mapping. Like not zh-TW but zh only (to be mapped in 2 letters)
I did it with osx_locale format by replacing _Hans or similar parts of other special languages with _CN etc…
Can be edited in project settings in Crowdin, to map zh-CN like zh or zs or any other 2 letters
I have tried language mapping but it had no effect on any placeholders for exporting translations.
If you put mapping like
Chinese Simplified → locale → zh
And then you will use a path …/some folders/%locale%/original_file_name%
For Chinese Simplified it’ll end as …/zh/myfile.json
Even though defaut code is different
Inside the file (if it’s hardcoded) it will still be zh-CN but in a paths or file name it’ll be zh
Maybe it’s a flutter limitation or so if it doesnt work.