摘要
通过 API v2 使用 Lokalise 翻译管理:带各语言进度的项目、带审校标记的键和翻译、语言、协作者、翻译和审校任务、以后台进程方式导出文件、评论、截图元数据、分支、自定义翻译状态和术语表。
引导式设置
2 分钟将 Lokalise 连接到 Gemini
开始 AnythingMCP Cloud 免费试用,在引导式设置中连接 Lokalise,再把你的 MCP URL 添加到 Gemini。无需代码,也无需自行运行服务器。
无需信用卡 · 7 天试用 · 提供自托管方案
试试这样问
Lokalise 的示例提示
点击任意提示即可复制,然后粘贴到 Claude、ChatGPT、Cursor、Gemini、Copilot 或 OpenClaw 中,在该连接器上运行。
Claude 是 AI,可能会出错。请核对回答。
💡 无需安装? 直接使用 cloud.anythingmcp.com。 登录、点击 Connectors → Lokalise、粘贴凭证、生成 MCP API key,即可完成。无 Docker、无
git clone、无本地服务器。
Lokalise + Gemini
通过 API v2 使用 Lokalise 翻译管理:带各语言进度的项目、带审校标记的键和翻译、语言、协作者、翻译和审校任务、以后台进程方式导出文件、评论、截图元数据、分支、自定义翻译状态和术语表。
前提条件
完整的设置说明已内置在连接器中 (在 store 中选择连接器时可见)。所需环境变量:
LOKALISE_API_TOKEN
步骤 1 — 获取凭证
设置大约需要 2 分钟。你需要一个能访问相关项目的 Lokalise 账户。
- 在 Lokalise 中点击你的头像,打开 Profile settings > API tokens 并生成令牌。只读令牌足以使用读取工具;修改需要读写令牌。
- 把它粘贴到
LOKALISE_API_TOKEN。它通过X-Api-Token请求头发送,在每个项目中以你的权限执行操作。 - 安装连接器并运行
lokalise_list_projects,确认令牌可用。
Lokalise 自己的 MCP 服务器:Lokalise 也提供测试版 MCP 服务器(https://mcp.lokalise.com/mcp/project-management 和 /mcp/software-development,使用 OAuth 或 apikey 请求头)。这个连接器使用 API v2 和你的令牌。
读取的内容:
- 项目,包括类型、基础语言和团队;加上
include_statistics: 1还会返回各语言的进度、键数、词数和 QA 问题。项目语言、Lokalise 支持的所有语言及其 ISO 代码和复数形式,以及自定义翻译状态。 - 键,包括各平台的名称、描述、标签、文件名、上下文、字符限制,加上
include_translations: 1还会返回其文本。筛选条件:键名、标签、文件名、平台、未翻译、QA 问题或已归档。 - 翻译,每个键和语言一行,可按语言、已审校、未确认、未翻译、QA 问题或进行中的任务筛选。
- 协作者及其权限和语言;
lokalise_get_my_contributor返回令牌所有者,写入都以此人的名义进行。 - 任务,包括类型、状态、截止日期、语言、负责人和进度;文件,包括键数和最近一次导入;按项目或按键的评论;带关联键的截图元数据;分支;带翻译、标签和标记的术语表术语。
写入的内容:
lokalise_create_keys添加新字符串及其平台和源文本。lokalise_update_key和lokalise_bulk_update_keys修改名称、描述、标签(merge_tags表示追加而不是替换)、平台、文件名、上下文、字符限制和翻译。lokalise_update_translation修改一条文本及其已审校、未确认或自定义状态标记。复数键接受包含各形式(one、other等)的 JSON 字符串。- 按 ISO 代码添加语言的
lokalise_add_languages;会发送邀请邮件的lokalise_add_contributors;lokalise_create_task为部分键和语言创建 translation、review 或 automatic_translation 任务,并带截止日期分配给用户或用户组;lokalise_update_task,其中{"close_task": true}会关闭任务。 lokalise_add_key_comments(向译者提问或为字符串补充上下文)、lokalise_create_branch、lokalise_create_glossary_terms(例如不得翻译的品牌名或禁用词)和lokalise_update_glossary_terms。
文件导出:lokalise_download_files 以 json、xliff、strings、xml、po 或 yaml 等格式开始导出,并返回 process_id。AI 会反复调用 lokalise_get_process,直到 status 为 finished,再把 details.download_url 的 zip 链接交给你,该链接一段时间后会失效。导出虽然是 POST,但不会修改项目。
安装时关闭:lokalise_delete_key,它会删除一个键及其全部翻译,且无法撤销。由工作区管理员在团队需要时开启。
ID 和格式:项目 ID 形如 767946315e9866d013c1d0.08299127;要在分支上操作,请传入 <project id>:<branch name>。键、翻译、任务、语言和用户的 ID 都是数字。语言使用 en、de 或 pt_BR 等 ISO 代码。列表响应会把条目包在一层里(projects、keys、translations 等)。时间以 YYYY-MM-DD HH:MM:SS (Etc/UTC) 加 Unix ..._timestamp 的形式返回。筛选中的标记为 0 或 1。
分页:使用 limit 和 page;总数在 x-pagination-total-count 和 x-pagination-page-count 响应头中返回,显示在 _headers 下。键和翻译也支持 pagination: cursor:AI 把 x-pagination-next-cursor 的值作为 cursor 传入,直到它不再出现。术语表术语只用 cursor 分页。
限制:每个令牌和每个 IP 地址每秒 6 个请求,每个项目最多 10 个并发请求;429 表示需要放慢。
常见错误:401 表示令牌错误。403 表示用只读令牌执行了写入,或在项目中缺少权限。404 表示项目或条目不存在。400 是会指出字段的校验错误;当 X-Api-Token 的值不是有效令牌(例如带有空格或引号)时也会出现。
该连接器不会上传翻译文件(需要 base64 内容)或截图,也不会删除项目、语言、任务或术语表术语。
步骤 2 — 安装 adapter
curl -fsSL https://raw.githubusercontent.com/HelpCode-ai/anythingmcp/main/docker-compose.quickstart.yml -o docker-compose.yml
printf 'JWT_SECRET=%s\nENCRYPTION_KEY=%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > .env
docker compose up -d
步骤 3 — 在 Gemini 中添加连接器
你的服务器 URL: 在 AnythingMCP 中打开 MCP Servers → 此连接器所在的服务器,复制它的 URL(
https://cloud.anythingmcp.com/mcp/…)。本指南中出现YOUR_SERVER_ID的地方都用它替换。
Gemini CLI 从 ~/.gemini/settings.json(Windows 上为 %USERPROFILE%\.gemini\settings.json)读取 MCP 服务器。添加:
{
"mcpServers": {
"anythingmcp": {
"httpUrl": "https://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID",
"headers": { "X-API-Key": "YOUR_MCP_API_KEY" }
}
}
}
- 在 AnythingMCP 的 MCP Servers → 你的服务器 → API keys 中创建 MCP API 密钥,并用它替换
YOUR_MCP_API_KEY。 - 保存文件并重启
gemini。 - 在 Gemini CLI 中运行
/mcp(或在终端运行gemini mcp list),anythingmcp应显示为已连接。 - 开始输入提示,Gemini CLI 现在可以调用
Lokalise的工具。
可用工具
| Tool | What it does |
|---|---|
lokalise_list_projects | Projects the token can reach, with id, name, type (localization_files, paged_documents, ...), base language, team and, on request… |
lokalise_get_project | One project with its settings and statistics: progress, keys, words and QA issues per language, base language and team |
lokalise_list_keys | Translation keys of a project with name per platform, description, tags, filenames and, with include_translations 1, the translations |
lokalise_get_key | One key with all its translations, tags, platforms, filenames, description, context, character limit and custom attributes |
lokalise_create_keys | Create one or more keys, with their translations if known |
lokalise_update_key | Update a key's name, description, platforms, filenames, tags (merge_tags to add rather than replace), plural settings, hidden or archived… |
lokalise_bulk_update_keys | Update several keys in one call |
lokalise_delete_key | Delete a key and all its translations from a software project |
lokalise_list_translations | Translations of a project, one row per key and language, with the text, reviewed and unverified flags, custom statuses, words and… |
lokalise_get_translation | One translation by id: key, language, text, reviewed and unverified flags, custom statuses, word count and who changed it last |
lokalise_update_translation | Change the text of one translation and its reviewed, unverified or custom status flags |
lokalise_list_project_languages | Languages of a project with lang_id, lang_iso, name, right-to-left flag and plural forms |
lokalise_add_languages | Add languages to a project by ISO code, e.g. de or pt_BR, optionally with a custom code or name |
lokalise_list_system_languages | All languages Lokalise supports, with lang_id, lang_iso, name and plural forms |
lokalise_list_contributors | Contributors of a project with email, name, admin and reviewer flags, role and the languages each may translate or review |
lokalise_get_contributor | One contributor of a project by user id, with rights and languages |
lokalise_get_my_contributor | The token owner as a contributor of a project: user id, rights and languages |
lokalise_add_contributors | Invite people to a project by email with their languages and rights |
lokalise_list_tasks | Tasks of a project with title, status, type (translation, review, automatic_translation, lqa_by_ai), due date, languages with assignees and… |
lokalise_get_task | One task with its languages, assignees, keys count, progress, closing tags and settings |
lokalise_create_task | Create a translation or review task for some keys and languages, assigned to users or groups, with a due date. automatic_translation uses… |
lokalise_update_task | Change a task's title, description, due date, languages or assignees, its auto-close settings, or close it with close_task |
lokalise_list_files | Files of a project with filename, key count and the date they were last imported |
lokalise_download_files | Start an export of the project's translations as language files (json, xliff, strings, xml, po, yaml, ...) |
lokalise_get_process | Status of a background process (file download or upload): queued, running, finished or failed, with details; for a download… |
lokalise_list_project_comments | All comments of a project, with the key they belong to, author and time |
lokalise_list_key_comments | Comments on one key, with comment id, text, author and time, newest first |
lokalise_add_key_comments | Add one or more comments to a key, e.g. a question to translators or context for a string |
lokalise_list_screenshots | Screenshots of a project (metadata only): title, description, URL, size, tags and the keys linked to them |
lokalise_get_screenshot | One screenshot's metadata: title, description, URL, width and height, tags and linked key ids |
lokalise_list_branches | Branches of a project with branch id, name and creation time |
lokalise_create_branch | Create a branch of a project (a copy of the main content to change in isolation and merge later) |
lokalise_list_glossary_terms | Glossary terms of a project with description, case sensitivity, translatable and forbidden flags, translations and tags |
lokalise_get_glossary_term | One glossary term with description, translations per language, tags and flags |
lokalise_create_glossary_terms | Add terms to the project glossary, e.g. brand names that must not be translated (translatable false) or words that must never be used… |
lokalise_update_glossary_terms | Change glossary terms by id: text, description, flags, translations or tags |
lokalise_list_translation_statuses | Custom translation statuses of a project (e.g |
示例提示
- “移动应用项目各语言的翻译进度如何?”
- “带 checkout 标签的键中,哪些还没有翻译成德语和法语?”
- “把 Web 项目导出为 de 和 it 的 JSON 文件,并给我下载链接。”
- “为入门引导键的西班牙语翻译创建一个审校任务,截止日期是下周五。”
- “把“AnythingMCP”作为不得翻译的品牌名添加到术语表。”
FAQ
Gemini CLI 从哪里读取 MCP 服务器? 用户级配置位于 ~/.gemini/settings.json,项目级配置位于项目内的 .gemini/settings.json。gemini mcp list 会列出每个服务器及其连接状态。
下一步
这份指南对你有帮助吗?