update_translations
Update or overwrite translations for a specific language in POEditor projects. Provide term translations with optional context, plural forms, and fuzzy matching to maintain translation accuracy.
Instructions
Update/overwrite translations for a language. Important: if a term was created with a context, you must provide the same context value to match that term.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| items | Yes | ||
| language | Yes | ||
| project_id | No |
Implementation Reference
- src/server.ts:173-182 (handler)Handler function that updates translations for existing terms in a language by calling the POEditor 'translations/update' API endpoint. Prepares a payload from input items and returns the API response.async (args) => { const id = requireProjectId(args.project_id ?? null); const payload = args.items.map((i) => ({ term: i.term, context: i.context ?? "", translation: i.plural ? { plural: i.plural } : { content: i.content, fuzzy: i.fuzzy ? 1 : 0 } })); const data = JSON.stringify(payload); const res = await poeditor("translations/update", { id: String(id), language: args.language, data }); return { content: [{ type: "text", text: JSON.stringify(res.result ?? {}, null, 2) }] };
- src/server.ts:47-62 (schema)Zod schema defining the input for update_translations tool: optional project_id, required language, and array of translation items with term, optional context, content, fuzzy, and plural forms.const TranslationsInput = z.object({ project_id: z.number().int().positive().optional(), language: z.string().min(2), items: z.array(z.object({ term: z.string().min(1), context: z.string().optional(), content: z.string().default(""), fuzzy: z.boolean().optional(), plural: z.object({ one: z.string().optional(), few: z.string().optional(), many: z.string().optional(), other: z.string().optional() }).partial().optional() })).min(1) });
- src/server.ts:169-184 (registration)Registers the 'update_translations' tool on the MCP server with name, description, input schema, and handler function.server.tool( "update_translations", "Update/overwrite translations for a language. Important: if a term was created with a context, you must provide the same context value to match that term.", TranslationsInput.shape, async (args) => { const id = requireProjectId(args.project_id ?? null); const payload = args.items.map((i) => ({ term: i.term, context: i.context ?? "", translation: i.plural ? { plural: i.plural } : { content: i.content, fuzzy: i.fuzzy ? 1 : 0 } })); const data = JSON.stringify(payload); const res = await poeditor("translations/update", { id: String(id), language: args.language, data }); return { content: [{ type: "text", text: JSON.stringify(res.result ?? {}, null, 2) }] }; } );