Home/i18nexus-tools/i18n-upload
๐Ÿ“ค

i18n-upload

Uploads local translation files to Google Sheets

Overview

i18n-uploadis a CLI tool that uploads local translation JSON files to Google Sheets. It's the first step for collaborating on translations with team members.

โœ“Upload All Language Files at Once
โœ“Automatically Generate Sheets Format
โœ“Complete Replacement of Existing Sheets Data

Basic Usage

Use Config File

If Google Sheets information is set in i18nexus.config.json:

npx i18n-upload

Use Command Line Options

npx i18n-upload \
  --spreadsheet-id "YOUR_SPREADSHEET_ID" \
  --credentials "./credentials.json"

Command Options

--spreadsheet-idString

Google Sheets Spreadsheet ID (required)

Check in Sheets URL: https://docs.google.com/spreadsheets/d/[SPREADSHEET_ID]/edit

--credentialsString

Google Cloud service account credentials JSON file path (required)

--credentials "./credentials.json"
--sheet-nameString

Sheet name to upload (default: "Translations")

--sheet-name "MyTranslations"
--locales-dirString

Translation file directory (default: "./locales")

--locales-dir "./src/translations"

Upload Process

1

Read Local Files

Reads all JSON files in the locales directory.

2

Data Conversion

Converts JSON data to Google Sheets format. First row becomes language codes, first column becomes translation keys.

3

Update Sheets

Clears existing data in Google Sheets and completely replaces it with new data.

4

Complete

Displays statistics along with upload completion message.

Precautions

โš ๏ธData Overwrite

  • โ€ขi18n-upload completely deletes existing data in Google Sheets and replaces it with new data
  • โ€ขIf you have translations modified directly in Sheets, back them up first
  • โ€ขGenerally used only once during initial project setup
  • โ€ขAfterwards, use i18n-download to fetch translations from Sheets

Example Output

$ npx i18n-upload --spreadsheet-id "1abc...xyz"

๐Ÿ“ค Uploading translations to Google Sheets...

๐Ÿ“ Reading local files...
   โœ“ locales/ko.json (125 keys)
   โœ“ locales/en.json (125 keys)

๐Ÿ”„ Converting to Sheets format...
   Languages: ko, en
   Total keys: 125

๐Ÿ“Š Updating Google Sheets...
   Spreadsheet: "i18n Translations"
   Sheet: "Translations"
   โœ“ Cleared existing data
   โœ“ Uploaded 126 rows (including header)

โœ… Upload complete!
   ๐Ÿ”— View: https://docs.google.com/spreadsheets/d/1abc...xyz

Best Practices

โœ…Use Only for Initial Setup

Upload only once at project start, then proceed with translation work in Sheets.

โœ…Verify Before Upload

Make sure local translation files are up-to-date before uploading.

โœ…Share with Team

After uploading, share the Sheets URL with team members to start translation work together.

Next Steps