/xwiki:xwiki-translationsfrom xwiki
Externalizes and renders translations in XWiki sheets, templates, and wiki pages with proper i18n and security escaping. Use when adding or changing user-facing strings.
Ships in xwiki. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Use this skill whenever you add, change, or externalize user-facing text in XWiki sheets/pages
(.xml), templates (.vm), Translations wiki documents, or JAR resource bundles
(ApplicationResources*.properties). It covers both i18n correctness and the security rules that
apply to a translated string.
XWiki.TranslationDocumentClass object (e.g.
XYZ.Translations), plain/1.0 syntax, body is key=value lines. Add keys only to the default
(English) document; localized variants (Translations.fr.xml, …) are produced by translators —
do not edit them in a feature change.src/main/resources/.../ApplicationResources.properties (+ _fr, …).Add a new key following the module's prefix convention. Never reuse another place's key, even for identical text: other languages inflect it or translate an English homonym differently (L10N Conventions).
$services.localization.render('some.key') ## default syntax: plain/1.0
$services.localization.render('some.key', [$param0, $param1]) ## MessageFormat parameters {0},{1}
$services.localization.render('some.key', 'xhtml/1.0', [$p]) ## render to a specific syntax
$services.localization.render([$dynamicKey, 'fallback.key']) ## try keys until one is found
MessageFormat runs only when parameters are passed. So a literal apostrophe must be doubled
('') only in keys that have {N} parameters; keys without parameters keep a single '.
In the {{translation}} macro form ({{translation key="some.key"/}}), execution is isolated (script
macros in the value never run). It supports inline mode, so it can be placed inside markup you build —
including a link label: [[{{translation key="some.key"/}}>>$target]]. Translation values must not
contain wiki markup (see below).
A translation value is, in the end, interpreted as wiki (or HTML) syntax: the string returned by
$services.localization.render(...) is re-parsed by the surrounding {{velocity}} output. Treat
every translation value as untrusted, for two reasons:
{{groovy}}, {{html}},
{{velocity}}, …). Registering a translation that affects other users requires elevated rights
(GLOBAL → Programming Right, WIKI → Wiki Admin Right), but a USER-scope translation only needs
Script right — and that is still dangerous: a Script-right user can register such a translation,
and if it is then rendered in a request handled for a user who has Admin or Programming rights, the
injected macro executes with those rights. So Script right becomes a path to Admin/Programming
right.*, [[, <, {{, …). Unless escaped, they break the rendering of the translation.{{translation}} macroIn wiki content (sheets, wiki pages, any .vm/velocity output that becomes wiki syntax) use the
macro. It is the safest (the value is rendered in an isolated context — script macros in it do NOT
execute) and the most performant option. It supports inline mode, so it fits labels, headings and
table cells:
{{translation key="myapp.section.title"/}}
= {{translation key="myapp.section.title"/}} =
|(% class="label" %){{translation key="myapp.label"/}}(%%)|...
Pass parameters by the name of the variable holding them, so the macro escapes them for you:
{{velocity}}
#set ($txparameters = [$userinput, 42])
{{translation key="myapp.intro" scriptParameters="txparameters"/}}
{{/velocity}}
From inside a {{velocity}} block, the #wikiTranslation($key $parameters) Velocity helper
(17.10.10+, 18.4.1+, 18.5.0RC1+) emits that macro for you and wires up the scriptParameters
plumbing — pass $parameters as a list, or omit it for a plain key:
#wikiTranslation('myapp.section.title')
#wikiTranslation('myapp.intro' [$userinput, 42])
Never write $services.rendering.escape($services.localization.render('myapp.key'), 'xwiki/2.1') in a
wiki context — use the macro/helper instead (it is safer and more performant).
The macro is unavailable only in non-wiki output (HTML attributes, JavaScript, a string compared in
code). There, use $services.localization.render(...) and escape for the actual target:
## HTML context
<a href="...">$escapetool.xml($services.localization.render('myapp.icon.linkText'))</a>
Inside wiki markup (including link labels) you stay with the macro — [[{{translation key="myapp.linkLabel"/}}>>$target]] — not render(...).
Document/object values, request parameters and user input are untrusted. With the macro, pass them via
scriptParameters (escaped for you). With render(...), escape them for the target; inside a link
label data is parsed twice, so escape it twice
($services.rendering.escape($services.rendering.escape($data, 'xwiki/2.1'), 'xwiki/2.1')).
It will (and should) be escaped, so it won't render. To wrap translated text in a link or other
markup, build the markup in your (trusted) code and put the macro inside it, keeping the label a single
translatable key — e.g. a link is [[{{translation key="myapp.linkLabel"/}}>>$target]].
Neither the {{translation}} macro nor #wikiTranslation can render a link that sits in the middle
of a translated sentence (the macro escapes parameters, so a link passed as a parameter would not
render). For that case only, keep the whole sentence in one key with positional {0}…{1} placeholders
for the markup boundaries, build the markup in trusted sheet code, and render with the script service:
## value (no markup, just placeholders): myapp.help=… {0}attach the new version{1} …
$services.localization.render('myapp.help', ['[[', ">>path:$xwiki.getURL($doc.fullName, 'view', 'viewer=attachments')]]"])
Escape any untrusted data placed inside the markup parameters. Be aware the value is rendered as syntax here (the markup must reach the parser), so reserve this for the genuine inline-link case.
## Label / heading / message — the translation macro (inline works)
{{translation key="ext.repository.type"/}}
= {{translation key="ext.repository.description"/}} =
## Message with untrusted data — pass data by variable name via scriptParameters (or #wikiTranslation)
{{velocity}}
#set ($params = ["$id $version"])
{{translation key="ext.dependencies.intro" scriptParameters="params"/}}
{{/velocity}}
## Link label — the macro lives inside the link you build
[[{{translation key="ext.attach.linkLabel"/}}>>path:$xwiki.getURL($doc.fullName, 'view', 'viewer=attachments')]]
## Inline link the macro can't produce — script service with markup-boundary params (Rule 5)
$services.localization.render('ext.attach.help', ['[[', ">>path:$xwiki.getURL($doc.fullName, 'view', 'viewer=attachments')]]"])
## HTML context inside {{html}} — escape with escapetool.xml
<a href="...">$escapetool.xml($services.localization.render('ext.icon.linkText'))</a>
@since PageTest)LocalizationSetup mocks the localization service and the translation bundle, so {{translation key="x"/}} and render(key) both render the key x (not the real value), and render(key, [p])
renders key [p0, p1]. Add TranslationMacro.class to the test @ComponentList (and the
xwiki-platform-localization-macro test dependency) when the sheet uses the macro. When a test must
verify a rendered link or its escaping, build the link markup in the sheet (so the test can see
it), not inside the translation value.
scriptParameters gotcha: {{translation … scriptParameters="var"/}} goes through
ScriptMacroTools.getScriptValue, which requires the current author to have SCRIPT right and reads
the variable from the script context. In a PageTest this is not set up by default, so the parameters
come back empty and the rendered message loses them. If a data-bearing translation must stay testable
with the standard page-test harness, render it with $services.localization.render('key', [escaped data]) (the documented fallback) rather than the macro.
Translations (or any) wiki page XML, run mvn xar:format on the module and
confirm the build's xar:verify passes — those pages are XAR pages (see the xwiki-xar-pages
skill for the full conventions/workflow). Also keep checkstyle clean.some.key shown), proving the text goes through localization.xwiki-xar-pages skill.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub xwiki/xwiki-dev-llm --plugin xwiki38 skills in this plugin
/xwiki-backportBackport any change (bug fix, feature, refactor, or test) to an older branch of an XWiki repo (xwiki-platform / xwiki-commons / xwiki-rendering / xwiki-contrib). Cherry-pick `-x` the source commit(s) into a worktree, ADAPT the result to the older branch (module pom versions, Java level, `@since` tags, data migration versions and skip ranges, style/API divergence), verify it compiles against that branch, and push / open a PR. Use whenever a commit that exists on one branch needs to be applied to an older/maintenance branch. For the `testneeded`-labelled test sweep use xwiki-backport-testneeded (which builds on this skill); for Maven commands use xwiki-build; for PR/commit conventions use xwiki-pull-request; for the versioning/`@since` conventions (the format and what carries `@since`) use xwiki-knowledge./xwiki-backport-testneededBackport the automated test of one JIRA issue labelled `testneeded` to the currently-supported stable branches, adjust its `@since` tags across all branches, and open the PRs. Use when asked to backport the test of a given testneeded issue, or to catch a stable branch up with a recently-added test. (For several issues at once, the user will say so — then apply this per issue.) This is the test-specific layer on top of xwiki-backport (which owns the generic cherry-pick / adapt-to-branch / verify mechanics — including the mandatory pom-version, Java-version and `@since` checks). For Maven use xwiki-build; for PR/commit conventions use xwiki-pull-request; for the `@since` rules use xwiki-knowledge; for querying JIRA (the testneeded sweep) use xwiki-jira./xwiki-buildBuild and test XWiki Maven modules. Use when building XWiki, running its tests, or when the user mentions mvn, a build, a failing test, or a specific XWiki module./xwiki-capture-ui-changeCapture the "before" screenshot of a fix to existing XWiki UI when the branch can no longer produce it (the fix is already in the working tree) - on the released version's Docker image, or by building and deploying the pre-fix code on a local instance - and shoot the same fixture in both states. Costs minutes to tens of minutes, so propose it and run it only with the user's explicit approval. Not for a new feature or a redesign (there is no "before"), nor when the bug can still be shot on a running instance before applying the fix. For deploying an extension without a comparison use xwiki-deploy-extension; for Maven commands use xwiki-build; for the PR/JIRA screenshot conventions use xwiki-pull-request; for manually testing every fix of a release use xwiki-manual-test./xwiki-ci-checkEXPLICIT INVOCATION ONLY — never load this skill to answer a question about CI. The daily acting sweep of ci.xwiki.org: it turns what is red on the maintained branches into incidents, attributes each to the commit that caused it and comments there, opens PRs for mechanical fixes (a failing quality gate or a build break first), files proven flicker issues, drafts a fix for one flicker, and posts a digest to Matrix. Only with --write does it write to GitHub, JIRA and Matrix; otherwise it analyses to stdout and asks before each write. Use ONLY when named — `/xwiki-ci-check`, "run the CI check", or a scheduled routine invoking it by name. Do NOT use it for "what's the CI status?", "is master green?", "why is this test failing?" or any other read-only CI question: those are xwiki-release-test-triage. To fix one flicker use xwiki-fix-flickering-docker-test, to file an issue use xwiki-jira, to open a PR use xwiki-pull-request, for Maven use xwiki-build, for Sonar findings use xwiki-fix-sonarqube-issue./xwiki-contrib-releaseRelease an xwiki-contrib extension (groupId org.xwiki.contrib) end to end — preflight, `mvn release:prepare`/`release:perform` to nexus.xwiki.org, the issue-tracker version (JIRA or OpenProject), the extensions.xwiki.org import and release notes, then the hand-off to the announcement. Use when asked to release or publish a version of a contrib extension ("release v1.15 of the doc app"). Not for xwiki-commons/rendering/platform releases (use xwiki-xs-release). For the blog post use xwiki-contrib-release-blog-post; for Maven/JDK use xwiki-build; for tracker calls use xwiki-jira or xwiki-openproject.