Home/i18nexus-tools/i18n-download-force
๐Ÿ”„

i18n-download-force

Completely overwrites local translations with data from Google Sheets

โš ๏ธ

Risk: Data Loss Possible

This command completely overwrites local translation files with data from Google Sheets. All local-only translations will be deleted. Generally, using i18n-download is safer.

Overview

i18n-download-forceis a command for when using Google Sheets as a Single Source of Truth. It completely replaces local translation files with data from Sheets.

โš Complete Overwrite of Local Translations
โš Delete Local-Only Translations
โš Cannot revert (if Git is not used)

When to Use

โœ…Use Google Sheets as Master

When all translation work is done only in Google Sheets and local files are simply copies of Sheets

โœ…Confident that there are no local changes

When you don't modify translations directly in local files and only manage translations in Sheets

โœ…Local File Reset Required

When local files are corrupted or have issues and you want to start fresh with a clean version from Sheets

Usage

Use Config File

npx i18n-download-force

Use Command Line Options

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

How it works

1

Fetch Sheets Data

Reads all translations from Google Sheets.

2

Delete Local Files

Completely clears the contents of existing local translation files.

3

Write Sheets Data

Writes Sheets translations to local files. No merging.

Example Output

$ npx i18n-download-force --spreadsheet-id "1abc...xyz"

โš ๏ธ  WARNING: This will overwrite all local translations!
๐Ÿ“Š Reading from Google Sheets...
   Spreadsheet: "i18n Translations"
   Sheet: "Translations"
   โœ“ Found 128 translation keys
   Languages: ko, en

๐Ÿ”„ Force overwriting local files...
   โœ— Removed all existing local data
   โœ“ locales/ko.json (128 keys)
   โœ“ locales/en.json (128 keys)

โœ… Force download complete!
   Total keys: 128
   All local files replaced with Sheets data

Comparison with i18n-download

Characteristicsi18n-downloadi18n-download-force
Preserve Local Translationsโœ“โœ—
Smart Mergeโœ“โœ—
SafetySafeCaution Needed
Usage FrequencyFrequently UsedRarely Used
Recommended UsageGeneral CasesSpecial Cases

Safety Measures

๐Ÿ’กGit Commit Before Execution

Commit the current state to Git before running the command. You can revert if problems occur.

git add locales/
git commit -m "backup before force download"
npx i18n-download-force

๐Ÿ’กCreate Backup

Back up local translation files to another location before running the command.

๐Ÿ’กVerify Sheets Content

Verify that Google Sheets content is correct before downloading.

Best Practices

โŒDon't use in general

In most cases, using i18n-download is safer.

โœ…Clear Workflow Definition

Use only when the team has clearly agreed to use Google Sheets as a Single Source of Truth.

โœ…Use in CI/CD

Can be used in automated deployment pipelines to always fetch the latest translations from Sheets.

Next Steps