1.0.1 • Published 5 years ago

trans2json v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

TRANS2JSON

Use trans2json it if you want to transfer translations from CSV fo JSON files. From one CSV file you will receive as many translation files as you declare in CSV.

Preferred target NGX-translate.

Install

npm i trans2json
npm i -g trans2json

The header of your CSV file must contain at least one prefix (which will be a token) and a translation list. The default number of prefixes is 3.

For example:

  component,specificator,token,en,de,fr

All prefixes will be joined into the final translation token:

  component,specificator,token,en,de,fr
  app,headers,page_header,Main Page,Hauptseite,Page principale

=>

  en.json "app::headers::page_header": "Main Page"
  de.json "app::headers::page_header": "Hauptseite"
  fr.json "app::headers::page_header": "Page principale"

Options:

-h, --helpShow helpboolean
-v, --versionShow version numberboolean
-i, --inputDeclare input path for your CSV translation filerequired
-o, --outputDeclare output pathrequired
-s, --separatorSeparator in CSV filestringdefault: ","
-j, --joinerToken joinerstringdefault: "::"
-p, --prefixesHow many prefixes would you usenumberdefault: 3
-c, --clearClear terminal viewportbooleandefault: false
-d, --dataShow output databooleandefault: false

Examples:

trans2json --help Show this message

trans2json --version Print out the installed version of trans2json

trans2json -i /translation.csv -o /static/i18n To make translations