tsv-i18njs
Convert i18n translation texts mageged on Google Sheets into i18n-js style translation files.
Installation
npm install tsv-i18njs --save-dev
Usage
node_modules/.bin/tsv-i18njs.js \ 'https://docs.google.com/spreadsheets/d/e/2PACX-1vSUUk1_F-VxePs-exsB6R2F3fVIcAdxRRVLxgxz0uV4_Y0xPFDfMrLjvMAHQeYO4EXelqaJ2fgiNmF2/pub?gid=0&single=true&output=tsv' \ ./
You can obtain the TSV URL by following menu [File] → [Publish to the web]
on Google Sheets.
The command generates i18n-js style translation files ready to use with i18n-js in current directory.
const I18n = I18ntranslations = en: ja: zh: I18nlocale = "en-US"I18n // returns Hello
Each generated file looks like this.
// THIS FILE IS GENERATED BY tsv-i18njs// DO NOT MODIFY DIRECTLY.moduleexports = "screen": "welcome": "hello": "Hello" "currency_sign": "$" "ok": "OK" "cancel": "Cancel"
If you are an ES paranoia, add --format=es
to the command line to generate the file with export default
instead of module.exports
.
with gulp
with React Native Expo
async { I18ntranslations = en ja zh await I18nlocale = ExpoUtil}