Skip to content
Zingoer edited this page Apr 3, 2016 · 5 revisions

General usage

› babelish help
Commands:
  babelish android2csv     # Convert .xml files to CSV file
  babelish csv2android     # Convert CSV file to .xml
  babelish csv2json        # Convert CSV file to .json
  babelish csv2php         # Convert CSV file to .php
  babelish csv2strings     # Convert CSV file to .strings
  babelish csv_download    # Download Google Spreadsheet containing translations
  babelish help [COMMAND]  # Describe available commands or one specific command
  babelish json2csv        # Convert .json files to CSV file
  babelish open FILE       # Open local csv file in default editor or Google Spreadsheet containing translations in default browser
  babelish php2csv         # Convert .php files to CSV file
  babelish strings2csv     # Convert .strings files to CSV file
  babelish version         # Display current version
Options:
  [--verbose], [--no-verbose]

You can use a configuration file to hold all your commandline arguments into a file. Place a .babelish file (YAML) in your repo where you will run the command. In case you need to reset the Google Drive token you have to delete the .babelish.token file. See .babelish.sample file in the doc folder. as the possible values.

For previous CSV-to-iOS-Localizable.strings-converter, rename your .csvconverter into .babelish.

A very simple use case:

On the test data folder there are some examples like: https://github.com/netbe/Babelish/blob/master/test/data/test_data_multiple_langs.csv

And to generate a .strings file, the command would be: babelish csv2strings --filename=test_data_multiple_langs.csv --langs English:en,German:de, French:fr,Spanish:es

command line to convert strings to a csv file: babelish strings2csv --filenames=en.strings es.strings fr.strings id.strings


Tip: use configuration files!

@netbe: "I usually don't use the command arguments but use a config file on project". Take a look in this section (example file: https://github.com/netbe/Babelish/blob/master/.babelish.sample)


Escape a row in the .csv file:

You can escape rows using the configuration:

  1. In the row you want to escape you may write ESCAPE (for example) in the first column: 0

  2. In your .babelish file you have to add: state_column: 0

  3. In your .babelish file you have to add: excluded_states: ["ESCAPE"]

Then, when you run: babelish csv2strings --filename test_data_multiple_langs.csv --langs English:en, German:de, French:fr, Spanish:es

The parser ignores every line that has ESCAPE in the first column (column=0).


Contributions to this file are VERY welcome.