feat: add is_plural support for creating plural translation keys - #38
Open
mattJurz wants to merge 1 commit into
Open
feat: add is_plural support for creating plural translation keys#38mattJurz wants to merge 1 commit into
mattJurz wants to merge 1 commit into
Conversation
Add support for creating plural keys via the create_keys tool. This enables proper pluralization in Lokalise by passing is_plural: true and providing translations as objects with CLDR plural categories (zero/one/two/few/many/other) instead of plain strings. Changes: - keys.types.ts: Add is_plural field and union type for translations (string | plural forms object) in CreateKeysToolArgs - keys.service.ts: Pass is_plural through to the Lokalise API - keys.controller.ts: Map is_plural from tool args to service params - keys.tool.ts: Update tool description to document plural support Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
is_pluralparameter tocreate_keystool to support creating plural translation keyszero/one/two/few/many/other) instead of only plain stringsis_pluralthrough the full stack: types → controller → service → Lokalise APIMotivation
Currently there is no way to create a plural key via the MCP tool. The Lokalise REST API supports
is_plural: trueon key creation (see Lokalise Node API docs), but the MCP tool doesn't expose this parameter. This means users must manually toggle "Set as plural key" in the Lokalise UI after creating keys via MCP.Usage example
{ "projectId": "123456.abcdef", "keys": [{ "key_name": "items.count", "is_plural": true, "platforms": ["ios", "android", "web"], "translations": [ { "language_iso": "en", "translation": { "one": "%s item", "other": "%s items" } }, { "language_iso": "pl", "translation": { "one": "%s element", "few": "%s elementy", "many": "%s elementów", "other": "%s elementów" } } ] }] }Changes
keys.types.tsis_pluralfield +PluralFormsSchema+ union type fortranslationkeys.service.tsis_pluralto Lokalise API + updatedCreateKeysParamsinterfacekeys.controller.tsis_pluralfrom tool args to service paramskeys.tool.tsTest plan
is_plural: trueand object translations🤖 Generated with Claude Code