国际化(i18n)MCP服务器
一种模型上下文协议(MCP)服务器,为国际化(i18n)翻译任务提供工具。
概述
此服务器提供用于管理Kilo Code扩展使用的JSON翻译文件中的翻译的工具。它遵循MCP协议,通过stdio(标准输入/输出)与扩展进行交互。
该服务器设计为模块化,允许您独立于其他实验工具运行i18n工具。
i18n工具
此服务器提供以下国际化MCP工具:
translate_i18n_key-将一个或多个特定按键从英语翻译成其他语言move_i18n_key-在所有语言环境中将密钥从一个JSON文件移动到另一个list_locales-列出所有可用的语言环境remove_i18n_keys-从所有语言的所有区域设置文件中删除指定的键
设置
要将i18n MCP服务器与AI助手一起使用,您需要在全局MCP配置中对其进行配置。将以下内容添加到您的配置中:
{
"mcpServers": {
"kilo-dev-mcp-server": {
"type": "stdio",
"command": "/bin/bash",
"args": [
"-c",
"cd /path/to/kilo-dev-mcp-server && npm run mcp:i18n"
],
"env": {
"OPENROUTER_API_KEY": "${env:OPENROUTER_API_KEY}"
},
"timeout": 3600,
"alwaysAllow": [
"translate_i18n_key",
"list_locales",
"remove_i18n_keys",
"move_i18n_key"
],
"disabled": false
}
}
}确保更换 /path/to/kilo-dev-mcp-server 带有kilo-dev-mcp服务器目录的实际路径。
配置
服务器需要OpenRouter API密钥才能实现翻译功能:
OPENROUTER_API_KEY-OpenRouter服务的API密钥(翻译时需要)DEFAULT_MODEL-用于翻译的默认模型(默认为“anthropic/claude-3.7onnet”)
您可以在您的环境或 .env.local 文件。
如何使用
设置完MCP服务器配置后,只需提示您的AI助手即可使用i18n工具。AI将根据您的请求自动使用适当的工具。
示例提示
以下是一些如何提示AI使用i18n工具的示例:
翻译密钥
Please translate the "welcome.message" key in the common.json to all other supported languages.AI将自动:
- 确定这是一个翻译请求
- 确定它是针对“核心”目标的
- 使用translate_i18n_key工具执行翻译
列出可用的本地
What locales are currently supported in our project's webview UI?AI将使用list_locales工具显示webview UI的所有可用区域设置。
在文件之间移动密钥
Please move the "errorMessages.notFound" key from errors.json to common.json in the package locales.AI将使用move_i18n_key工具在所有区域设置文件中移动密钥。
删除过时的密钥
Please remove the obsolete keys "oldFeature.title" and "oldFeature.description" from the features.json file in the core locales.AI将使用remove_i18n_keys工具从所有区域设置文件中删除这些键。
开发者文档
对于需要设置、修改或贡献此项目的开发人员,请参阅 开发者指南.
许可证
此项目根据MIT许可证获得许可-有关详细信息,请参阅许可证文件。
