{"owner":"end-4","repo":"dots-hyprland","hasSkills":true,"totalSkillsCount":3,"totalTokensCount":5542,"categories":["anthropic-skill","plugin-manifest"],"hasMcp":false,"mcpConfig":null,"found":["dots/.config/quickshell/ii/translations/tools/guide/translation-tools-guide-zh_CN.md","dots/.config/quickshell/ii/translations/tools/README.md","dots/.config/quickshell/ii/translations/tools/guide/translation-tools-guide.md"],"skills":{"dots/.config/quickshell/ii/translations/tools/guide/translation-tools-guide-zh_CN.md":"# 翻译管理工具套件\n\n这套工具用于管理项目的翻译文件，自动提取可翻译文本，比较不同语言文件之间的差异，并提供维护功能。\n\n## 工具组成\n\n### 1. `translation-manager.py` - 主要翻译管理器\n- 提取可翻译文本\n- 比较和更新翻译文件\n- 交互式添加/删除翻译键\n\n### 2. `translation-cleaner.py` - 翻译文件维护工具\n- 清理不再使用的翻译键\n- 同步不同语言文件的键结构\n\n### 3. `manage-translations.sh` - 便捷包装脚本\n- 提供统一的命令行界面\n- 显示翻译状态\n- 简化常用操作\n\n## 快速开始\n\n### 使用便捷脚本（推荐）\n\n```bash\n# 进入工具目录\ncd .config/quickshell/translations/tools\n\n# 查看帮助\n./manage-translations.sh --help\n\n# 显示当前翻译状态\n./manage-translations.sh status\n\n# 提取可翻译文本\n./manage-translations.sh extract\n\n# 更新所有翻译文件\n./manage-translations.sh update\n\n# 更新特定语言\n./manage-translations.sh update -l zh_CN\n\n# 清理不再使用的键\n./manage-translations.sh clean\n\n# 同步所有语言文件的键\n./manage-translations.sh sync\n```\n\n或者从项目根目录运行：\n```bash\n# 从项目根目录运行\n.config/quickshell/translations/tools/manage-translations.sh status\n.config/quickshell/translations/tools/manage-translations.sh update\n```\n\n## 详细使用说明\n\n### 翻译管理器 (`translation-manager.py`)\n\n基本用法：\n```bash\n# 处理所有语言\n./translation-manager.py\n\n# 指定特定语言\n./translation-manager.py --language zh_CN\n\n# 仅提取可翻译文本\n./translation-manager.py --extract-only\n\n# 显示提取的文本\n./translation-manager.py --extract-only --show-temp\n```\n\n参数说明：\n- `--translations-dir`, `-t`: 翻译文件目录（默认：`.config/quickshell/translations`）\n- `--source-dir`, `-s`: 源代码目录（默认：`.config/quickshell`）\n- `--language`, `-l`: 指定要处理的语言代码\n- `--extract-only`, `-e`: 仅提取可翻译文本\n- `--show-temp`: 显示临时提取文件的内容\n\n### 翻译清理器 (`translation-cleaner.py`)\n\n```bash\n# 清理不再使用的翻译键\n./translation-cleaner.py --clean\n\n# 同步翻译键（以 en_US 为基准）\n./translation-cleaner.py --sync\n\n# 指定不同的源语言进行同步\n./translation-cleaner.py --sync --source-lang zh_CN\n\n# 清理时不创建备份\n./translation-cleaner.py --clean --no-backup\n```\n\n## 工作流程\n\n### 日常翻译更新流程\n\n1. **检查状态**：\n   ```bash\n   ./manage-translations.sh status\n   ```\n\n2. **更新翻译**：\n   ```bash\n   ./manage-translations.sh update\n   ```\n\n3. **清理无用键**（可选）：\n   ```bash\n   ./manage-translations.sh clean\n   ```\n\n### 新增语言流程\n\n1. **创建新语言文件**：\n   ```bash\n   ./manage-translations.sh update -l new_lang\n   ```\n\n2. **同步键结构**：\n   ```bash\n   ./manage-translations.sh sync\n   ```\n\n### 大规模重构后的清理流程\n\n1. **备份翻译文件**：\n   ```bash\n   cp -r .config/quickshell/translations .config/quickshell/translations.backup\n   ```\n\n2. **清理无用键**：\n   ```bash\n   ./manage-translations.sh clean\n   ```\n\n3. **同步所有语言**：\n   ```bash\n   ./manage-translations.sh sync\n   ```\n\n## 支持的翻译文本格式\n\n工具可以识别以下格式的可翻译文本：\n\n```qml\n// 基本格式\nTranslation.tr(\"Hello, world!\")\nTranslation.tr('Hello, world!')\nTranslation.tr(`Hello, world!`)\n\n// 带换行符\nTranslation.tr(\"Line 1\\nLine 2\")\n\n// 带转义字符\nTranslation.tr(\"Say \\\"Hello\\\"\")\n\n// 带参数占位符\nTranslation.tr(\"Hello, %1!\").arg(name)\n```\n\n## 示例输出\n\n### 状态显示\n```\n$ ./manage-translations.sh status\n正在分析翻译状态...\n=== 当前项目状态 ===\n提取到 166 个可翻译文本\n\n=== 翻译文件状态 ===\n  en_US: 470 个键\n  zh_CN: 470 个键\n```\n\n### 更新翻译\n```\n$ ./manage-translations.sh update -l zh_CN\n更新翻译文件...\n==================================================\n处理语言: zh_CN\n==================================================\n分析结果:\n  缺少的键: 5\n  多余的键: 20\n\n发现 5 个缺少的翻译键：\n1. \"New feature text\"\n2. \"Another new text\"\n...\n\n是否添加这 5 个缺少的键？ (y/n): y\n已添加 5 个键\n\n发现 20 个多余的翻译键：\n1. \"Removed old text\" -> \"已删除的旧文本\"\n...\n\n是否删除这 20 个多余的键？ (y/n): y\n已删除 20 个键\n\n已保存翻译文件\n```\n\n### 清理无用键\n```\n$ ./manage-translations.sh clean\n清理不再使用的翻译键...\n处理语言: zh_CN\n发现 50 个不再使用的键:\n  1. \"old_unused_text\"\n  2. \"deprecated_message\"\n  ...\n\n是否删除这 50 个不再使用的键？ (y/n): y\n已删除 50 个键\n原始键数: 470, 清理后: 420\n```\n\n## 高级功能\n\n### 自定义目录结构\n\n```bash\n# 使用自定义目录\n./translation-manager.py \\\n  --translations-dir /path/to/translations \\\n  --source-dir /path/to/source\n```\n\n\n## 注意事项\n\n1. **备份重要**：在执行清理操作前，工具会自动创建备份，但建议手动备份重要文件\n\n2. **文本提取限制**：\n   - ~~只支持静态字符串，不支持动态构建的字符串~~\n   - 动态资源（如变量拼接、运行时生成的文本）无法自动提取，需要在翻译文件中手动添加，并使用 `/*keep*/` 标记进行忽略管理。\n   - 必须使用 `Translation.tr()` 格式\n### 忽略标记功能\n\n对于动态资源或特殊文本，如果不希望被自动清理，可在翻译值末尾添加 `/*keep*/`，工具会自动忽略这些键，不会在清理和同步时删除。\n\n示例：\n```json\n{\n  \"dynamic_key\": \"Some dynamic value /*keep*/\"\n}\n```\n\n3. **文件编码**：所有文件必须使用 UTF-8 编码\n\n4. **键名规范**：建议使用英文作为键名，避免使用特殊字符\n\n## 故障排除\n\n### 常见问题\n\n\n**Q: 添加了 Translation.tr 后文字不显示？**\nA: 需要在 QML 文件中使用 `import \"root:/\"` 导入翻译功能，否则无法正常显示翻译文本。\n\n**Q: 提取的文本数量与预期不符？**\nA: 检查是否所有可翻译文本都使用了 `Translation.tr()` 格式，确保没有动态构建的字符串。\n\n**Q: 同步后某些翻译丢失？**\nA: 检查源语言文件是否包含所有必要的键，考虑使用不同的源语言进行同步。\n\n**Q: 清理操作删除了需要的键？**\nA: 从自动创建的备份文件中恢复，检查源代码中是否正确使用了 `Translation.tr()`。\n\n### 恢复备份\n\n```bash\n# 恢复单个文件\ncp .config/quickshell/translations/zh_CN.json.backup .config/quickshell/translations/zh_CN.json\n\n# 恢复所有文件\ncp .config/quickshell/translations.backup/* .config/quickshell/translations/\n```\n","dots/.config/quickshell/ii/translations/tools/README.md":"# Translation Management Tool Suite\n\nThis suite is used to manage project translation files, automatically extract translatable texts, compare differences between language files, and provide maintenance functions.\n\n## Tool Components\n\n### 1. `translation-manager.py` - Main Translation Manager\n- Extract translatable texts\n- Compare and update translation files\n- Interactive addition/removal of translation keys\n\n### 2. `translation-cleaner.py` - Translation File Maintenance Tool\n- Clean unused translation keys\n- Synchronize key structure across different language files\n\n### 3. `manage-translations.sh` - Convenient Wrapper Script\n- Provides a unified command-line interface\n- Displays translation status\n- Simplifies common operations\n\n## Quick Start\n\n### Using the Wrapper Script (Recommended)\n\n```bash\n# Enter the tools directory\ncd .config/quickshell/translations/tools\n\n# Show help\n./manage-translations.sh --help\n\n# Show current translation status\n./manage-translations.sh status\n\n# Extract translatable texts\n./manage-translations.sh extract\n\n# Update all translation files\n./manage-translations.sh update\n\n# Update a specific language\n./manage-translations.sh update -l zh_CN\n\n# Clean unused keys\n./manage-translations.sh clean\n\n# Synchronize keys across all language files\n./manage-translations.sh sync\n```\n\nOr run from the project root:\n```bash\n# Run from the project root\n.config/quickshell/translations/tools/manage-translations.sh status\n.config/quickshell/translations/tools/manage-translations.sh update\n```\n\n## Detailed Usage\n\n### Translation Manager (`translation-manager.py`)\n\nBasic usage:\n```bash\n# Process all languages\n./translation-manager.py\n\n# Specify a particular language\n./translation-manager.py --language zh_CN\n\n# Extract translatable texts only\n./translation-manager.py --extract-only\n\n# Show extracted texts\n./translation-manager.py --extract-only --show-temp\n```\n\nParameter description:\n- `--translations-dir`, `-t`: Translation files directory (default: `.config/quickshell/translations`)\n- `--source-dir`, `-s`: Source code directory (default: `.config/quickshell`)\n- `--language`, `-l`: Specify the language code to process\n- `--extract-only`, `-e`: Only extract translatable texts\n- `--show-temp`: Show the content of the temporary extraction file\n\n### Translation Cleaner (`translation-cleaner.py`)\n\n```bash\n# Clean unused translation keys\n./translation-cleaner.py --clean\n\n# Synchronize translation keys (using en_US as the base)\n./translation-cleaner.py --sync\n\n# Specify a different source language for syncing\n./translation-cleaner.py --sync --source-lang zh_CN\n\n# Clean without creating backups\n./translation-cleaner.py --clean --no-backup\n```\n\n## Workflow\n\n### Regular Translation Update Workflow\n\n1. **Check status**:\n   ```bash\n   ./manage-translations.sh status\n   ```\n\n2. **Update translations**:\n   ```bash\n   ./manage-translations.sh update\n   ```\n\n3. **Clean unused keys** (optional):\n   ```bash\n   ./manage-translations.sh clean\n   ```\n\n### Adding a New Language\n\n1. **Create a new language file**:\n   ```bash\n   ./manage-translations.sh update -l new_lang\n   ```\n\n2. **Synchronize key structure**:\n   ```bash\n   ./manage-translations.sh sync\n   ```\n\n### Cleanup After Large Refactoring\n\n1. **Backup translation files**:\n   ```bash\n   cp -r .config/quickshell/translations .config/quickshell/translations.backup\n   ```\n\n2. **Clean unused keys**:\n   ```bash\n   ./manage-translations.sh clean\n   ```\n\n3. **Synchronize all languages**:\n   ```bash\n   ./manage-translations.sh sync\n   ```\n\n## Supported Translatable Text Formats\n\nThe tool recognizes the following formats for translatable texts:\n\n```qml\n// Basic format\nTranslation.tr(\"Hello, world!\")\nTranslation.tr('Hello, world!')\nTranslation.tr(`Hello, world!`)\n\n// With line breaks\nTranslation.tr(\"Line 1\\nLine 2\")\n\n// With escape characters\nTranslation.tr(\"Say \\\"Hello\\\"\")\n\n// With parameter placeholders\nTranslation.tr(\"Hello, %1!\").arg(name)\n```\n\n## Example Output\n\n### Status Display\n```\n$ ./manage-translations.sh status\nAnalyzing translation status...\n=== Current Project Status ===\n166 translatable texts extracted\n\n=== Translation File Status ===\n  en_US: 470 keys\n  zh_CN: 470 keys\n```\n\n### Update Translations\n```\n$ ./manage-translations.sh update -l zh_CN\nUpdating translation files...\n==================================================\nProcessing language: zh_CN\n==================================================\nAnalysis result:\n  Missing keys: 5\n  Extra keys: 20\n\nFound 5 missing translation keys:\n1. \"New feature text\"\n2. \"Another new text\"\n...\n\nAdd these 5 missing keys? (y/n): y\n5 keys added\n\nFound 20 extra translation keys:\n1. \"Removed old text\" -> \"已删除的旧文本\"\n...\n\nDelete these 20 extra keys? (y/n): y\n20 keys deleted\n\nTranslation file saved\n```\n\n### Clean Unused Keys\n```\n$ ./manage-translations.sh clean\nCleaning unused translation keys...\nProcessing language: zh_CN\nFound 50 unused keys:\n  1. \"old_unused_text\"\n  2. \"deprecated_message\"\n  ...\n\nDelete these 50 unused keys? (y/n): y\n50 keys deleted\nOriginal key count: 470, after cleaning: 420\n```\n\n## Advanced Features\n\n### Custom Directory Structure\n\n```bash\n# Use custom directories\n./translation-manager.py \\\n  --translations-dir /path/to/translations \\\n  --source-dir /path/to/source\n```\n\n### Ignore Mark Feature\n\nFor dynamic resources or special texts that should not be automatically cleaned, you can add `/*keep*/` at the end of the translation value. The tool will automatically ignore these keys and will not delete them during cleaning or syncing.\n\nExample:\n```json\n{\n  \"dynamic_key\": \"Some dynamic value /*keep*/\"\n}\n```\n\n## Notes\n\n1. **Backup is important**: The tool automatically creates backups before cleaning, but it is recommended to manually back up important files\n\n2. **Text extraction limitations**:\n   - ~~Only supports static strings, not dynamically constructed strings~~\n   - Dynamic resources (such as variable concatenation or runtime-generated text) cannot be automatically extracted. You need to manually add them to the translation file and use the `/*keep*/` mark for ignore management.\n   - Must use the `Translation.tr()` format\n\n3. **File encoding**: All files must use UTF-8 encoding\n\n4. **Key naming conventions**: It is recommended to use English for key names and avoid special characters\n\n## Troubleshooting\n\n### Common Issues\n\n**Q: Text does not appear after adding Translation.tr?**\nA: You need to import the translation feature in your QML file using `import \"root:/\"`, otherwise the translation text will not be displayed correctly.\n\n**Q: The number of extracted texts does not match expectations?**\nA: Check whether all translatable texts use the `Translation.tr()` format and ensure there are no dynamically constructed strings.\n\n**Q: Some translations are missing after syncing?**\nA: Check whether the source language file contains all necessary keys, and consider using a different source language for syncing.\n\n**Q: The cleaning operation deleted needed keys?**\nA: Restore from the automatically created backup file and check whether `Translation.tr()` is used correctly in the source code.\n\n### Restore Backup\n\n```bash\n# Restore a single file\ncp .config/quickshell/translations/zh_CN.json.backup .config/quickshell/translations/zh_CN.json\n\n# Restore all files\ncp .config/quickshell/translations.backup/* .config/quickshell/translations/\n```\n","dots/.config/quickshell/ii/translations/tools/guide/translation-tools-guide.md":"# Translation Management Tool Suite\n\nThis suite is used to manage project translation files, automatically extract translatable texts, compare differences between language files, and provide maintenance functions.\n\n## Tool Components\n\n### 1. `translation-manager.py` - Main Translation Manager\n- Extract translatable texts\n- Compare and update translation files\n- Interactive addition/removal of translation keys\n\n### 2. `translation-cleaner.py` - Translation File Maintenance Tool\n- Clean unused translation keys\n- Synchronize key structure across different language files\n\n### 3. `manage-translations.sh` - Convenient Wrapper Script\n- Provides a unified command-line interface\n- Displays translation status\n- Simplifies common operations\n\n## Quick Start\n\n### Using the Wrapper Script (Recommended)\n\n```bash\n# Enter the tools directory\ncd .config/quickshell/translations/tools\n\n# Show help\n./manage-translations.sh --help\n\n# Show current translation status\n./manage-translations.sh status\n\n# Extract translatable texts\n./manage-translations.sh extract\n\n# Update all translation files\n./manage-translations.sh update\n\n# Update a specific language\n./manage-translations.sh update -l zh_CN\n\n# Clean unused keys\n./manage-translations.sh clean\n\n# Synchronize keys across all language files\n./manage-translations.sh sync\n```\n\nOr run from the project root:\n```bash\n# Run from the project root\n.config/quickshell/translations/tools/manage-translations.sh status\n.config/quickshell/translations/tools/manage-translations.sh update\n```\n\n## Detailed Usage\n\n### Translation Manager (`translation-manager.py`)\n\nBasic usage:\n```bash\n# Process all languages\n./translation-manager.py\n\n# Specify a particular language\n./translation-manager.py --language zh_CN\n\n# Extract translatable texts only\n./translation-manager.py --extract-only\n\n# Show extracted texts\n./translation-manager.py --extract-only --show-temp\n```\n\nParameter description:\n- `--translations-dir`, `-t`: Translation files directory (default: `.config/quickshell/translations`)\n- `--source-dir`, `-s`: Source code directory (default: `.config/quickshell`)\n- `--language`, `-l`: Specify the language code to process\n- `--extract-only`, `-e`: Only extract translatable texts\n- `--show-temp`: Show the content of the temporary extraction file\n\n### Translation Cleaner (`translation-cleaner.py`)\n\n```bash\n# Clean unused translation keys\n./translation-cleaner.py --clean\n\n# Synchronize translation keys (using en_US as the base)\n./translation-cleaner.py --sync\n\n# Specify a different source language for syncing\n./translation-cleaner.py --sync --source-lang zh_CN\n\n# Clean without creating backups\n./translation-cleaner.py --clean --no-backup\n```\n\n## Workflow\n\n### Regular Translation Update Workflow\n\n1. **Check status**:\n   ```bash\n   ./manage-translations.sh status\n   ```\n\n2. **Update translations**:\n   ```bash\n   ./manage-translations.sh update\n   ```\n\n3. **Clean unused keys** (optional):\n   ```bash\n   ./manage-translations.sh clean\n   ```\n\n### Adding a New Language\n\n1. **Create a new language file**:\n   ```bash\n   ./manage-translations.sh update -l new_lang\n   ```\n\n2. **Synchronize key structure**:\n   ```bash\n   ./manage-translations.sh sync\n   ```\n\n### Cleanup After Large Refactoring\n\n1. **Backup translation files**:\n   ```bash\n   cp -r .config/quickshell/translations .config/quickshell/translations.backup\n   ```\n\n2. **Clean unused keys**:\n   ```bash\n   ./manage-translations.sh clean\n   ```\n\n3. **Synchronize all languages**:\n   ```bash\n   ./manage-translations.sh sync\n   ```\n\n## Supported Translatable Text Formats\n\nThe tool recognizes the following formats for translatable texts:\n\n```qml\n// Basic format\nTranslation.tr(\"Hello, world!\")\nTranslation.tr('Hello, world!')\nTranslation.tr(`Hello, world!`)\n\n// With line breaks\nTranslation.tr(\"Line 1\\nLine 2\")\n\n// With escape characters\nTranslation.tr(\"Say \\\"Hello\\\"\")\n\n// With parameter placeholders\nTranslation.tr(\"Hello, %1!\").arg(name)\n```\n\n## Example Output\n\n### Status Display\n```\n$ ./manage-translations.sh status\nAnalyzing translation status...\n=== Current Project Status ===\n166 translatable texts extracted\n\n=== Translation File Status ===\n  en_US: 470 keys\n  zh_CN: 470 keys\n```\n\n### Update Translations\n```\n$ ./manage-translations.sh update -l zh_CN\nUpdating translation files...\n==================================================\nProcessing language: zh_CN\n==================================================\nAnalysis result:\n  Missing keys: 5\n  Extra keys: 20\n\nFound 5 missing translation keys:\n1. \"New feature text\"\n2. \"Another new text\"\n...\n\nAdd these 5 missing keys? (y/n): y\n5 keys added\n\nFound 20 extra translation keys:\n1. \"Removed old text\" -> \"已删除的旧文本\"\n...\n\nDelete these 20 extra keys? (y/n): y\n20 keys deleted\n\nTranslation file saved\n```\n\n### Clean Unused Keys\n```\n$ ./manage-translations.sh clean\nCleaning unused translation keys...\nProcessing language: zh_CN\nFound 50 unused keys:\n  1. \"old_unused_text\"\n  2. \"deprecated_message\"\n  ...\n\nDelete these 50 unused keys? (y/n): y\n50 keys deleted\nOriginal key count: 470, after cleaning: 420\n```\n\n## Advanced Features\n\n### Custom Directory Structure\n\n```bash\n# Use custom directories\n./translation-manager.py \\\n  --translations-dir /path/to/translations \\\n  --source-dir /path/to/source\n```\n\n### Ignore Mark Feature\n\nFor dynamic resources or special texts that should not be automatically cleaned, you can add `/*keep*/` at the end of the translation value. The tool will automatically ignore these keys and will not delete them during cleaning or syncing.\n\nExample:\n```json\n{\n  \"dynamic_key\": \"Some dynamic value /*keep*/\"\n}\n```\n\n## Notes\n\n1. **Backup is important**: The tool automatically creates backups before cleaning, but it is recommended to manually back up important files\n\n2. **Text extraction limitations**:\n   - ~~Only supports static strings, not dynamically constructed strings~~\n   - Dynamic resources (such as variable concatenation or runtime-generated text) cannot be automatically extracted. You need to manually add them to the translation file and use the `/*keep*/` mark for ignore management.\n   - Must use the `Translation.tr()` format\n\n3. **File encoding**: All files must use UTF-8 encoding\n\n4. **Key naming conventions**: It is recommended to use English for key names and avoid special characters\n\n## Troubleshooting\n\n### Common Issues\n\n**Q: Text does not appear after adding Translation.tr?**\nA: You need to import the translation feature in your QML file using `import \"root:/\"`, otherwise the translation text will not be displayed correctly.\n\n**Q: The number of extracted texts does not match expectations?**\nA: Check whether all translatable texts use the `Translation.tr()` format and ensure there are no dynamically constructed strings.\n\n**Q: Some translations are missing after syncing?**\nA: Check whether the source language file contains all necessary keys, and consider using a different source language for syncing.\n\n**Q: The cleaning operation deleted needed keys?**\nA: Restore from the automatically created backup file and check whether `Translation.tr()` is used correctly in the source code.\n\n### Restore Backup\n\n```bash\n# Restore a single file\ncp .config/quickshell/translations/zh_CN.json.backup .config/quickshell/translations/zh_CN.json\n\n# Restore all files\ncp .config/quickshell/translations.backup/* .config/quickshell/translations/\n```\n"},"files":{"dots/.config/quickshell/ii/translations/tools/guide/translation-tools-guide-zh_CN.md":"# 翻译管理工具套件\n\n这套工具用于管理项目的翻译文件，自动提取可翻译文本，比较不同语言文件之间的差异，并提供维护功能。\n\n## 工具组成\n\n### 1. `translation-manager.py` - 主要翻译管理器\n- 提取可翻译文本\n- 比较和更新翻译文件\n- 交互式添加/删除翻译键\n\n### 2. `translation-cleaner.py` - 翻译文件维护工具\n- 清理不再使用的翻译键\n- 同步不同语言文件的键结构\n\n### 3. `manage-translations.sh` - 便捷包装脚本\n- 提供统一的命令行界面\n- 显示翻译状态\n- 简化常用操作\n\n## 快速开始\n\n### 使用便捷脚本（推荐）\n\n```bash\n# 进入工具目录\ncd .config/quickshell/translations/tools\n\n# 查看帮助\n./manage-translations.sh --help\n\n# 显示当前翻译状态\n./manage-translations.sh status\n\n# 提取可翻译文本\n./manage-translations.sh extract\n\n# 更新所有翻译文件\n./manage-translations.sh update\n\n# 更新特定语言\n./manage-translations.sh update -l zh_CN\n\n# 清理不再使用的键\n./manage-translations.sh clean\n\n# 同步所有语言文件的键\n./manage-translations.sh sync\n```\n\n或者从项目根目录运行：\n```bash\n# 从项目根目录运行\n.config/quickshell/translations/tools/manage-translations.sh status\n.config/quickshell/translations/tools/manage-translations.sh update\n```\n\n## 详细使用说明\n\n### 翻译管理器 (`translation-manager.py`)\n\n基本用法：\n```bash\n# 处理所有语言\n./translation-manager.py\n\n# 指定特定语言\n./translation-manager.py --language zh_CN\n\n# 仅提取可翻译文本\n./translation-manager.py --extract-only\n\n# 显示提取的文本\n./translation-manager.py --extract-only --show-temp\n```\n\n参数说明：\n- `--translations-dir`, `-t`: 翻译文件目录（默认：`.config/quickshell/translations`）\n- `--source-dir`, `-s`: 源代码目录（默认：`.config/quickshell`）\n- `--language`, `-l`: 指定要处理的语言代码\n- `--extract-only`, `-e`: 仅提取可翻译文本\n- `--show-temp`: 显示临时提取文件的内容\n\n### 翻译清理器 (`translation-cleaner.py`)\n\n```bash\n# 清理不再使用的翻译键\n./translation-cleaner.py --clean\n\n# 同步翻译键（以 en_US 为基准）\n./translation-cleaner.py --sync\n\n# 指定不同的源语言进行同步\n./translation-cleaner.py --sync --source-lang zh_CN\n\n# 清理时不创建备份\n./translation-cleaner.py --clean --no-backup\n```\n\n## 工作流程\n\n### 日常翻译更新流程\n\n1. **检查状态**：\n   ```bash\n   ./manage-translations.sh status\n   ```\n\n2. **更新翻译**：\n   ```bash\n   ./manage-translations.sh update\n   ```\n\n3. **清理无用键**（可选）：\n   ```bash\n   ./manage-translations.sh clean\n   ```\n\n### 新增语言流程\n\n1. **创建新语言文件**：\n   ```bash\n   ./manage-translations.sh update -l new_lang\n   ```\n\n2. **同步键结构**：\n   ```bash\n   ./manage-translations.sh sync\n   ```\n\n### 大规模重构后的清理流程\n\n1. **备份翻译文件**：\n   ```bash\n   cp -r .config/quickshell/translations .config/quickshell/translations.backup\n   ```\n\n2. **清理无用键**：\n   ```bash\n   ./manage-translations.sh clean\n   ```\n\n3. **同步所有语言**：\n   ```bash\n   ./manage-translations.sh sync\n   ```\n\n## 支持的翻译文本格式\n\n工具可以识别以下格式的可翻译文本：\n\n```qml\n// 基本格式\nTranslation.tr(\"Hello, world!\")\nTranslation.tr('Hello, world!')\nTranslation.tr(`Hello, world!`)\n\n// 带换行符\nTranslation.tr(\"Line 1\\nLine 2\")\n\n// 带转义字符\nTranslation.tr(\"Say \\\"Hello\\\"\")\n\n// 带参数占位符\nTranslation.tr(\"Hello, %1!\").arg(name)\n```\n\n## 示例输出\n\n### 状态显示\n```\n$ ./manage-translations.sh status\n正在分析翻译状态...\n=== 当前项目状态 ===\n提取到 166 个可翻译文本\n\n=== 翻译文件状态 ===\n  en_US: 470 个键\n  zh_CN: 470 个键\n```\n\n### 更新翻译\n```\n$ ./manage-translations.sh update -l zh_CN\n更新翻译文件...\n==================================================\n处理语言: zh_CN\n==================================================\n分析结果:\n  缺少的键: 5\n  多余的键: 20\n\n发现 5 个缺少的翻译键：\n1. \"New feature text\"\n2. \"Another new text\"\n...\n\n是否添加这 5 个缺少的键？ (y/n): y\n已添加 5 个键\n\n发现 20 个多余的翻译键：\n1. \"Removed old text\" -> \"已删除的旧文本\"\n...\n\n是否删除这 20 个多余的键？ (y/n): y\n已删除 20 个键\n\n已保存翻译文件\n```\n\n### 清理无用键\n```\n$ ./manage-translations.sh clean\n清理不再使用的翻译键...\n处理语言: zh_CN\n发现 50 个不再使用的键:\n  1. \"old_unused_text\"\n  2. \"deprecated_message\"\n  ...\n\n是否删除这 50 个不再使用的键？ (y/n): y\n已删除 50 个键\n原始键数: 470, 清理后: 420\n```\n\n## 高级功能\n\n### 自定义目录结构\n\n```bash\n# 使用自定义目录\n./translation-manager.py \\\n  --translations-dir /path/to/translations \\\n  --source-dir /path/to/source\n```\n\n\n## 注意事项\n\n1. **备份重要**：在执行清理操作前，工具会自动创建备份，但建议手动备份重要文件\n\n2. **文本提取限制**：\n   - ~~只支持静态字符串，不支持动态构建的字符串~~\n   - 动态资源（如变量拼接、运行时生成的文本）无法自动提取，需要在翻译文件中手动添加，并使用 `/*keep*/` 标记进行忽略管理。\n   - 必须使用 `Translation.tr()` 格式\n### 忽略标记功能\n\n对于动态资源或特殊文本，如果不希望被自动清理，可在翻译值末尾添加 `/*keep*/`，工具会自动忽略这些键，不会在清理和同步时删除。\n\n示例：\n```json\n{\n  \"dynamic_key\": \"Some dynamic value /*keep*/\"\n}\n```\n\n3. **文件编码**：所有文件必须使用 UTF-8 编码\n\n4. **键名规范**：建议使用英文作为键名，避免使用特殊字符\n\n## 故障排除\n\n### 常见问题\n\n\n**Q: 添加了 Translation.tr 后文字不显示？**\nA: 需要在 QML 文件中使用 `import \"root:/\"` 导入翻译功能，否则无法正常显示翻译文本。\n\n**Q: 提取的文本数量与预期不符？**\nA: 检查是否所有可翻译文本都使用了 `Translation.tr()` 格式，确保没有动态构建的字符串。\n\n**Q: 同步后某些翻译丢失？**\nA: 检查源语言文件是否包含所有必要的键，考虑使用不同的源语言进行同步。\n\n**Q: 清理操作删除了需要的键？**\nA: 从自动创建的备份文件中恢复，检查源代码中是否正确使用了 `Translation.tr()`。\n\n### 恢复备份\n\n```bash\n# 恢复单个文件\ncp .config/quickshell/translations/zh_CN.json.backup .config/quickshell/translations/zh_CN.json\n\n# 恢复所有文件\ncp .config/quickshell/translations.backup/* .config/quickshell/translations/\n```\n","dots/.config/quickshell/ii/translations/tools/README.md":"# Translation Management Tool Suite\n\nThis suite is used to manage project translation files, automatically extract translatable texts, compare differences between language files, and provide maintenance functions.\n\n## Tool Components\n\n### 1. `translation-manager.py` - Main Translation Manager\n- Extract translatable texts\n- Compare and update translation files\n- Interactive addition/removal of translation keys\n\n### 2. `translation-cleaner.py` - Translation File Maintenance Tool\n- Clean unused translation keys\n- Synchronize key structure across different language files\n\n### 3. `manage-translations.sh` - Convenient Wrapper Script\n- Provides a unified command-line interface\n- Displays translation status\n- Simplifies common operations\n\n## Quick Start\n\n### Using the Wrapper Script (Recommended)\n\n```bash\n# Enter the tools directory\ncd .config/quickshell/translations/tools\n\n# Show help\n./manage-translations.sh --help\n\n# Show current translation status\n./manage-translations.sh status\n\n# Extract translatable texts\n./manage-translations.sh extract\n\n# Update all translation files\n./manage-translations.sh update\n\n# Update a specific language\n./manage-translations.sh update -l zh_CN\n\n# Clean unused keys\n./manage-translations.sh clean\n\n# Synchronize keys across all language files\n./manage-translations.sh sync\n```\n\nOr run from the project root:\n```bash\n# Run from the project root\n.config/quickshell/translations/tools/manage-translations.sh status\n.config/quickshell/translations/tools/manage-translations.sh update\n```\n\n## Detailed Usage\n\n### Translation Manager (`translation-manager.py`)\n\nBasic usage:\n```bash\n# Process all languages\n./translation-manager.py\n\n# Specify a particular language\n./translation-manager.py --language zh_CN\n\n# Extract translatable texts only\n./translation-manager.py --extract-only\n\n# Show extracted texts\n./translation-manager.py --extract-only --show-temp\n```\n\nParameter description:\n- `--translations-dir`, `-t`: Translation files directory (default: `.config/quickshell/translations`)\n- `--source-dir`, `-s`: Source code directory (default: `.config/quickshell`)\n- `--language`, `-l`: Specify the language code to process\n- `--extract-only`, `-e`: Only extract translatable texts\n- `--show-temp`: Show the content of the temporary extraction file\n\n### Translation Cleaner (`translation-cleaner.py`)\n\n```bash\n# Clean unused translation keys\n./translation-cleaner.py --clean\n\n# Synchronize translation keys (using en_US as the base)\n./translation-cleaner.py --sync\n\n# Specify a different source language for syncing\n./translation-cleaner.py --sync --source-lang zh_CN\n\n# Clean without creating backups\n./translation-cleaner.py --clean --no-backup\n```\n\n## Workflow\n\n### Regular Translation Update Workflow\n\n1. **Check status**:\n   ```bash\n   ./manage-translations.sh status\n   ```\n\n2. **Update translations**:\n   ```bash\n   ./manage-translations.sh update\n   ```\n\n3. **Clean unused keys** (optional):\n   ```bash\n   ./manage-translations.sh clean\n   ```\n\n### Adding a New Language\n\n1. **Create a new language file**:\n   ```bash\n   ./manage-translations.sh update -l new_lang\n   ```\n\n2. **Synchronize key structure**:\n   ```bash\n   ./manage-translations.sh sync\n   ```\n\n### Cleanup After Large Refactoring\n\n1. **Backup translation files**:\n   ```bash\n   cp -r .config/quickshell/translations .config/quickshell/translations.backup\n   ```\n\n2. **Clean unused keys**:\n   ```bash\n   ./manage-translations.sh clean\n   ```\n\n3. **Synchronize all languages**:\n   ```bash\n   ./manage-translations.sh sync\n   ```\n\n## Supported Translatable Text Formats\n\nThe tool recognizes the following formats for translatable texts:\n\n```qml\n// Basic format\nTranslation.tr(\"Hello, world!\")\nTranslation.tr('Hello, world!')\nTranslation.tr(`Hello, world!`)\n\n// With line breaks\nTranslation.tr(\"Line 1\\nLine 2\")\n\n// With escape characters\nTranslation.tr(\"Say \\\"Hello\\\"\")\n\n// With parameter placeholders\nTranslation.tr(\"Hello, %1!\").arg(name)\n```\n\n## Example Output\n\n### Status Display\n```\n$ ./manage-translations.sh status\nAnalyzing translation status...\n=== Current Project Status ===\n166 translatable texts extracted\n\n=== Translation File Status ===\n  en_US: 470 keys\n  zh_CN: 470 keys\n```\n\n### Update Translations\n```\n$ ./manage-translations.sh update -l zh_CN\nUpdating translation files...\n==================================================\nProcessing language: zh_CN\n==================================================\nAnalysis result:\n  Missing keys: 5\n  Extra keys: 20\n\nFound 5 missing translation keys:\n1. \"New feature text\"\n2. \"Another new text\"\n...\n\nAdd these 5 missing keys? (y/n): y\n5 keys added\n\nFound 20 extra translation keys:\n1. \"Removed old text\" -> \"已删除的旧文本\"\n...\n\nDelete these 20 extra keys? (y/n): y\n20 keys deleted\n\nTranslation file saved\n```\n\n### Clean Unused Keys\n```\n$ ./manage-translations.sh clean\nCleaning unused translation keys...\nProcessing language: zh_CN\nFound 50 unused keys:\n  1. \"old_unused_text\"\n  2. \"deprecated_message\"\n  ...\n\nDelete these 50 unused keys? (y/n): y\n50 keys deleted\nOriginal key count: 470, after cleaning: 420\n```\n\n## Advanced Features\n\n### Custom Directory Structure\n\n```bash\n# Use custom directories\n./translation-manager.py \\\n  --translations-dir /path/to/translations \\\n  --source-dir /path/to/source\n```\n\n### Ignore Mark Feature\n\nFor dynamic resources or special texts that should not be automatically cleaned, you can add `/*keep*/` at the end of the translation value. The tool will automatically ignore these keys and will not delete them during cleaning or syncing.\n\nExample:\n```json\n{\n  \"dynamic_key\": \"Some dynamic value /*keep*/\"\n}\n```\n\n## Notes\n\n1. **Backup is important**: The tool automatically creates backups before cleaning, but it is recommended to manually back up important files\n\n2. **Text extraction limitations**:\n   - ~~Only supports static strings, not dynamically constructed strings~~\n   - Dynamic resources (such as variable concatenation or runtime-generated text) cannot be automatically extracted. You need to manually add them to the translation file and use the `/*keep*/` mark for ignore management.\n   - Must use the `Translation.tr()` format\n\n3. **File encoding**: All files must use UTF-8 encoding\n\n4. **Key naming conventions**: It is recommended to use English for key names and avoid special characters\n\n## Troubleshooting\n\n### Common Issues\n\n**Q: Text does not appear after adding Translation.tr?**\nA: You need to import the translation feature in your QML file using `import \"root:/\"`, otherwise the translation text will not be displayed correctly.\n\n**Q: The number of extracted texts does not match expectations?**\nA: Check whether all translatable texts use the `Translation.tr()` format and ensure there are no dynamically constructed strings.\n\n**Q: Some translations are missing after syncing?**\nA: Check whether the source language file contains all necessary keys, and consider using a different source language for syncing.\n\n**Q: The cleaning operation deleted needed keys?**\nA: Restore from the automatically created backup file and check whether `Translation.tr()` is used correctly in the source code.\n\n### Restore Backup\n\n```bash\n# Restore a single file\ncp .config/quickshell/translations/zh_CN.json.backup .config/quickshell/translations/zh_CN.json\n\n# Restore all files\ncp .config/quickshell/translations.backup/* .config/quickshell/translations/\n```\n","dots/.config/quickshell/ii/translations/tools/guide/translation-tools-guide.md":"# Translation Management Tool Suite\n\nThis suite is used to manage project translation files, automatically extract translatable texts, compare differences between language files, and provide maintenance functions.\n\n## Tool Components\n\n### 1. `translation-manager.py` - Main Translation Manager\n- Extract translatable texts\n- Compare and update translation files\n- Interactive addition/removal of translation keys\n\n### 2. `translation-cleaner.py` - Translation File Maintenance Tool\n- Clean unused translation keys\n- Synchronize key structure across different language files\n\n### 3. `manage-translations.sh` - Convenient Wrapper Script\n- Provides a unified command-line interface\n- Displays translation status\n- Simplifies common operations\n\n## Quick Start\n\n### Using the Wrapper Script (Recommended)\n\n```bash\n# Enter the tools directory\ncd .config/quickshell/translations/tools\n\n# Show help\n./manage-translations.sh --help\n\n# Show current translation status\n./manage-translations.sh status\n\n# Extract translatable texts\n./manage-translations.sh extract\n\n# Update all translation files\n./manage-translations.sh update\n\n# Update a specific language\n./manage-translations.sh update -l zh_CN\n\n# Clean unused keys\n./manage-translations.sh clean\n\n# Synchronize keys across all language files\n./manage-translations.sh sync\n```\n\nOr run from the project root:\n```bash\n# Run from the project root\n.config/quickshell/translations/tools/manage-translations.sh status\n.config/quickshell/translations/tools/manage-translations.sh update\n```\n\n## Detailed Usage\n\n### Translation Manager (`translation-manager.py`)\n\nBasic usage:\n```bash\n# Process all languages\n./translation-manager.py\n\n# Specify a particular language\n./translation-manager.py --language zh_CN\n\n# Extract translatable texts only\n./translation-manager.py --extract-only\n\n# Show extracted texts\n./translation-manager.py --extract-only --show-temp\n```\n\nParameter description:\n- `--translations-dir`, `-t`: Translation files directory (default: `.config/quickshell/translations`)\n- `--source-dir`, `-s`: Source code directory (default: `.config/quickshell`)\n- `--language`, `-l`: Specify the language code to process\n- `--extract-only`, `-e`: Only extract translatable texts\n- `--show-temp`: Show the content of the temporary extraction file\n\n### Translation Cleaner (`translation-cleaner.py`)\n\n```bash\n# Clean unused translation keys\n./translation-cleaner.py --clean\n\n# Synchronize translation keys (using en_US as the base)\n./translation-cleaner.py --sync\n\n# Specify a different source language for syncing\n./translation-cleaner.py --sync --source-lang zh_CN\n\n# Clean without creating backups\n./translation-cleaner.py --clean --no-backup\n```\n\n## Workflow\n\n### Regular Translation Update Workflow\n\n1. **Check status**:\n   ```bash\n   ./manage-translations.sh status\n   ```\n\n2. **Update translations**:\n   ```bash\n   ./manage-translations.sh update\n   ```\n\n3. **Clean unused keys** (optional):\n   ```bash\n   ./manage-translations.sh clean\n   ```\n\n### Adding a New Language\n\n1. **Create a new language file**:\n   ```bash\n   ./manage-translations.sh update -l new_lang\n   ```\n\n2. **Synchronize key structure**:\n   ```bash\n   ./manage-translations.sh sync\n   ```\n\n### Cleanup After Large Refactoring\n\n1. **Backup translation files**:\n   ```bash\n   cp -r .config/quickshell/translations .config/quickshell/translations.backup\n   ```\n\n2. **Clean unused keys**:\n   ```bash\n   ./manage-translations.sh clean\n   ```\n\n3. **Synchronize all languages**:\n   ```bash\n   ./manage-translations.sh sync\n   ```\n\n## Supported Translatable Text Formats\n\nThe tool recognizes the following formats for translatable texts:\n\n```qml\n// Basic format\nTranslation.tr(\"Hello, world!\")\nTranslation.tr('Hello, world!')\nTranslation.tr(`Hello, world!`)\n\n// With line breaks\nTranslation.tr(\"Line 1\\nLine 2\")\n\n// With escape characters\nTranslation.tr(\"Say \\\"Hello\\\"\")\n\n// With parameter placeholders\nTranslation.tr(\"Hello, %1!\").arg(name)\n```\n\n## Example Output\n\n### Status Display\n```\n$ ./manage-translations.sh status\nAnalyzing translation status...\n=== Current Project Status ===\n166 translatable texts extracted\n\n=== Translation File Status ===\n  en_US: 470 keys\n  zh_CN: 470 keys\n```\n\n### Update Translations\n```\n$ ./manage-translations.sh update -l zh_CN\nUpdating translation files...\n==================================================\nProcessing language: zh_CN\n==================================================\nAnalysis result:\n  Missing keys: 5\n  Extra keys: 20\n\nFound 5 missing translation keys:\n1. \"New feature text\"\n2. \"Another new text\"\n...\n\nAdd these 5 missing keys? (y/n): y\n5 keys added\n\nFound 20 extra translation keys:\n1. \"Removed old text\" -> \"已删除的旧文本\"\n...\n\nDelete these 20 extra keys? (y/n): y\n20 keys deleted\n\nTranslation file saved\n```\n\n### Clean Unused Keys\n```\n$ ./manage-translations.sh clean\nCleaning unused translation keys...\nProcessing language: zh_CN\nFound 50 unused keys:\n  1. \"old_unused_text\"\n  2. \"deprecated_message\"\n  ...\n\nDelete these 50 unused keys? (y/n): y\n50 keys deleted\nOriginal key count: 470, after cleaning: 420\n```\n\n## Advanced Features\n\n### Custom Directory Structure\n\n```bash\n# Use custom directories\n./translation-manager.py \\\n  --translations-dir /path/to/translations \\\n  --source-dir /path/to/source\n```\n\n### Ignore Mark Feature\n\nFor dynamic resources or special texts that should not be automatically cleaned, you can add `/*keep*/` at the end of the translation value. The tool will automatically ignore these keys and will not delete them during cleaning or syncing.\n\nExample:\n```json\n{\n  \"dynamic_key\": \"Some dynamic value /*keep*/\"\n}\n```\n\n## Notes\n\n1. **Backup is important**: The tool automatically creates backups before cleaning, but it is recommended to manually back up important files\n\n2. **Text extraction limitations**:\n   - ~~Only supports static strings, not dynamically constructed strings~~\n   - Dynamic resources (such as variable concatenation or runtime-generated text) cannot be automatically extracted. You need to manually add them to the translation file and use the `/*keep*/` mark for ignore management.\n   - Must use the `Translation.tr()` format\n\n3. **File encoding**: All files must use UTF-8 encoding\n\n4. **Key naming conventions**: It is recommended to use English for key names and avoid special characters\n\n## Troubleshooting\n\n### Common Issues\n\n**Q: Text does not appear after adding Translation.tr?**\nA: You need to import the translation feature in your QML file using `import \"root:/\"`, otherwise the translation text will not be displayed correctly.\n\n**Q: The number of extracted texts does not match expectations?**\nA: Check whether all translatable texts use the `Translation.tr()` format and ensure there are no dynamically constructed strings.\n\n**Q: Some translations are missing after syncing?**\nA: Check whether the source language file contains all necessary keys, and consider using a different source language for syncing.\n\n**Q: The cleaning operation deleted needed keys?**\nA: Restore from the automatically created backup file and check whether `Translation.tr()` is used correctly in the source code.\n\n### Restore Backup\n\n```bash\n# Restore a single file\ncp .config/quickshell/translations/zh_CN.json.backup .config/quickshell/translations/zh_CN.json\n\n# Restore all files\ncp .config/quickshell/translations.backup/* .config/quickshell/translations/\n```\n"},"items":[{"name":"translation-tools-guide-zh_CN.md","path":"dots/.config/quickshell/ii/translations/tools/guide/translation-tools-guide-zh_CN.md","rawUrl":"https://raw.githubusercontent.com/end-4/dots-hyprland/HEAD/dots/.config/quickshell/ii/translations/tools/guide/translation-tools-guide-zh_CN.md","title":"Guide Skill","category":"anthropic-skill","format":"markdown","content":"# 翻译管理工具套件\n\n这套工具用于管理项目的翻译文件，自动提取可翻译文本，比较不同语言文件之间的差异，并提供维护功能。\n\n## 工具组成\n\n### 1. `translation-manager.py` - 主要翻译管理器\n- 提取可翻译文本\n- 比较和更新翻译文件\n- 交互式添加/删除翻译键\n\n### 2. `translation-cleaner.py` - 翻译文件维护工具\n- 清理不再使用的翻译键\n- 同步不同语言文件的键结构\n\n### 3. `manage-translations.sh` - 便捷包装脚本\n- 提供统一的命令行界面\n- 显示翻译状态\n- 简化常用操作\n\n## 快速开始\n\n### 使用便捷脚本（推荐）\n\n```bash\n# 进入工具目录\ncd .config/quickshell/translations/tools\n\n# 查看帮助\n./manage-translations.sh --help\n\n# 显示当前翻译状态\n./manage-translations.sh status\n\n# 提取可翻译文本\n./manage-translations.sh extract\n\n# 更新所有翻译文件\n./manage-translations.sh update\n\n# 更新特定语言\n./manage-translations.sh update -l zh_CN\n\n# 清理不再使用的键\n./manage-translations.sh clean\n\n# 同步所有语言文件的键\n./manage-translations.sh sync\n```\n\n或者从项目根目录运行：\n```bash\n# 从项目根目录运行\n.config/quickshell/translations/tools/manage-translations.sh status\n.config/quickshell/translations/tools/manage-translations.sh update\n```\n\n## 详细使用说明\n\n### 翻译管理器 (`translation-manager.py`)\n\n基本用法：\n```bash\n# 处理所有语言\n./translation-manager.py\n\n# 指定特定语言\n./translation-manager.py --language zh_CN\n\n# 仅提取可翻译文本\n./translation-manager.py --extract-only\n\n# 显示提取的文本\n./translation-manager.py --extract-only --show-temp\n```\n\n参数说明：\n- `--translations-dir`, `-t`: 翻译文件目录（默认：`.config/quickshell/translations`）\n- `--source-dir`, `-s`: 源代码目录（默认：`.config/quickshell`）\n- `--language`, `-l`: 指定要处理的语言代码\n- `--extract-only`, `-e`: 仅提取可翻译文本\n- `--show-temp`: 显示临时提取文件的内容\n\n### 翻译清理器 (`translation-cleaner.py`)\n\n```bash\n# 清理不再使用的翻译键\n./translation-cleaner.py --clean\n\n# 同步翻译键（以 en_US 为基准）\n./translation-cleaner.py --sync\n\n# 指定不同的源语言进行同步\n./translation-cleaner.py --sync --source-lang zh_CN\n\n# 清理时不创建备份\n./translation-cleaner.py --clean --no-backup\n```\n\n## 工作流程\n\n### 日常翻译更新流程\n\n1. **检查状态**：\n   ```bash\n   ./manage-translations.sh status\n   ```\n\n2. **更新翻译**：\n   ```bash\n   ./manage-translations.sh update\n   ```\n\n3. **清理无用键**（可选）：\n   ```bash\n   ./manage-translations.sh clean\n   ```\n\n### 新增语言流程\n\n1. **创建新语言文件**：\n   ```bash\n   ./manage-translations.sh update -l new_lang\n   ```\n\n2. **同步键结构**：\n   ```bash\n   ./manage-translations.sh sync\n   ```\n\n### 大规模重构后的清理流程\n\n1. **备份翻译文件**：\n   ```bash\n   cp -r .config/quickshell/translations .config/quickshell/translations.backup\n   ```\n\n2. **清理无用键**：\n   ```bash\n   ./manage-translations.sh clean\n   ```\n\n3. **同步所有语言**：\n   ```bash\n   ./manage-translations.sh sync\n   ```\n\n## 支持的翻译文本格式\n\n工具可以识别以下格式的可翻译文本：\n\n```qml\n// 基本格式\nTranslation.tr(\"Hello, world!\")\nTranslation.tr('Hello, world!')\nTranslation.tr(`Hello, world!`)\n\n// 带换行符\nTranslation.tr(\"Line 1\\nLine 2\")\n\n// 带转义字符\nTranslation.tr(\"Say \\\"Hello\\\"\")\n\n// 带参数占位符\nTranslation.tr(\"Hello, %1!\").arg(name)\n```\n\n## 示例输出\n\n### 状态显示\n```\n$ ./manage-translations.sh status\n正在分析翻译状态...\n=== 当前项目状态 ===\n提取到 166 个可翻译文本\n\n=== 翻译文件状态 ===\n  en_US: 470 个键\n  zh_CN: 470 个键\n```\n\n### 更新翻译\n```\n$ ./manage-translations.sh update -l zh_CN\n更新翻译文件...\n==================================================\n处理语言: zh_CN\n==================================================\n分析结果:\n  缺少的键: 5\n  多余的键: 20\n\n发现 5 个缺少的翻译键：\n1. \"New feature text\"\n2. \"Another new text\"\n...\n\n是否添加这 5 个缺少的键？ (y/n): y\n已添加 5 个键\n\n发现 20 个多余的翻译键：\n1. \"Removed old text\" -> \"已删除的旧文本\"\n...\n\n是否删除这 20 个多余的键？ (y/n): y\n已删除 20 个键\n\n已保存翻译文件\n```\n\n### 清理无用键\n```\n$ ./manage-translations.sh clean\n清理不再使用的翻译键...\n处理语言: zh_CN\n发现 50 个不再使用的键:\n  1. \"old_unused_text\"\n  2. \"deprecated_message\"\n  ...\n\n是否删除这 50 个不再使用的键？ (y/n): y\n已删除 50 个键\n原始键数: 470, 清理后: 420\n```\n\n## 高级功能\n\n### 自定义目录结构\n\n```bash\n# 使用自定义目录\n./translation-manager.py \\\n  --translations-dir /path/to/translations \\\n  --source-dir /path/to/source\n```\n\n\n## 注意事项\n\n1. **备份重要**：在执行清理操作前，工具会自动创建备份，但建议手动备份重要文件\n\n2. **文本提取限制**：\n   - ~~只支持静态字符串，不支持动态构建的字符串~~\n   - 动态资源（如变量拼接、运行时生成的文本）无法自动提取，需要在翻译文件中手动添加，并使用 `/*keep*/` 标记进行忽略管理。\n   - 必须使用 `Translation.tr()` 格式\n### 忽略标记功能\n\n对于动态资源或特殊文本，如果不希望被自动清理，可在翻译值末尾添加 `/*keep*/`，工具会自动忽略这些键，不会在清理和同步时删除。\n\n示例：\n```json\n{\n  \"dynamic_key\": \"Some dynamic value /*keep*/\"\n}\n```\n\n3. **文件编码**：所有文件必须使用 UTF-8 编码\n\n4. **键名规范**：建议使用英文作为键名，避免使用特殊字符\n\n## 故障排除\n\n### 常见问题\n\n\n**Q: 添加了 Translation.tr 后文字不显示？**\nA: 需要在 QML 文件中使用 `import \"root:/\"` 导入翻译功能，否则无法正常显示翻译文本。\n\n**Q: 提取的文本数量与预期不符？**\nA: 检查是否所有可翻译文本都使用了 `Translation.tr()` 格式，确保没有动态构建的字符串。\n\n**Q: 同步后某些翻译丢失？**\nA: 检查源语言文件是否包含所有必要的键，考虑使用不同的源语言进行同步。\n\n**Q: 清理操作删除了需要的键？**\nA: 从自动创建的备份文件中恢复，检查源代码中是否正确使用了 `Translation.tr()`。\n\n### 恢复备份\n\n```bash\n# 恢复单个文件\ncp .config/quickshell/translations/zh_CN.json.backup .config/quickshell/translations/zh_CN.json\n\n# 恢复所有文件\ncp .config/quickshell/translations.backup/* .config/quickshell/translations/\n```\n","isInternal":false,"tokens":2234,"sizeBytes":6706},{"name":"translation-tools-guide.md","path":"dots/.config/quickshell/ii/translations/tools/guide/translation-tools-guide.md","rawUrl":"https://raw.githubusercontent.com/end-4/dots-hyprland/HEAD/dots/.config/quickshell/ii/translations/tools/guide/translation-tools-guide.md","title":"Guide Skill","category":"anthropic-skill","format":"markdown","content":"# Translation Management Tool Suite\n\nThis suite is used to manage project translation files, automatically extract translatable texts, compare differences between language files, and provide maintenance functions.\n\n## Tool Components\n\n### 1. `translation-manager.py` - Main Translation Manager\n- Extract translatable texts\n- Compare and update translation files\n- Interactive addition/removal of translation keys\n\n### 2. `translation-cleaner.py` - Translation File Maintenance Tool\n- Clean unused translation keys\n- Synchronize key structure across different language files\n\n### 3. `manage-translations.sh` - Convenient Wrapper Script\n- Provides a unified command-line interface\n- Displays translation status\n- Simplifies common operations\n\n## Quick Start\n\n### Using the Wrapper Script (Recommended)\n\n```bash\n# Enter the tools directory\ncd .config/quickshell/translations/tools\n\n# Show help\n./manage-translations.sh --help\n\n# Show current translation status\n./manage-translations.sh status\n\n# Extract translatable texts\n./manage-translations.sh extract\n\n# Update all translation files\n./manage-translations.sh update\n\n# Update a specific language\n./manage-translations.sh update -l zh_CN\n\n# Clean unused keys\n./manage-translations.sh clean\n\n# Synchronize keys across all language files\n./manage-translations.sh sync\n```\n\nOr run from the project root:\n```bash\n# Run from the project root\n.config/quickshell/translations/tools/manage-translations.sh status\n.config/quickshell/translations/tools/manage-translations.sh update\n```\n\n## Detailed Usage\n\n### Translation Manager (`translation-manager.py`)\n\nBasic usage:\n```bash\n# Process all languages\n./translation-manager.py\n\n# Specify a particular language\n./translation-manager.py --language zh_CN\n\n# Extract translatable texts only\n./translation-manager.py --extract-only\n\n# Show extracted texts\n./translation-manager.py --extract-only --show-temp\n```\n\nParameter description:\n- `--translations-dir`, `-t`: Translation files directory (default: `.config/quickshell/translations`)\n- `--source-dir`, `-s`: Source code directory (default: `.config/quickshell`)\n- `--language`, `-l`: Specify the language code to process\n- `--extract-only`, `-e`: Only extract translatable texts\n- `--show-temp`: Show the content of the temporary extraction file\n\n### Translation Cleaner (`translation-cleaner.py`)\n\n```bash\n# Clean unused translation keys\n./translation-cleaner.py --clean\n\n# Synchronize translation keys (using en_US as the base)\n./translation-cleaner.py --sync\n\n# Specify a different source language for syncing\n./translation-cleaner.py --sync --source-lang zh_CN\n\n# Clean without creating backups\n./translation-cleaner.py --clean --no-backup\n```\n\n## Workflow\n\n### Regular Translation Update Workflow\n\n1. **Check status**:\n   ```bash\n   ./manage-translations.sh status\n   ```\n\n2. **Update translations**:\n   ```bash\n   ./manage-translations.sh update\n   ```\n\n3. **Clean unused keys** (optional):\n   ```bash\n   ./manage-translations.sh clean\n   ```\n\n### Adding a New Language\n\n1. **Create a new language file**:\n   ```bash\n   ./manage-translations.sh update -l new_lang\n   ```\n\n2. **Synchronize key structure**:\n   ```bash\n   ./manage-translations.sh sync\n   ```\n\n### Cleanup After Large Refactoring\n\n1. **Backup translation files**:\n   ```bash\n   cp -r .config/quickshell/translations .config/quickshell/translations.backup\n   ```\n\n2. **Clean unused keys**:\n   ```bash\n   ./manage-translations.sh clean\n   ```\n\n3. **Synchronize all languages**:\n   ```bash\n   ./manage-translations.sh sync\n   ```\n\n## Supported Translatable Text Formats\n\nThe tool recognizes the following formats for translatable texts:\n\n```qml\n// Basic format\nTranslation.tr(\"Hello, world!\")\nTranslation.tr('Hello, world!')\nTranslation.tr(`Hello, world!`)\n\n// With line breaks\nTranslation.tr(\"Line 1\\nLine 2\")\n\n// With escape characters\nTranslation.tr(\"Say \\\"Hello\\\"\")\n\n// With parameter placeholders\nTranslation.tr(\"Hello, %1!\").arg(name)\n```\n\n## Example Output\n\n### Status Display\n```\n$ ./manage-translations.sh status\nAnalyzing translation status...\n=== Current Project Status ===\n166 translatable texts extracted\n\n=== Translation File Status ===\n  en_US: 470 keys\n  zh_CN: 470 keys\n```\n\n### Update Translations\n```\n$ ./manage-translations.sh update -l zh_CN\nUpdating translation files...\n==================================================\nProcessing language: zh_CN\n==================================================\nAnalysis result:\n  Missing keys: 5\n  Extra keys: 20\n\nFound 5 missing translation keys:\n1. \"New feature text\"\n2. \"Another new text\"\n...\n\nAdd these 5 missing keys? (y/n): y\n5 keys added\n\nFound 20 extra translation keys:\n1. \"Removed old text\" -> \"已删除的旧文本\"\n...\n\nDelete these 20 extra keys? (y/n): y\n20 keys deleted\n\nTranslation file saved\n```\n\n### Clean Unused Keys\n```\n$ ./manage-translations.sh clean\nCleaning unused translation keys...\nProcessing language: zh_CN\nFound 50 unused keys:\n  1. \"old_unused_text\"\n  2. \"deprecated_message\"\n  ...\n\nDelete these 50 unused keys? (y/n): y\n50 keys deleted\nOriginal key count: 470, after cleaning: 420\n```\n\n## Advanced Features\n\n### Custom Directory Structure\n\n```bash\n# Use custom directories\n./translation-manager.py \\\n  --translations-dir /path/to/translations \\\n  --source-dir /path/to/source\n```\n\n### Ignore Mark Feature\n\nFor dynamic resources or special texts that should not be automatically cleaned, you can add `/*keep*/` at the end of the translation value. The tool will automatically ignore these keys and will not delete them during cleaning or syncing.\n\nExample:\n```json\n{\n  \"dynamic_key\": \"Some dynamic value /*keep*/\"\n}\n```\n\n## Notes\n\n1. **Backup is important**: The tool automatically creates backups before cleaning, but it is recommended to manually back up important files\n\n2. **Text extraction limitations**:\n   - ~~Only supports static strings, not dynamically constructed strings~~\n   - Dynamic resources (such as variable concatenation or runtime-generated text) cannot be automatically extracted. You need to manually add them to the translation file and use the `/*keep*/` mark for ignore management.\n   - Must use the `Translation.tr()` format\n\n3. **File encoding**: All files must use UTF-8 encoding\n\n4. **Key naming conventions**: It is recommended to use English for key names and avoid special characters\n\n## Troubleshooting\n\n### Common Issues\n\n**Q: Text does not appear after adding Translation.tr?**\nA: You need to import the translation feature in your QML file using `import \"root:/\"`, otherwise the translation text will not be displayed correctly.\n\n**Q: The number of extracted texts does not match expectations?**\nA: Check whether all translatable texts use the `Translation.tr()` format and ensure there are no dynamically constructed strings.\n\n**Q: Some translations are missing after syncing?**\nA: Check whether the source language file contains all necessary keys, and consider using a different source language for syncing.\n\n**Q: The cleaning operation deleted needed keys?**\nA: Restore from the automatically created backup file and check whether `Translation.tr()` is used correctly in the source code.\n\n### Restore Backup\n\n```bash\n# Restore a single file\ncp .config/quickshell/translations/zh_CN.json.backup .config/quickshell/translations/zh_CN.json\n\n# Restore all files\ncp .config/quickshell/translations.backup/* .config/quickshell/translations/\n```\n","isInternal":false,"tokens":1654,"sizeBytes":7381},{"name":"README.md","path":"dots/.config/quickshell/ii/translations/tools/README.md","rawUrl":"https://raw.githubusercontent.com/end-4/dots-hyprland/HEAD/dots/.config/quickshell/ii/translations/tools/README.md","title":"tools Documentation","category":"plugin-manifest","format":"markdown","content":"# Translation Management Tool Suite\n\nThis suite is used to manage project translation files, automatically extract translatable texts, compare differences between language files, and provide maintenance functions.\n\n## Tool Components\n\n### 1. `translation-manager.py` - Main Translation Manager\n- Extract translatable texts\n- Compare and update translation files\n- Interactive addition/removal of translation keys\n\n### 2. `translation-cleaner.py` - Translation File Maintenance Tool\n- Clean unused translation keys\n- Synchronize key structure across different language files\n\n### 3. `manage-translations.sh` - Convenient Wrapper Script\n- Provides a unified command-line interface\n- Displays translation status\n- Simplifies common operations\n\n## Quick Start\n\n### Using the Wrapper Script (Recommended)\n\n```bash\n# Enter the tools directory\ncd .config/quickshell/translations/tools\n\n# Show help\n./manage-translations.sh --help\n\n# Show current translation status\n./manage-translations.sh status\n\n# Extract translatable texts\n./manage-translations.sh extract\n\n# Update all translation files\n./manage-translations.sh update\n\n# Update a specific language\n./manage-translations.sh update -l zh_CN\n\n# Clean unused keys\n./manage-translations.sh clean\n\n# Synchronize keys across all language files\n./manage-translations.sh sync\n```\n\nOr run from the project root:\n```bash\n# Run from the project root\n.config/quickshell/translations/tools/manage-translations.sh status\n.config/quickshell/translations/tools/manage-translations.sh update\n```\n\n## Detailed Usage\n\n### Translation Manager (`translation-manager.py`)\n\nBasic usage:\n```bash\n# Process all languages\n./translation-manager.py\n\n# Specify a particular language\n./translation-manager.py --language zh_CN\n\n# Extract translatable texts only\n./translation-manager.py --extract-only\n\n# Show extracted texts\n./translation-manager.py --extract-only --show-temp\n```\n\nParameter description:\n- `--translations-dir`, `-t`: Translation files directory (default: `.config/quickshell/translations`)\n- `--source-dir`, `-s`: Source code directory (default: `.config/quickshell`)\n- `--language`, `-l`: Specify the language code to process\n- `--extract-only`, `-e`: Only extract translatable texts\n- `--show-temp`: Show the content of the temporary extraction file\n\n### Translation Cleaner (`translation-cleaner.py`)\n\n```bash\n# Clean unused translation keys\n./translation-cleaner.py --clean\n\n# Synchronize translation keys (using en_US as the base)\n./translation-cleaner.py --sync\n\n# Specify a different source language for syncing\n./translation-cleaner.py --sync --source-lang zh_CN\n\n# Clean without creating backups\n./translation-cleaner.py --clean --no-backup\n```\n\n## Workflow\n\n### Regular Translation Update Workflow\n\n1. **Check status**:\n   ```bash\n   ./manage-translations.sh status\n   ```\n\n2. **Update translations**:\n   ```bash\n   ./manage-translations.sh update\n   ```\n\n3. **Clean unused keys** (optional):\n   ```bash\n   ./manage-translations.sh clean\n   ```\n\n### Adding a New Language\n\n1. **Create a new language file**:\n   ```bash\n   ./manage-translations.sh update -l new_lang\n   ```\n\n2. **Synchronize key structure**:\n   ```bash\n   ./manage-translations.sh sync\n   ```\n\n### Cleanup After Large Refactoring\n\n1. **Backup translation files**:\n   ```bash\n   cp -r .config/quickshell/translations .config/quickshell/translations.backup\n   ```\n\n2. **Clean unused keys**:\n   ```bash\n   ./manage-translations.sh clean\n   ```\n\n3. **Synchronize all languages**:\n   ```bash\n   ./manage-translations.sh sync\n   ```\n\n## Supported Translatable Text Formats\n\nThe tool recognizes the following formats for translatable texts:\n\n```qml\n// Basic format\nTranslation.tr(\"Hello, world!\")\nTranslation.tr('Hello, world!')\nTranslation.tr(`Hello, world!`)\n\n// With line breaks\nTranslation.tr(\"Line 1\\nLine 2\")\n\n// With escape characters\nTranslation.tr(\"Say \\\"Hello\\\"\")\n\n// With parameter placeholders\nTranslation.tr(\"Hello, %1!\").arg(name)\n```\n\n## Example Output\n\n### Status Display\n```\n$ ./manage-translations.sh status\nAnalyzing translation status...\n=== Current Project Status ===\n166 translatable texts extracted\n\n=== Translation File Status ===\n  en_US: 470 keys\n  zh_CN: 470 keys\n```\n\n### Update Translations\n```\n$ ./manage-translations.sh update -l zh_CN\nUpdating translation files...\n==================================================\nProcessing language: zh_CN\n==================================================\nAnalysis result:\n  Missing keys: 5\n  Extra keys: 20\n\nFound 5 missing translation keys:\n1. \"New feature text\"\n2. \"Another new text\"\n...\n\nAdd these 5 missing keys? (y/n): y\n5 keys added\n\nFound 20 extra translation keys:\n1. \"Removed old text\" -> \"已删除的旧文本\"\n...\n\nDelete these 20 extra keys? (y/n): y\n20 keys deleted\n\nTranslation file saved\n```\n\n### Clean Unused Keys\n```\n$ ./manage-translations.sh clean\nCleaning unused translation keys...\nProcessing language: zh_CN\nFound 50 unused keys:\n  1. \"old_unused_text\"\n  2. \"deprecated_message\"\n  ...\n\nDelete these 50 unused keys? (y/n): y\n50 keys deleted\nOriginal key count: 470, after cleaning: 420\n```\n\n## Advanced Features\n\n### Custom Directory Structure\n\n```bash\n# Use custom directories\n./translation-manager.py \\\n  --translations-dir /path/to/translations \\\n  --source-dir /path/to/source\n```\n\n### Ignore Mark Feature\n\nFor dynamic resources or special texts that should not be automatically cleaned, you can add `/*keep*/` at the end of the translation value. The tool will automatically ignore these keys and will not delete them during cleaning or syncing.\n\nExample:\n```json\n{\n  \"dynamic_key\": \"Some dynamic value /*keep*/\"\n}\n```\n\n## Notes\n\n1. **Backup is important**: The tool automatically creates backups before cleaning, but it is recommended to manually back up important files\n\n2. **Text extraction limitations**:\n   - ~~Only supports static strings, not dynamically constructed strings~~\n   - Dynamic resources (such as variable concatenation or runtime-generated text) cannot be automatically extracted. You need to manually add them to the translation file and use the `/*keep*/` mark for ignore management.\n   - Must use the `Translation.tr()` format\n\n3. **File encoding**: All files must use UTF-8 encoding\n\n4. **Key naming conventions**: It is recommended to use English for key names and avoid special characters\n\n## Troubleshooting\n\n### Common Issues\n\n**Q: Text does not appear after adding Translation.tr?**\nA: You need to import the translation feature in your QML file using `import \"root:/\"`, otherwise the translation text will not be displayed correctly.\n\n**Q: The number of extracted texts does not match expectations?**\nA: Check whether all translatable texts use the `Translation.tr()` format and ensure there are no dynamically constructed strings.\n\n**Q: Some translations are missing after syncing?**\nA: Check whether the source language file contains all necessary keys, and consider using a different source language for syncing.\n\n**Q: The cleaning operation deleted needed keys?**\nA: Restore from the automatically created backup file and check whether `Translation.tr()` is used correctly in the source code.\n\n### Restore Backup\n\n```bash\n# Restore a single file\ncp .config/quickshell/translations/zh_CN.json.backup .config/quickshell/translations/zh_CN.json\n\n# Restore all files\ncp .config/quickshell/translations.backup/* .config/quickshell/translations/\n```\n","isInternal":false,"tokens":1654,"sizeBytes":7381}],"systemPromptSnippet":"<yakaai_skills repo=\"end-4/dots-hyprland\">\n<!-- File: dots/.config/quickshell/ii/translations/tools/guide/translation-tools-guide-zh_CN.md (Tokens: ~2234 | Category: anthropic-skill) -->\n# 翻译管理工具套件\n\n这套工具用于管理项目的翻译文件，自动提取可翻译文本，比较不同语言文件之间的差异，并提供维护功能。\n\n## 工具组成\n\n### 1. `translation-manager.py` - 主要翻译管理器\n- 提取可翻译文本\n- 比较和更新翻译文件\n- 交互式添加/删除翻译键\n\n### 2. `translation-cleaner.py` - 翻译文件维护工具\n- 清理不再使用的翻译键\n- 同步不同语言文件的键结构\n\n### 3. `manage-translations.sh` - 便捷包装脚本\n- 提供统一的命令行界面\n- 显示翻译状态\n- 简化常用操作\n\n## 快速开始\n\n### 使用便捷脚本（推荐）\n\n```bash\n# 进入工具目录\ncd .config/quickshell/translations/tools\n\n# 查看帮助\n./manage-translations.sh --help\n\n# 显示当前翻译状态\n./manage-translations.sh status\n\n# 提取可翻译文本\n./manage-translations.sh extract\n\n# 更新所有翻译文件\n./manage-translations.sh update\n\n# 更新特定语言\n./manage-translations.sh update -l zh_CN\n\n# 清理不再使用的键\n./manage-translations.sh clean\n\n# 同步所有语言文件的键\n./manage-translations.sh sync\n```\n\n或者从项目根目录运行：\n```bash\n# 从项目根目录运行\n.config/quickshell/translations/tools/manage-translations.sh status\n.config/quickshell/translations/tools/manage-translations.sh update\n```\n\n## 详细使用说明\n\n### 翻译管理器 (`translation-manager.py`)\n\n基本用法：\n```bash\n# 处理所有语言\n./translation-manager.py\n\n# 指定特定语言\n./translation-manager.py --language zh_CN\n\n# 仅提取可翻译文本\n./translation-manager.py --extract-only\n\n# 显示提取的文本\n./translation-manager.py --extract-only --show-temp\n```\n\n参数说明：\n- `--translations-dir`, `-t`: 翻译文件目录（默认：`.config/quickshell/translations`）\n- `--source-dir`, `-s`: 源代码目录（默认：`.config/quickshell`）\n- `--language`, `-l`: 指定要处理的语言代码\n- `--extract-only`, `-e`: 仅提取可翻译文本\n- `--show-temp`: 显示临时提取文件的内容\n\n### 翻译清理器 (`translation-cleaner.py`)\n\n```bash\n# 清理不再使用的翻译键\n./translation-cleaner.py --clean\n\n# 同步翻译键（以 en_US 为基准）\n./translation-cleaner.py --sync\n\n# 指定不同的源语言进行同步\n./translation-cleaner.py --sync --source-lang zh_CN\n\n# 清理时不创建备份\n./translation-cleaner.py --clean --no-backup\n```\n\n## 工作流程\n\n### 日常翻译更新流程\n\n1. **检查状态**：\n   ```bash\n   ./manage-translations.sh status\n   ```\n\n2. **更新翻译**：\n   ```bash\n   ./manage-translations.sh update\n   ```\n\n3. **清理无用键**（可选）：\n   ```bash\n   ./manage-translations.sh clean\n   ```\n\n### 新增语言流程\n\n1. **创建新语言文件**：\n   ```bash\n   ./manage-translations.sh update -l new_lang\n   ```\n\n2. **同步键结构**：\n   ```bash\n   ./manage-translations.sh sync\n   ```\n\n### 大规模重构后的清理流程\n\n1. **备份翻译文件**：\n   ```bash\n   cp -r .config/quickshell/translations .config/quickshell/translations.backup\n   ```\n\n2. **清理无用键**：\n   ```bash\n   ./manage-translations.sh clean\n   ```\n\n3. **同步所有语言**：\n   ```bash\n   ./manage-translations.sh sync\n   ```\n\n## 支持的翻译文本格式\n\n工具可以识别以下格式的可翻译文本：\n\n```qml\n// 基本格式\nTranslation.tr(\"Hello, world!\")\nTranslation.tr('Hello, world!')\nTranslation.tr(`Hello, world!`)\n\n// 带换行符\nTranslation.tr(\"Line 1\\nLine 2\")\n\n// 带转义字符\nTranslation.tr(\"Say \\\"Hello\\\"\")\n\n// 带参数占位符\nTranslation.tr(\"Hello, %1!\").arg(name)\n```\n\n## 示例输出\n\n### 状态显示\n```\n$ ./manage-translations.sh status\n正在分析翻译状态...\n=== 当前项目状态 ===\n提取到 166 个可翻译文本\n\n=== 翻译文件状态 ===\n  en_US: 470 个键\n  zh_CN: 470 个键\n```\n\n### 更新翻译\n```\n$ ./manage-translations.sh update -l zh_CN\n更新翻译文件...\n==================================================\n处理语言: zh_CN\n==================================================\n分析结果:\n  缺少的键: 5\n  多余的键: 20\n\n发现 5 个缺少的翻译键：\n1. \"New feature text\"\n2. \"Another new text\"\n...\n\n是否添加这 5 个缺少的键？ (y/n): y\n已添加 5 个键\n\n发现 20 个多余的翻译键：\n1. \"Removed old text\" -> \"已删除的旧文本\"\n...\n\n是否删除这 20 个多余的键？ (y/n): y\n已删除 20 个键\n\n已保存翻译文件\n```\n\n### 清理无用键\n```\n$ ./manage-translations.sh clean\n清理不再使用的翻译键...\n处理语言: zh_CN\n发现 50 个不再使用的键:\n  1. \"old_unused_text\"\n  2. \"deprecated_message\"\n  ...\n\n是否删除这 50 个不再使用的键？ (y/n): y\n已删除 50 个键\n原始键数: 470, 清理后: 420\n```\n\n## 高级功能\n\n### 自定义目录结构\n\n```bash\n# 使用自定义目录\n./translation-manager.py \\\n  --translations-dir /path/to/translations \\\n  --source-dir /path/to/source\n```\n\n\n## 注意事项\n\n1. **备份重要**：在执行清理操作前，工具会自动创建备份，但建议手动备份重要文件\n\n2. **文本提取限制**：\n   - ~~只支持静态字符串，不支持动态构建的字符串~~\n   - 动态资源（如变量拼接、运行时生成的文本）无法自动提取，需要在翻译文件中手动添加，并使用 `/*keep*/` 标记进行忽略管理。\n   - 必须使用 `Translation.tr()` 格式\n### 忽略标记功能\n\n对于动态资源或特殊文本，如果不希望被自动清理，可在翻译值末尾添加 `/*keep*/`，工具会自动忽略这些键，不会在清理和同步时删除。\n\n示例：\n```json\n{\n  \"dynamic_key\": \"Some dynamic value /*keep*/\"\n}\n```\n\n3. **文件编码**：所有文件必须使用 UTF-8 编码\n\n4. **键名规范**：建议使用英文作为键名，避免使用特殊字符\n\n## 故障排除\n\n### 常见问题\n\n\n**Q: 添加了 Translation.tr 后文字不显示？**\nA: 需要在 QML 文件中使用 `import \"root:/\"` 导入翻译功能，否则无法正常显示翻译文本。\n\n**Q: 提取的文本数量与预期不符？**\nA: 检查是否所有可翻译文本都使用了 `Translation.tr()` 格式，确保没有动态构建的字符串。\n\n**Q: 同步后某些翻译丢失？**\nA: 检查源语言文件是否包含所有必要的键，考虑使用不同的源语言进行同步。\n\n**Q: 清理操作删除了需要的键？**\nA: 从自动创建的备份文件中恢复，检查源代码中是否正确使用了 `Translation.tr()`。\n\n### 恢复备份\n\n```bash\n# 恢复单个文件\ncp .config/quickshell/translations/zh_CN.json.backup .config/quickshell/translations/zh_CN.json\n\n# 恢复所有文件\ncp .config/quickshell/translations.backup/* .config/quickshell/translations/\n```\n\n<!-- File: dots/.config/quickshell/ii/translations/tools/guide/translation-tools-guide.md (Tokens: ~1654 | Category: anthropic-skill) -->\n# Translation Management Tool Suite\n\nThis suite is used to manage project translation files, automatically extract translatable texts, compare differences between language files, and provide maintenance functions.\n\n## Tool Components\n\n### 1. `translation-manager.py` - Main Translation Manager\n- Extract translatable texts\n- Compare and update translation files\n- Interactive addition/removal of translation keys\n\n### 2. `translation-cleaner.py` - Translation File Maintenance Tool\n- Clean unused translation keys\n- Synchronize key structure across different language files\n\n### 3. `manage-translations.sh` - Convenient Wrapper Script\n- Provides a unified command-line interface\n- Displays translation status\n- Simplifies common operations\n\n## Quick Start\n\n### Using the Wrapper Script (Recommended)\n\n```bash\n# Enter the tools directory\ncd .config/quickshell/translations/tools\n\n# Show help\n./manage-translations.sh --help\n\n# Show current translation status\n./manage-translations.sh status\n\n# Extract translatable texts\n./manage-translations.sh extract\n\n# Update all translation files\n./manage-translations.sh update\n\n# Update a specific language\n./manage-translations.sh update -l zh_CN\n\n# Clean unused keys\n./manage-translations.sh clean\n\n# Synchronize keys across all language files\n./manage-translations.sh sync\n```\n\nOr run from the project root:\n```bash\n# Run from the project root\n.config/quickshell/translations/tools/manage-translations.sh status\n.config/quickshell/translations/tools/manage-translations.sh update\n```\n\n## Detailed Usage\n\n### Translation Manager (`translation-manager.py`)\n\nBasic usage:\n```bash\n# Process all languages\n./translation-manager.py\n\n# Specify a particular language\n./translation-manager.py --language zh_CN\n\n# Extract translatable texts only\n./translation-manager.py --extract-only\n\n# Show extracted texts\n./translation-manager.py --extract-only --show-temp\n```\n\nParameter description:\n- `--translations-dir`, `-t`: Translation files directory (default: `.config/quickshell/translations`)\n- `--source-dir`, `-s`: Source code directory (default: `.config/quickshell`)\n- `--language`, `-l`: Specify the language code to process\n- `--extract-only`, `-e`: Only extract translatable texts\n- `--show-temp`: Show the content of the temporary extraction file\n\n### Translation Cleaner (`translation-cleaner.py`)\n\n```bash\n# Clean unused translation keys\n./translation-cleaner.py --clean\n\n# Synchronize translation keys (using en_US as the base)\n./translation-cleaner.py --sync\n\n# Specify a different source language for syncing\n./translation-cleaner.py --sync --source-lang zh_CN\n\n# Clean without creating backups\n./translation-cleaner.py --clean --no-backup\n```\n\n## Workflow\n\n### Regular Translation Update Workflow\n\n1. **Check status**:\n   ```bash\n   ./manage-translations.sh status\n   ```\n\n2. **Update translations**:\n   ```bash\n   ./manage-translations.sh update\n   ```\n\n3. **Clean unused keys** (optional):\n   ```bash\n   ./manage-translations.sh clean\n   ```\n\n### Adding a New Language\n\n1. **Create a new language file**:\n   ```bash\n   ./manage-translations.sh update -l new_lang\n   ```\n\n2. **Synchronize key structure**:\n   ```bash\n   ./manage-translations.sh sync\n   ```\n\n### Cleanup After Large Refactoring\n\n1. **Backup translation files**:\n   ```bash\n   cp -r .config/quickshell/translations .config/quickshell/translations.backup\n   ```\n\n2. **Clean unused keys**:\n   ```bash\n   ./manage-translations.sh clean\n   ```\n\n3. **Synchronize all languages**:\n   ```bash\n   ./manage-translations.sh sync\n   ```\n\n## Supported Translatable Text Formats\n\nThe tool recognizes the following formats for translatable texts:\n\n```qml\n// Basic format\nTranslation.tr(\"Hello, world!\")\nTranslation.tr('Hello, world!')\nTranslation.tr(`Hello, world!`)\n\n// With line breaks\nTranslation.tr(\"Line 1\\nLine 2\")\n\n// With escape characters\nTranslation.tr(\"Say \\\"Hello\\\"\")\n\n// With parameter placeholders\nTranslation.tr(\"Hello, %1!\").arg(name)\n```\n\n## Example Output\n\n### Status Display\n```\n$ ./manage-translations.sh status\nAnalyzing translation status...\n=== Current Project Status ===\n166 translatable texts extracted\n\n=== Translation File Status ===\n  en_US: 470 keys\n  zh_CN: 470 keys\n```\n\n### Update Translations\n```\n$ ./manage-translations.sh update -l zh_CN\nUpdating translation files...\n==================================================\nProcessing language: zh_CN\n==================================================\nAnalysis result:\n  Missing keys: 5\n  Extra keys: 20\n\nFound 5 missing translation keys:\n1. \"New feature text\"\n2. \"Another new text\"\n...\n\nAdd these 5 missing keys? (y/n): y\n5 keys added\n\nFound 20 extra translation keys:\n1. \"Removed old text\" -> \"已删除的旧文本\"\n...\n\nDelete these 20 extra keys? (y/n): y\n20 keys deleted\n\nTranslation file saved\n```\n\n### Clean Unused Keys\n```\n$ ./manage-translations.sh clean\nCleaning unused translation keys...\nProcessing language: zh_CN\nFound 50 unused keys:\n  1. \"old_unused_text\"\n  2. \"deprecated_message\"\n  ...\n\nDelete these 50 unused keys? (y/n): y\n50 keys deleted\nOriginal key count: 470, after cleaning: 420\n```\n\n## Advanced Features\n\n### Custom Directory Structure\n\n```bash\n# Use custom directories\n./translation-manager.py \\\n  --translations-dir /path/to/translations \\\n  --source-dir /path/to/source\n```\n\n### Ignore Mark Feature\n\nFor dynamic resources or special texts that should not be automatically cleaned, you can add `/*keep*/` at the end of the translation value. The tool will automatically ignore these keys and will not delete them during cleaning or syncing.\n\nExample:\n```json\n{\n  \"dynamic_key\": \"Some dynamic value /*keep*/\"\n}\n```\n\n## Notes\n\n1. **Backup is important**: The tool automatically creates backups before cleaning, but it is recommended to manually back up important files\n\n2. **Text extraction limitations**:\n   - ~~Only supports static strings, not dynamically constructed strings~~\n   - Dynamic resources (such as variable concatenation or runtime-generated text) cannot be automatically extracted. You need to manually add them to the translation file and use the `/*keep*/` mark for ignore management.\n   - Must use the `Translation.tr()` format\n\n3. **File encoding**: All files must use UTF-8 encoding\n\n4. **Key naming conventions**: It is recommended to use English for key names and avoid special characters\n\n## Troubleshooting\n\n### Common Issues\n\n**Q: Text does not appear after adding Translation.tr?**\nA: You need to import the translation feature in your QML file using `import \"root:/\"`, otherwise the translation text will not be displayed correctly.\n\n**Q: The number of extracted texts does not match expectations?**\nA: Check whether all translatable texts use the `Translation.tr()` format and ensure there are no dynamically constructed strings.\n\n**Q: Some translations are missing after syncing?**\nA: Check whether the source language file contains all necessary keys, and consider using a different source language for syncing.\n\n**Q: The cleaning operation deleted needed keys?**\nA: Restore from the automatically created backup file and check whether `Translation.tr()` is used correctly in the source code.\n\n### Restore Backup\n\n```bash\n# Restore a single file\ncp .config/quickshell/translations/zh_CN.json.backup .config/quickshell/translations/zh_CN.json\n\n# Restore all files\ncp .config/quickshell/translations.backup/* .config/quickshell/translations/\n```\n\n<!-- File: dots/.config/quickshell/ii/translations/tools/README.md (Tokens: ~1654 | Category: plugin-manifest) -->\n# Translation Management Tool Suite\n\nThis suite is used to manage project translation files, automatically extract translatable texts, compare differences between language files, and provide maintenance functions.\n\n## Tool Components\n\n### 1. `translation-manager.py` - Main Translation Manager\n- Extract translatable texts\n- Compare and update translation files\n- Interactive addition/removal of translation keys\n\n### 2. `translation-cleaner.py` - Translation File Maintenance Tool\n- Clean unused translation keys\n- Synchronize key structure across different language files\n\n### 3. `manage-translations.sh` - Convenient Wrapper Script\n- Provides a unified command-line interface\n- Displays translation status\n- Simplifies common operations\n\n## Quick Start\n\n### Using the Wrapper Script (Recommended)\n\n```bash\n# Enter the tools directory\ncd .config/quickshell/translations/tools\n\n# Show help\n./manage-translations.sh --help\n\n# Show current translation status\n./manage-translations.sh status\n\n# Extract translatable texts\n./manage-translations.sh extract\n\n# Update all translation files\n./manage-translations.sh update\n\n# Update a specific language\n./manage-translations.sh update -l zh_CN\n\n# Clean unused keys\n./manage-translations.sh clean\n\n# Synchronize keys across all language files\n./manage-translations.sh sync\n```\n\nOr run from the project root:\n```bash\n# Run from the project root\n.config/quickshell/translations/tools/manage-translations.sh status\n.config/quickshell/translations/tools/manage-translations.sh update\n```\n\n## Detailed Usage\n\n### Translation Manager (`translation-manager.py`)\n\nBasic usage:\n```bash\n# Process all languages\n./translation-manager.py\n\n# Specify a particular language\n./translation-manager.py --language zh_CN\n\n# Extract translatable texts only\n./translation-manager.py --extract-only\n\n# Show extracted texts\n./translation-manager.py --extract-only --show-temp\n```\n\nParameter description:\n- `--translations-dir`, `-t`: Translation files directory (default: `.config/quickshell/translations`)\n- `--source-dir`, `-s`: Source code directory (default: `.config/quickshell`)\n- `--language`, `-l`: Specify the language code to process\n- `--extract-only`, `-e`: Only extract translatable texts\n- `--show-temp`: Show the content of the temporary extraction file\n\n### Translation Cleaner (`translation-cleaner.py`)\n\n```bash\n# Clean unused translation keys\n./translation-cleaner.py --clean\n\n# Synchronize translation keys (using en_US as the base)\n./translation-cleaner.py --sync\n\n# Specify a different source language for syncing\n./translation-cleaner.py --sync --source-lang zh_CN\n\n# Clean without creating backups\n./translation-cleaner.py --clean --no-backup\n```\n\n## Workflow\n\n### Regular Translation Update Workflow\n\n1. **Check status**:\n   ```bash\n   ./manage-translations.sh status\n   ```\n\n2. **Update translations**:\n   ```bash\n   ./manage-translations.sh update\n   ```\n\n3. **Clean unused keys** (optional):\n   ```bash\n   ./manage-translations.sh clean\n   ```\n\n### Adding a New Language\n\n1. **Create a new language file**:\n   ```bash\n   ./manage-translations.sh update -l new_lang\n   ```\n\n2. **Synchronize key structure**:\n   ```bash\n   ./manage-translations.sh sync\n   ```\n\n### Cleanup After Large Refactoring\n\n1. **Backup translation files**:\n   ```bash\n   cp -r .config/quickshell/translations .config/quickshell/translations.backup\n   ```\n\n2. **Clean unused keys**:\n   ```bash\n   ./manage-translations.sh clean\n   ```\n\n3. **Synchronize all languages**:\n   ```bash\n   ./manage-translations.sh sync\n   ```\n\n## Supported Translatable Text Formats\n\nThe tool recognizes the following formats for translatable texts:\n\n```qml\n// Basic format\nTranslation.tr(\"Hello, world!\")\nTranslation.tr('Hello, world!')\nTranslation.tr(`Hello, world!`)\n\n// With line breaks\nTranslation.tr(\"Line 1\\nLine 2\")\n\n// With escape characters\nTranslation.tr(\"Say \\\"Hello\\\"\")\n\n// With parameter placeholders\nTranslation.tr(\"Hello, %1!\").arg(name)\n```\n\n## Example Output\n\n### Status Display\n```\n$ ./manage-translations.sh status\nAnalyzing translation status...\n=== Current Project Status ===\n166 translatable texts extracted\n\n=== Translation File Status ===\n  en_US: 470 keys\n  zh_CN: 470 keys\n```\n\n### Update Translations\n```\n$ ./manage-translations.sh update -l zh_CN\nUpdating translation files...\n==================================================\nProcessing language: zh_CN\n==================================================\nAnalysis result:\n  Missing keys: 5\n  Extra keys: 20\n\nFound 5 missing translation keys:\n1. \"New feature text\"\n2. \"Another new text\"\n...\n\nAdd these 5 missing keys? (y/n): y\n5 keys added\n\nFound 20 extra translation keys:\n1. \"Removed old text\" -> \"已删除的旧文本\"\n...\n\nDelete these 20 extra keys? (y/n): y\n20 keys deleted\n\nTranslation file saved\n```\n\n### Clean Unused Keys\n```\n$ ./manage-translations.sh clean\nCleaning unused translation keys...\nProcessing language: zh_CN\nFound 50 unused keys:\n  1. \"old_unused_text\"\n  2. \"deprecated_message\"\n  ...\n\nDelete these 50 unused keys? (y/n): y\n50 keys deleted\nOriginal key count: 470, after cleaning: 420\n```\n\n## Advanced Features\n\n### Custom Directory Structure\n\n```bash\n# Use custom directories\n./translation-manager.py \\\n  --translations-dir /path/to/translations \\\n  --source-dir /path/to/source\n```\n\n### Ignore Mark Feature\n\nFor dynamic resources or special texts that should not be automatically cleaned, you can add `/*keep*/` at the end of the translation value. The tool will automatically ignore these keys and will not delete them during cleaning or syncing.\n\nExample:\n```json\n{\n  \"dynamic_key\": \"Some dynamic value /*keep*/\"\n}\n```\n\n## Notes\n\n1. **Backup is important**: The tool automatically creates backups before cleaning, but it is recommended to manually back up important files\n\n2. **Text extraction limitations**:\n   - ~~Only supports static strings, not dynamically constructed strings~~\n   - Dynamic resources (such as variable concatenation or runtime-generated text) cannot be automatically extracted. You need to manually add them to the translation file and use the `/*keep*/` mark for ignore management.\n   - Must use the `Translation.tr()` format\n\n3. **File encoding**: All files must use UTF-8 encoding\n\n4. **Key naming conventions**: It is recommended to use English for key names and avoid special characters\n\n## Troubleshooting\n\n### Common Issues\n\n**Q: Text does not appear after adding Translation.tr?**\nA: You need to import the translation feature in your QML file using `import \"root:/\"`, otherwise the translation text will not be displayed correctly.\n\n**Q: The number of extracted texts does not match expectations?**\nA: Check whether all translatable texts use the `Translation.tr()` format and ensure there are no dynamically constructed strings.\n\n**Q: Some translations are missing after syncing?**\nA: Check whether the source language file contains all necessary keys, and consider using a different source language for syncing.\n\n**Q: The cleaning operation deleted needed keys?**\nA: Restore from the automatically created backup file and check whether `Translation.tr()` is used correctly in the source code.\n\n### Restore Backup\n\n```bash\n# Restore a single file\ncp .config/quickshell/translations/zh_CN.json.backup .config/quickshell/translations/zh_CN.json\n\n# Restore all files\ncp .config/quickshell/translations.backup/* .config/quickshell/translations/\n```\n</yakaai_skills>"}