移除翻译
为指定的 bucket、文件、键或 locale 移除翻译。
用法
npx lingo.dev@latest purge [options]
说明
purge 命令可根据特定条件从项目中移除翻译。你可以针对特定的 bucket、文件、键或 locale 进行操作。此功能适用于清理过时或不需要的翻译内容。
提示: 为获得最佳重译效果,建议先运行 purge 命令,然后在不带 --force 的情况下使用 run 命令。此方法可利用内置缓存机制,更高效地进行重译(相比于使用 run --force)。
选项
| 选项 | 说明 | 示例 |
|---|---|---|
--bucket <bucket> | 要处理的 bucket,可多次使用。 | --bucket json --bucket markdown |
--file [files...] | 要处理的文件,仅处理匹配指定 glob 模式的文件。 | --file src/**/*.json |
--key <key> | 要移除的键,移除所有匹配指定 glob 模式的翻译键。 | --key app.title |
--locale <locale> | 要处理的 locale,可多次使用。 | --locale fr --locale de |
--yes-really | 跳过交互式确认,直接删除。 | --yes-really |
-h, --help | 显示帮助。 | --help |
示例
清除指定键
npx lingo.dev@latest purge --key app.title
清除 bucket 中的所有翻译
npx lingo.dev@latest purge --bucket json
针对特定 locale 清除
npx lingo.dev@latest purge --locale fr --locale de
按文件模式清除
npx lingo.dev@latest purge --file src/**/*.json
跳过确认直接清除
npx lingo.dev@latest purge --key obsolete.key --yes-really