generate_po_template
Create or update PO templates for Webasyst applications to manage translation files and support multilingual functionality.
Instructions
Создать/обновить PO шаблон для приложения
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app_id | Yes | ||
| locale | No |
Implementation Reference
- webasyst-mcp.js:1301-1311 (handler)The main handler function implementing the 'generate_po_template' tool. It locates the Webasyst root, ensures the locale directory exists, and creates a basic PO template file if absent.async function generatePoTemplateTool({ app_id, locale = 'ru_RU' }) { const rootPath = await findWebasystRoot(); const poDir = path.join(rootPath, 'wa-apps', app_id, 'locale', locale, 'LC_MESSAGES'); await ensureDir(poDir); const poPath = path.join(poDir, `${app_id}.po`); if (!(await fileExists(poPath))) { const header = `msgid ""\nmsgstr ""\n"Project-Id-Version: ${app_id}\\n"\n"Content-Type: text/plain; charset=UTF-8\\n"\n"Language: ${locale}\\n"\n\n`; await fs.writeFile(poPath, header); } return { content: [{ type: 'text', text: `PO шаблон подготовлен: ${poPath}` }] }; }
- webasyst-mcp.js:1739-1739 (registration)Registration of the 'generate_po_template' tool in the ListToolsRequestSchema response, including description and input schema (parameters: app_id required, locale optional).{ name: 'generate_po_template', description: 'Создать/обновить PO шаблон для приложения', inputSchema: { type: 'object', properties: { app_id: { type: 'string' }, locale: { type: 'string' } }, required: ['app_id'] } },
- webasyst-mcp.js:1801-1801 (registration)Dispatch handler in the CallToolRequestSchema switch statement that executes the generatePoTemplateTool when the tool is called.case 'generate_po_template': return await generatePoTemplateTool(args);