mirror of
https://github.com/msitarzewski/agency-agents
synced 2026-04-25 11:18:05 +00:00
feat(i18n): add Chinese (zh-CN) localization for agent names (#338)
Adds Chinese (zh-CN) localization tooling: agent-names-zh.json translation map (130+ entries) and localize-agents-zh.ps1 PowerShell script for localizing agent names in Copilot agent picker.
This commit is contained in:
parent
4eba68d5ee
commit
64eee9f8e0
63
scripts/i18n/README.md
Normal file
63
scripts/i18n/README.md
Normal file
@ -0,0 +1,63 @@
|
||||
# 🇨🇳 Chinese (zh-CN) Localization
|
||||
|
||||
Localize agent `name` and `description` fields in YAML frontmatter to Simplified Chinese. This makes agent names readable in Copilot Chat's agent picker for Chinese-speaking users.
|
||||
|
||||
## Files
|
||||
|
||||
| File | Description |
|
||||
|------|-------------|
|
||||
| `agent-names-zh.json` | Mapping of English agent names → Chinese translations (130+ entries) |
|
||||
| `localize-agents-zh.ps1` | PowerShell script that reads the JSON and updates installed agent files |
|
||||
|
||||
## Usage
|
||||
|
||||
After installing agents with `install.sh --tool copilot`:
|
||||
|
||||
```powershell
|
||||
# Localize agent names to Chinese
|
||||
powershell -ExecutionPolicy Bypass -File scripts/i18n/localize-agents-zh.ps1
|
||||
```
|
||||
|
||||
By default, the script processes:
|
||||
- `%USERPROFILE%\.github\agents\`
|
||||
- `%USERPROFILE%\.copilot\agents\`
|
||||
|
||||
Pass custom paths if needed:
|
||||
|
||||
```powershell
|
||||
powershell -File scripts/i18n/localize-agents-zh.ps1 -TargetDirs @("C:\custom\path\agents")
|
||||
```
|
||||
|
||||
## How It Works
|
||||
|
||||
1. Reads `agent-names-zh.json` (UTF-8 encoded) for the translation map
|
||||
2. For each `.md` file in the target directories:
|
||||
- Extracts the `name:` field from YAML frontmatter
|
||||
- Looks up the Chinese translation
|
||||
- Replaces `name:` and `description:` fields
|
||||
- Writes back as UTF-8
|
||||
|
||||
## Result
|
||||
|
||||
Before:
|
||||
```yaml
|
||||
---
|
||||
name: Security Engineer
|
||||
description: Threat modeling, secure code review, security architecture
|
||||
---
|
||||
```
|
||||
|
||||
After:
|
||||
```yaml
|
||||
---
|
||||
name: 安全工程师
|
||||
description: 威胁建模、安全代码审查与应用安全架构专家
|
||||
---
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- Only modifies **installed copies** (in `~/.github/agents/`), not source files
|
||||
- Re-run after each `install.sh` update (which overwrites with English originals)
|
||||
- JSON file is the single source of truth for translations — add new agents there
|
||||
- Script is pure ASCII (avoids PowerShell encoding issues); all Chinese text lives in the JSON
|
||||
154
scripts/i18n/agent-names-zh.json
Normal file
154
scripts/i18n/agent-names-zh.json
Normal file
@ -0,0 +1,154 @@
|
||||
{
|
||||
"Frontend Developer": { "name": "前端开发工程师", "description": "专注现代 Web 技术、React/Vue/Angular 框架、UI 实现与性能优化的前端专家" },
|
||||
"Backend Architect": { "name": "后端架构师", "description": "负责 API 设计、数据库架构与可扩展性的后端系统专家" },
|
||||
"Mobile App Builder": { "name": "移动端开发工程师", "description": "iOS/Android、React Native、Flutter 跨平台移动应用构建者" },
|
||||
"AI Engineer": { "name": "AI 工程师", "description": "机器学习模型部署、AI 集成与数据管道专家" },
|
||||
"DevOps Automator": { "name": "DevOps 自动化工程师", "description": "CI/CD、基础设施自动化与云运营专家" },
|
||||
"Rapid Prototyper": { "name": "快速原型工程师", "description": "快速 POC 开发、MVP 与迭代验证专家" },
|
||||
"Senior Developer": { "name": "高级开发工程师", "description": "Laravel/Livewire、复杂模式与架构决策专家" },
|
||||
"Security Engineer": { "name": "安全工程师", "description": "威胁建模、安全代码审查与应用安全架构专家" },
|
||||
"Autonomous Optimization Architect": { "name": "自主优化架构师", "description": "LLM 路由、成本优化与影子测试专家" },
|
||||
"Embedded Firmware Engineer": { "name": "嵌入式固件工程师", "description": "裸金属、RTOS、ESP32/STM32/Nordic 固件开发专家" },
|
||||
"Incident Response Commander":{ "name": "故障响应指挥官", "description": "事件管理、故障复盘与值班应急专家" },
|
||||
"Solidity Smart Contract Engineer": { "name": "Solidity 智能合约工程师", "description": "EVM 合约、Gas 优化与 DeFi 协议专家" },
|
||||
"Technical Writer": { "name": "技术文档工程师", "description": "开发者文档、API 参考手册与教程撰写专家" },
|
||||
"Threat Detection Engineer": { "name": "威胁检测工程师", "description": "SIEM 规则、威胁狩猎与 ATT&CK 映射专家" },
|
||||
"WeChat Mini Program Developer": { "name": "微信小程序开发工程师", "description": "微信生态、小程序与支付集成开发专家" },
|
||||
"Code Reviewer": { "name": "代码审查工程师", "description": "建设性代码审查、安全与可维护性评估专家" },
|
||||
"Database Optimizer": { "name": "数据库优化工程师", "description": "Schema 设计、查询优化与索引策略专家(PostgreSQL/MySQL)" },
|
||||
"Git Workflow Master": { "name": "Git 工作流专家", "description": "分支策略、规范提交与高级 Git 操作专家" },
|
||||
"Software Architect": { "name": "软件架构师", "description": "系统设计、DDD、架构模式与权衡分析专家" },
|
||||
"SRE": { "name": "站点可靠性工程师", "description": "SLO、错误预算、可观测性与混沌工程专家" },
|
||||
"AI Data Remediation Engineer": { "name": "AI 数据修复工程师", "description": "自愈数据管道、离线 SLM 与语义聚类专家" },
|
||||
"Data Engineer": { "name": "数据工程师", "description": "数据管道、湖仓架构与 ETL/ELT 专家" },
|
||||
"Feishu Integration Developer": { "name": "飞书集成开发工程师", "description": "飞书/Lark 开放平台、机器人与工作流集成专家" },
|
||||
"UI Designer": { "name": "UI 设计师", "description": "视觉设计、组件库与设计系统专家" },
|
||||
"UX Researcher": { "name": "用户体验研究员", "description": "用户测试、行为分析与可用性研究专家" },
|
||||
"UX Architect": { "name": "用户体验架构师", "description": "技术架构、CSS 系统与前端实现指导专家" },
|
||||
"Brand Guardian": { "name": "品牌守护者", "description": "品牌认知、一致性与品牌定位专家" },
|
||||
"Visual Storyteller": { "name": "视觉叙事师", "description": "视觉叙事、多媒体内容与品牌故事专家" },
|
||||
"Whimsy Injector": { "name": "创意注入师", "description": "品牌个性、微互动与趣味体验设计专家" },
|
||||
"Image Prompt Engineer": { "name": "图像提示词工程师", "description": "AI 图像生成提示词、摄影风格指令专家" },
|
||||
"Inclusive Visuals Specialist": { "name": "包容性视觉专家", "description": "多元化呈现、偏见消除与真实 AI 图像生成专家" },
|
||||
"Growth Hacker": { "name": "增长黑客", "description": "快速用户获取、病毒循环与实验驱动增长专家" },
|
||||
"Content Creator": { "name": "内容创作者", "description": "多平台内容策略、编辑日历与文案专家" },
|
||||
"Twitter Engager": { "name": "Twitter 运营专家", "description": "实时互动、思想领导力与推特策略专家" },
|
||||
"TikTok Strategist": { "name": "TikTok 策略专家", "description": "病毒内容、算法优化与 TikTok 增长专家" },
|
||||
"Instagram Curator": { "name": "Instagram 运营专家", "description": "视觉叙事、社区运营与 Instagram 策略专家" },
|
||||
"Reddit Community Builder": { "name": "Reddit 社区运营", "description": "真实互动、价值内容与 Reddit 营销专家" },
|
||||
"App Store Optimizer": { "name": "应用商店优化专家", "description": "ASO、转化率优化与应用曝光专家" },
|
||||
"Social Media Strategist": { "name": "社交媒体策略师", "description": "跨平台策略、营销活动与社媒整体规划专家" },
|
||||
"Xiaohongshu Specialist": { "name": "小红书运营专家", "description": "生活方式内容、趋势策略与小红书增长专家" },
|
||||
"WeChat Official Account Manager": { "name": "微信公众号运营专家", "description": "粉丝互动、内容营销与微信公众号策略专家" },
|
||||
"Zhihu Strategist": { "name": "知乎运营专家", "description": "思想领导力、知识驱动互动与知乎权威建立专家" },
|
||||
"Baidu SEO Specialist": { "name": "百度 SEO 专家", "description": "百度优化、中国 SEO 与 ICP 合规专家" },
|
||||
"Bilibili Content Strategist": { "name": "Bilibili 内容策略师", "description": "B站算法、弹幕文化与 UP 主成长专家" },
|
||||
"Carousel Growth Engine": { "name": "轮播图增长引擎", "description": "TikTok/Instagram 轮播图创作与自动发布专家" },
|
||||
"LinkedIn Content Creator": { "name": "领英内容创作者", "description": "个人品牌、思想领导力与领英专业内容专家" },
|
||||
"China E-Commerce Operator": { "name": "中国电商运营专家", "description": "淘宝/天猫/拼多多与直播电商运营专家" },
|
||||
"Kuaishou Strategist": { "name": "快手运营策略师", "description": "快手平台、老铁生态与下沉市场增长专家" },
|
||||
"SEO Specialist": { "name": "SEO 专家", "description": "技术 SEO、内容策略与外链建设专家" },
|
||||
"Book Co-Author": { "name": "图书联合作者", "description": "思想领导力书籍、代笔写作与出版策略专家" },
|
||||
"Cross-Border E-Commerce Specialist": { "name": "跨境电商专家", "description": "亚马逊/Shopee/Lazada 与跨境履约全链路专家" },
|
||||
"Douyin Strategist": { "name": "抖音运营策略师", "description": "抖音平台、短视频营销与算法增长专家" },
|
||||
"Livestream Commerce Coach": { "name": "直播带货教练", "description": "主播培训、直播间优化与转化提升专家" },
|
||||
"Podcast Strategist": { "name": "播客策略师", "description": "播客内容策略与平台运营专家" },
|
||||
"Private Domain Operator": { "name": "私域运营专家", "description": "企业微信、私域流量与社群运营专家" },
|
||||
"Short-Video Editing Coach": { "name": "短视频剪辑教练", "description": "后期制作、剪辑流程与平台规格优化专家" },
|
||||
"Weibo Strategist": { "name": "微博运营策略师", "description": "微博热搜、话题营销与粉丝互动专家" },
|
||||
"AI Citation Strategist": { "name": "AI 引用策略师", "description": "AEO/GEO、AI 推荐可见度与引用审计专家" },
|
||||
"Outbound Strategist": { "name": "外呼销售策略师", "description": "基于信号的精准找客、多渠道序列与 ICP 定位专家" },
|
||||
"Discovery Coach": { "name": "销售发现教练", "description": "SPIN、Gap Selling 与 Sandler 问题设计专家" },
|
||||
"Deal Strategist": { "name": "商机策略师", "description": "MEDDPICC 资格认定、竞争定位与赢单策略专家" },
|
||||
"Sales Engineer": { "name": "售前工程师", "description": "技术演示、POC 范围确定与竞争技术定位专家" },
|
||||
"Proposal Strategist": { "name": "提案策略师", "description": "RFP 响应、赢单主题与叙事结构专家" },
|
||||
"Pipeline Analyst": { "name": "销售漏斗分析师", "description": "预测、漏斗健康度、商机速度与 RevOps 专家" },
|
||||
"Account Strategist": { "name": "客户策略师", "description": "拓客留存、QBR 与利益相关者地图专家" },
|
||||
"Sales Coach": { "name": "销售教练", "description": "销售代表成长、通话辅导与管道审查促进专家" },
|
||||
"PPC Campaign Strategist": { "name": "竞价广告策略师", "description": "Google/Microsoft/Amazon 广告、账户结构与出价专家" },
|
||||
"Search Query Analyst": { "name": "搜索词分析师", "description": "搜索词分析、否定关键词与意图映射专家" },
|
||||
"Paid Media Auditor": { "name": "付费媒体审计师", "description": "200+ 维度账户审计与竞争对手分析专家" },
|
||||
"Tracking & Measurement Specialist": { "name": "追踪与埋点专家", "description": "GTM、GA4、转化追踪与 CAPI 实施专家" },
|
||||
"Ad Creative Strategist": { "name": "广告创意策略师", "description": "RSA 文案、Meta 创意与 PMax 素材专家" },
|
||||
"Programmatic & Display Buyer": { "name": "程序化广告购买专家", "description": "GDN、DSP、合作媒体与 ABM 展示广告专家" },
|
||||
"Paid Social Strategist": { "name": "付费社交策略师", "description": "Meta/LinkedIn/TikTok 跨平台付费社交专家" },
|
||||
"Sprint Prioritizer": { "name": "Sprint 优先级规划师", "description": "敏捷规划、功能优先级与 Sprint 管理专家" },
|
||||
"Trend Researcher": { "name": "市场趋势研究员", "description": "市场情报、竞品分析与机会识别专家" },
|
||||
"Feedback Synthesizer": { "name": "用户反馈综合分析师", "description": "用户反馈分析、洞察提取与产品优先级专家" },
|
||||
"Behavioral Nudge Engine": { "name": "行为助推引擎", "description": "行为心理学、助推设计与用户激励专家" },
|
||||
"Product Manager": { "name": "产品经理", "description": "全生命周期产品管理:发现、PRD、路线图、GTM" },
|
||||
"Studio Producer": { "name": "工作室制作人", "description": "高层编排、投资组合管理与多项目监督专家" },
|
||||
"Project Shepherd": { "name": "项目协调专家", "description": "跨职能协调、时间轴管理与端到端项目统筹专家" },
|
||||
"Studio Operations": { "name": "工作室运营专家", "description": "日常效率优化、流程改进与生产支持专家" },
|
||||
"Experiment Tracker": { "name": "实验追踪专家", "description": "A/B 测试、假设验证与数据驱动决策专家" },
|
||||
"Senior Project Manager": { "name": "高级项目经理", "description": "现实范围评估与规格转任务分解专家" },
|
||||
"Jira Workflow Steward": { "name": "Jira 工作流管理员", "description": "Git 工作流、分支策略与 Jira 关联交付规范专家" },
|
||||
"Evidence Collector": { "name": "测试证据采集员", "description": "截图 QA、视觉验证与 Bug 文档专家" },
|
||||
"Reality Checker": { "name": "生产就绪验证员", "description": "基于证据的认证、质量门与发布认证专家" },
|
||||
"Test Results Analyzer": { "name": "测试结果分析师", "description": "测试评估、质量指标分析与覆盖率报告专家" },
|
||||
"Performance Benchmarker": { "name": "性能基准测试专家", "description": "性能测试、压力测试与速度优化专家" },
|
||||
"API Tester": { "name": "API 测试工程师", "description": "API 验证、集成测试与端点核查专家" },
|
||||
"Tool Evaluator": { "name": "工具评估专家", "description": "技术评估与工具选型专家" },
|
||||
"Workflow Optimizer": { "name": "工作流优化专家", "description": "流程分析、工作流改进与自动化机会挖掘专家" },
|
||||
"Accessibility Auditor": { "name": "无障碍审计师", "description": "WCAG 审计、辅助技术测试与包容性设计专家" },
|
||||
"Support Responder": { "name": "客户支持专员", "description": "客户服务、问题解决与支持运营专家" },
|
||||
"Analytics Reporter": { "name": "数据分析报告员", "description": "数据分析、仪表板与业务洞察专家" },
|
||||
"Finance Tracker": { "name": "财务追踪专员", "description": "财务规划、预算管理与业务绩效分析专家" },
|
||||
"Infrastructure Maintainer": { "name": "基础设施维护工程师", "description": "系统可靠性、性能优化与基础设施运营专家" },
|
||||
"Legal Compliance Checker": { "name": "法律合规检查员", "description": "合规审查、监管要求与风险管理专家" },
|
||||
"Executive Summary Generator": { "name": "高管摘要生成师", "description": "C 级沟通、战略摘要与决策支持专家" },
|
||||
"XR Interface Architect": { "name": "XR 界面架构师", "description": "空间交互设计与沉浸式 UX 专家(AR/VR/XR)" },
|
||||
"macOS Spatial/Metal Engineer": { "name": "macOS 空间/Metal 工程师", "description": "Swift、Metal 与高性能 3D macOS 空间计算专家" },
|
||||
"XR Immersive Developer": { "name": "WebXR 沉浸式开发者", "description": "WebXR、浏览器端 AR/VR 沉浸式体验开发专家" },
|
||||
"XR Cockpit Interaction Specialist": { "name": "XR 座舱交互专家", "description": "座舱控制系统与沉浸式控制界面专家" },
|
||||
"visionOS Spatial Engineer": { "name": "visionOS 空间工程师", "description": "Apple Vision Pro 应用与空间计算体验开发专家" },
|
||||
"Terminal Integration Specialist": { "name": "终端集成专家", "description": "终端集成、命令行工具与开发者工作流专家" },
|
||||
"Agents Orchestrator": { "name": "多智能体编排师", "description": "多 Agent 协调、工作流管理与复杂项目统筹专家" },
|
||||
"LSP/Index Engineer": { "name": "语言服务器/索引工程师", "description": "LSP 实现、代码智能与语义索引专家" },
|
||||
"Sales Data Extraction Agent": { "name": "销售数据提取 Agent", "description": "Excel 监控与销售指标提取(MTD/YTD)专家" },
|
||||
"Data Consolidation Agent": { "name": "数据整合 Agent", "description": "销售数据聚合与仪表板报告专家" },
|
||||
"Report Distribution Agent": { "name": "报告分发 Agent", "description": "自动化报告交付与按区域定时发送专家" },
|
||||
"Agentic Identity & Trust Architect": { "name": "智能体身份与信任架构师", "description": "Agent 身份、认证与信任验证专家" },
|
||||
"Identity Graph Operator": { "name": "身份图谱运营专家", "description": "多 Agent 系统实体去重与身份一致性专家" },
|
||||
"Accounts Payable Agent": { "name": "应付账款 Agent", "description": "支付处理、供应商管理与自主支付专家" },
|
||||
"Blockchain Security Auditor": { "name": "区块链安全审计师", "description": "智能合约审计与漏洞分析专家" },
|
||||
"Compliance Auditor": { "name": "合规审计师", "description": "SOC2/ISO27001/HIPAA/PCI-DSS 合规认证指导专家" },
|
||||
"Cultural Intelligence Strategist": { "name": "文化智能策略师", "description": "全球 UX、多元呈现与文化排斥规避专家" },
|
||||
"Developer Advocate": { "name": "开发者布道师", "description": "社区建设、开发者体验与技术内容创作专家" },
|
||||
"Model QA Specialist": { "name": "模型 QA 专家", "description": "ML 审计、特征分析与可解释性专家" },
|
||||
"ZK Steward": { "name": "知识卡片管理员", "description": "知识管理、Zettelkasten 与笔记系统专家" },
|
||||
"MCP Builder": { "name": "MCP 构建专家", "description": "Model Context Protocol 服务器与 AI Agent 工具链专家" },
|
||||
"Document Generator": { "name": "文档生成专家", "description": "PDF/PPTX/DOCX/XLSX 代码生成与专业文档创建专家" },
|
||||
"Automation Governance Architect": { "name": "自动化治理架构师", "description": "自动化治理、n8n 与工作流审计专家" },
|
||||
"Corporate Training Designer": { "name": "企业培训设计师", "description": "企业培训、课程开发与学习系统设计专家" },
|
||||
"Government Digital Presales Consultant": { "name": "政务数字化售前顾问", "description": "ToG 项目售前与数字政府转型方案专家" },
|
||||
"Healthcare Marketing Compliance": { "name": "医疗营销合规专家", "description": "中国医疗广告法规合规专家" },
|
||||
"Recruitment Specialist": { "name": "招聘专家", "description": "人才获取、招聘运营与雇主品牌专家" },
|
||||
"Study Abroad Advisor": { "name": "留学顾问", "description": "国际教育、申请规划与留学目的地专家(美/英/加/澳)" },
|
||||
"Supply Chain Strategist": { "name": "供应链策略师", "description": "供应链管理、采购策略与优化专家" },
|
||||
"Workflow Architect": { "name": "工作流架构师", "description": "工作流发现、流程映射与规格说明专家" },
|
||||
"Salesforce Architect": { "name": "Salesforce 架构师", "description": "多云 Salesforce 设计、Governor Limits 与集成专家" },
|
||||
"French Consulting Market Navigator": { "name": "法国咨询市场导航师", "description": "ESN/SI 生态与法国 IT 自由职业专家" },
|
||||
"Korean Business Navigator": { "name": "韩国商务导航师", "description": "韩国商业文化、品议流程与人际关系机制专家" },
|
||||
"Academic Anthropologist": { "name": "学术人类学家", "description": "文化研究、田野调查与人类学视角分析专家" },
|
||||
"Anthropologist": { "name": "学术人类学家", "description": "文化研究、田野调查与人类学视角分析专家" },
|
||||
"Academic Geographer": { "name": "学术地理学家", "description": "空间分析、地理信息与地缘研究专家" },
|
||||
"Geographer": { "name": "学术地理学家", "description": "空间分析、地理信息与地缘研究专家" },
|
||||
"Academic Historian": { "name": "学术历史学家", "description": "历史分析、史料解读与历史叙事专家" },
|
||||
"Historian": { "name": "学术历史学家", "description": "历史分析、史料解读与历史叙事专家" },
|
||||
"Academic Narratologist": { "name": "学术叙事学家", "description": "叙事结构、故事理论与文本分析专家" },
|
||||
"Narratologist": { "name": "学术叙事学家", "description": "叙事结构、故事理论与文本分析专家" },
|
||||
"Academic Psychologist": { "name": "学术心理学家", "description": "心理学研究、行为分析与认知科学专家" },
|
||||
"Psychologist": { "name": "学术心理学家", "description": "心理学研究、行为分析与认知科学专家" },
|
||||
"Healthcare Marketing Compliance Specialist": { "name": "医疗营销合规专家", "description": "中国医疗广告法规合规专家" },
|
||||
"SRE (Site Reliability Engineer)": { "name": "站点可靠性工程师", "description": "SLO、错误预算、可观测性与混沌工程专家" },
|
||||
"Game Designer": { "name": "游戏设计师", "description": "系统设计、GDD 写作、经济平衡与玩法循环专家" },
|
||||
"Level Designer": { "name": "关卡设计师", "description": "布局理论、节奏、遭遇设计与环境叙事专家" },
|
||||
"Technical Artist": { "name": "技术美术", "description": "Shader、VFX、LOD 管线与美术到引擎优化专家" },
|
||||
"Game Audio Engineer": { "name": "游戏音频工程师", "description": "FMOD/Wwise、自适应音乐与空间音频专家" },
|
||||
"Narrative Designer": { "name": "叙事设计师", "description": "故事系统、分支对话与世界观架构专家" },
|
||||
"Unity Architect": { "name": "Unity 架构师", "description": "ScriptableObjects、数据驱动模块化与 DOTS/ECS 专家" },
|
||||
"Unity Shader Graph Artist": { "name": "Unity Shader 艺术家", "description": "Shader Graph、HLSL、URP/HDRP 与渲染特性专家" },
|
||||
"Unity Multiplayer Engineer": { "name": "Unity 多人网络工程师", "description": "Netcode for GameObjects、Unity Relay/Lobby 与服务器权威专家" },
|
||||
"Unity Editor Tool Developer": { "name": "Unity 编辑器工具开发者", "description": "EditorWindow、AssetPostprocessor 与构建自动化专家" }
|
||||
}
|
||||
38
scripts/i18n/localize-agents-zh.ps1
Normal file
38
scripts/i18n/localize-agents-zh.ps1
Normal file
@ -0,0 +1,38 @@
|
||||
param(
|
||||
[string[]]$TargetDirs = @(
|
||||
"$env:USERPROFILE\.github\agents",
|
||||
"$env:USERPROFILE\.copilot\agents"
|
||||
)
|
||||
)
|
||||
|
||||
$mapFile = Join-Path $PSScriptRoot "agent-names-zh.json"
|
||||
$map = Get-Content $mapFile -Raw -Encoding UTF8 | ConvertFrom-Json
|
||||
|
||||
$totalUpdated = 0
|
||||
foreach ($dir in $TargetDirs) {
|
||||
if (-not (Test-Path $dir)) { Write-Warning "Skip (not found): $dir"; continue }
|
||||
$files = Get-ChildItem "$dir\*.md" -ErrorAction SilentlyContinue
|
||||
$updated = 0
|
||||
foreach ($f in $files) {
|
||||
$raw = [System.IO.File]::ReadAllText($f.FullName, [System.Text.Encoding]::UTF8)
|
||||
if (-not $raw.StartsWith("---")) { continue }
|
||||
$endIdx = $raw.IndexOf("---", 3)
|
||||
if ($endIdx -lt 0) { continue }
|
||||
$yaml = $raw.Substring(3, $endIdx - 3)
|
||||
if (-not ($yaml -match "(?m)^name:\s*(.+)$")) { continue }
|
||||
$currentName = $Matches[1].Trim()
|
||||
$entry = $map.$currentName
|
||||
if (-not $entry) { continue }
|
||||
$newYaml = $yaml -replace "(?m)^name:\s*.+$", "name: $($entry.name)"
|
||||
if ($newYaml -match "(?m)^description:") {
|
||||
$newYaml = $newYaml -replace "(?m)^description:\s*.+$", "description: $($entry.description)"
|
||||
}
|
||||
$newContent = "---" + $newYaml + "---" + $raw.Substring($endIdx + 3)
|
||||
[System.IO.File]::WriteAllText($f.FullName, $newContent, [System.Text.Encoding]::UTF8)
|
||||
$updated++
|
||||
}
|
||||
Write-Host "OK: $updated agents localized -> $dir"
|
||||
$totalUpdated += $updated
|
||||
}
|
||||
Write-Host "Total: $totalUpdated agent files updated."
|
||||
Write-Host "Reload VS Code window (Ctrl+Shift+P -> Reload Window) to apply."
|
||||
Loading…
x
Reference in New Issue
Block a user