arb_translator is a dart command-line tool for translating arb file into multiple languages.
This library is MIT licensed So, it's free to use anytime, anywhere without any consent, because we believe in Open Source work.
flutter packages pub global activate arb_translator
flutter packages pub run arb_translator:translate --help
options | description |
---|---|
source_arb | (@required) path to the source arb file which has to be translated to other languages |
api_key | (@required) path to the file of api key which contains api key of google cloud console |
output_directory | (optional) directory where the translated files should be written , by-default it is set to directory of source_arb file |
language_codes | (optional) comma separated language codes in which translation has to be done , by-default it is set to en,zh Eg. is --language_codes ml,kn,pa,en |
output_file_name | (optional) output _file_name is the initial name to be concatenated with the language codes. Eg. --output_file_name wow then this will save the translated files as wow_{language_code}.arb , Suppose the langauge code is ml,hi then the files created will be wow_ml.arb and wow_zh.arb |
pub run arb_translator:translate --source_arb path/to/source_en.arb --api_key path/to/api_key_file --language_codes hi,en,zh
- use
--output_directory
with directory argument to change the saving location for the translated output file
flutter packages pub run arb_translator:translate --source_arb path/to/source_en.arb --api_key path/to/api_key_file --language_codes hi,en,zh --output_directory /path/to/my/custom/output_directory/
- use
--output_file_name
with the single file name so that the output file name will be changed. - from the below code the output file will be of the name justkawal_{language code}.arb
- Remember that we will automatically concate the language code of the respective files
flutter packages pub run arb_translator:translate --source_arb path/to/source_en.arb --api_key path/to/api_key_file --language_codes hi,en,zh --output_directory /path/to/my/custom/output_directory/ --output_file_name justkawal_
- Create a text file and then put the api key got from google cloud console in that file.
- Now just simply call the file's path as the argument for --api_key
- Enable Cloud Translation API inside APIS and Services section in google cloud console.
- Some quota of google Cloud translation APIS are free for translating upto a limit
- Check Pricing and quota here