The purge command removes translations from target files based on specific criteria - bucket type, file pattern, key, or locale. It updates the i18n.lock file to reflect the removal.
Usage#
bash
npx lingo.dev@latest purge [options]Options#
| Option | Description | Example |
|---|---|---|
--bucket <type> | Remove translations in a specific bucket. Repeatable. | --bucket json |
--file <pattern> | Remove translations in files matching a glob pattern. | --file src/**/*.json |
--key <key> | Remove a specific translation key. Supports glob patterns. | --key app.title |
--locale <code> | Remove translations for a specific locale. Repeatable. | --locale fr --locale de |
--yes-really | Skip the interactive confirmation prompt. | --yes-really |
Examples#
Remove a specific key#
bash
npx lingo.dev@latest purge --key app.titleRemoves app.title from all target files and the lockfile.
Remove all translations in a bucket#
bash
npx lingo.dev@latest purge --bucket jsonRemove translations for specific locales#
bash
npx lingo.dev@latest purge --locale fr --locale deRemove by file pattern#
bash
npx lingo.dev@latest purge --file src/**/*.jsonSkip confirmation#
bash
npx lingo.dev@latest purge --key obsolete.key --yes-reallyPurge + Run workflow#
For efficient retranslation, purge first, then run without --force. This leverages the CLI's caching mechanism:
bash
npx lingo.dev@latest purge --key welcome.title
npx lingo.dev@latest runThis approach is more efficient than run --force because it only retranslates the purged content.
