Skip to content

arb Translator helps to translate the arb files into your desired languages

License

Notifications You must be signed in to change notification settings

justkawal/arb_translator

Repository files navigation

arb_translator

Platform Pub Package Donate Issue Forks Stars

Uses Google Cloud Translations for translating files.

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.

Lets Get Started

Add to the command line with

  flutter packages pub global activate arb_translator

Find Out available options

  flutter packages pub run arb_translator:translate --help

Options

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

Translating

  pub run arb_translator:translate --source_arb path/to/source_en.arb --api_key path/to/api_key_file --language_codes hi,en,zh

Changing location of translated file

  • 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/

Don't like the name arb_translator_..blah..blah..blah.arb ??

  • 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_

How to save api_key

  • 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

Having trouble using api key for translation ?

  • 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

About

arb Translator helps to translate the arb files into your desired languages

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages