seungwoohong / translation-generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

translation-gen NPM MIT

Generate translation json file by Google Sheets


Installation

yarn add translation-gen -D

// or pnpm i translation-gen -D

Usage

  1. Create Service Account and key Link
  2. Add translationgen.yaml on root of your project
  3. Set up translationgen.yaml
  4. Add ENV variable TRANSLATIONGEN_PRIVATE_KEY_PATH into .env file
TRANSLATIONGEN_PRIVATE_KEY_PATH="/path/to/key.json"
  1. Add script in package.json
{
    ...
    "scripts": {
        "transgen": translationgen
    }
}
  1. Run script
$ yarn transgen
  1. Take a look at the output directory in your project. (default: /translation)

translationgen.yaml

KEY Description default
target Google sheet file URL -
serviceAccount Google Service Account email Link -
sheet Title of sheet -
sheetId ID of sheet -
output output directory path -
locales Array<locale>, example: ['ko', 'en'] -
locales separator of key to represent depth "."

Example

target: https://docs.google.com/spreadsheets/d/adfkljjdfslkjlk/edit#gid=0
serviceAccount: google-workspace-manager@your_project.iam.gserviceaccount.com
output: "./translation"
locales: ["ko", "en", "jp"]
sheet: "translation"
sheetId: your_sheet_id
depthSeparator: $

About


Languages

Language:JavaScript 100.0%