Skip to main content
Glama
mmntm

Weblate MCP Server

by mmntm

writeTranslation

Update or add translations for specific keys in Weblate projects by specifying project, component, language, and translation value. Mark translations as approved for immediate use.

Instructions

Update or write a translation value for a specific key

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentSlugYesThe slug of the component
keyYesThe translation key to update
languageCodeYesThe language code (e.g., en, es, fr)
markAsApprovedNoWhether to mark as approved (default: false)
projectSlugYesThe slug of the project
valueYesThe new translation value

Implementation Reference

  • The main execution logic for the 'writeTranslation' MCP tool. It takes input parameters, calls the WeblateApiService to perform the update, handles errors, and returns a formatted response.
    async writeTranslation({ projectSlug, componentSlug, languageCode, key, value, markAsApproved = false, }: { projectSlug: string; componentSlug: string; languageCode: string; key: string; value: string; markAsApproved?: boolean; }) { try { const updatedUnit = await this.weblateApiService.writeTranslation( projectSlug, componentSlug, languageCode, key, value, markAsApproved, ); return { content: [ { type: 'text', text: updatedUnit ? `Successfully updated translation for key "${key}"\n\n${this.formatTranslationResult(updatedUnit)}` : `Failed to update translation for key "${key}"`, }, ], }; } catch (error) { this.logger.error(`Failed to write translation for key ${key}`, error); return { content: [ { type: 'text', text: `Error writing translation for key "${key}": ${error.message}`, }, ], isError: true, }; } }
  • The @Tool decorator defining the tool name, description, and Zod input schema for validation.
    @Tool({ name: 'writeTranslation', description: 'Update or write a translation value for a specific key', parameters: z.object({ projectSlug: z.string().describe('The slug of the project'), componentSlug: z.string().describe('The slug of the component'), languageCode: z.string().describe('The language code (e.g., en, es, fr)'), key: z.string().describe('The translation key to update'), value: z.string().describe('The new translation value'), markAsApproved: z .boolean() .optional() .describe('Whether to mark as approved (default: false)') .default(false), }), })
  • The WeblateTranslationsTool class is provided in the AppModule's providers array, enabling auto-registration of its @Tool methods for the MCP server.
    WeblateTranslationsTool,

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mmntm/weblate-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server