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.
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-forceUse Command Line Options
npx i18n-download-force \
--spreadsheet-id "YOUR_SPREADSHEET_ID" \
--credentials "./credentials.json"How it works
Fetch Sheets Data
Reads all translations from Google Sheets.
Delete Local Files
Completely clears the contents of existing local translation files.
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 dataComparison with i18n-download
| Characteristics | i18n-download | i18n-download-force |
|---|---|---|
| Preserve Local Translations | โ | โ |
| Smart Merge | โ | โ |
| Safety | Safe | Caution Needed |
| Usage Frequency | Frequently Used | Rarely Used |
| Recommended Usage | General Cases | Special 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.