translation-gen
v0.1.5
Published
Generate translate json by google sheet automatically
Downloads
209
Maintainers
Readme
translation-gen
Generate translation json file by Google Sheets
Installation
yarn add translation-gen -D
// or pnpm i translation-gen -D
Usage
- Create Service Account and key Link
- Add translationgen.yaml on root of your project
- Set up translationgen.yaml
- Add ENV variable TRANSLATIONGEN_PRIVATE_KEY_PATH into .env file
TRANSLATIONGEN_PRIVATE_KEY_PATH="/path/to/key.json"
- Add script in package.json
{
...
"scripts": {
"transgen": translationgen
}
}
- Run script
$ yarn transgen
- 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: $