arb_translator 1.0.1 copy "arb_translator: ^1.0.1" to clipboard
arb_translator: ^1.0.1 copied to clipboard

outdated

A command-line utility which helps to translate arb files.

arb_translator #

Platform Pub Package Donate Issue Forks Stars

arb_translator is a dart command-line tool for translating arb file into multiple languages.

Lets Get Started #

Add to the command line with #

$  pub activate global arb_translator

Find Out available options #

$  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
$  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/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
$  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/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 simple 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
18
likes
0
pub points
47%
popularity

Publisher

verified publisherjustkawal.dev

A command-line utility which helps to translate arb files.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

args, http, path

More

Packages that depend on arb_translator