add_language
Add a new language to your translation project by specifying its code (e.g., 'en', 'de', 'fr') to expand multilingual content management.
Instructions
Add a new language to the project. Provide the language code (e.g., 'en', 'de', 'fr').
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | No | ||
| language | Yes |
Implementation Reference
- src/server.ts:311-315 (handler)The inline handler function for the 'add_language' tool. It resolves the project ID, calls the POEditor 'languages/add' API endpoint with the language code, and returns the API response as formatted JSON.async (args) => { const id = requireProjectId(args.project_id ?? null); const res = await poeditor("languages/add", { id: String(id), language: args.language }); return { content: [{ type: "text", text: JSON.stringify(res.result ?? {}, null, 2) }] }; }
- src/server.ts:77-80 (schema)Zod input schema for the 'add_language' tool, defining optional project_id (number) and required language (string, min length 2).const AddLanguageInput = z.object({ project_id: z.number().int().positive().optional(), language: z.string().min(2) });
- src/server.ts:307-316 (registration)Registration of the 'add_language' tool via server.tool(), specifying the name, description, input schema (AddLanguageInput.shape), and inline handler function.server.tool( "add_language", "Add a new language to the project. Provide the language code (e.g., 'en', 'de', 'fr').", AddLanguageInput.shape, async (args) => { const id = requireProjectId(args.project_id ?? null); const res = await poeditor("languages/add", { id: String(id), language: args.language }); return { content: [{ type: "text", text: JSON.stringify(res.result ?? {}, null, 2) }] }; } );