april_json_translator 0.1.6
april_json_translator: ^0.1.6 copied to clipboard
A tool that can translate json files from one language to another.
Getting started #
Run flutter pub global activate april_json_translator in project Terminal for activate this tool.
Usage #
- Add this in your project pubspec.yaml with top level.
april_json_translator:
source_code: 'en'
target_codes: 'zh'
source_file_path: 'lib/l10n/intl_en.arb'
file_prefix: 'intl_'
file_suffix: '.arb'
- Run
flutter pub global run april_json_translator:generatein project Terminal for translate your json file with this tool.
- In the above example,
enandzhare both the code of the language to be translated and the mid-segment name of the file.After you have finished translating, the file name will be "intl_zh.arb". - You can set like
target_codes: 'he:iw'when language code is not the same as your mid-segment name of file.Then the file name will be "intl_he.arb", andiwwill be used for translate. - If you need to translate into multiple languages, you can set like
this
target_codes: 'zh:zh-CN,ja,ko'just separate the language codes with, - It will be never translate when the json key is start with
_or@and never translate when the source key\value is not string. - The source json key will be remove from result json when translate failed.