Language Variables
Open a language from Kirby's Languages view to see its language variables. The Translator button in a language's view translates the variables that are still untranslated and saves them directly – into the language you're looking at, or from the default language into several secondary languages at once.
Add the Button
Kirby's language view has no blueprint, so the button goes into the panel.viewButtons.language option:
return [
'panel' => [
'viewButtons' => [
// Kirby's default buttons, plus `content-translator`
'language' => ['open', 'content-translator', 'settings', 'delete']
]
]
];
The list replaces Kirby's defaults, so keep naming every button you want. The button appears in the view of every language, and its actions are disabled for a role without the languages.update permission.
The button reads the plugin's global options. A button entry with options overrides them for the language view, such as batch to hide the batch run:
return [
'panel' => [
'viewButtons' => [
'language' => [
'open',
'content-translator' => ['batch' => false],
'settings',
'delete'
]
]
]
];
site/languages/. A language file that builds its variables in PHP, such as by loading a YAML file, is rewritten as a plain array – as with every variable you edit in the Panel.Translate One Language
In a secondary language's view, Translate → DE in the Translator dropdown opens a dialog that counts the variables to translate:
The provider choice appears when both are configured. Translate saves the translations directly, and the view shows them.
When every variable already has its own translation, a notification says Every variable in Deutsch has its own translation instead of opening the dialog.
Translate Several Languages
In the default language's view, EN → All Languages in the Translator dropdown opens the batch dialog. Each selected language is saved on its own, so a language that fails leaves the others saved. The run ends in Variables translated for the selected languages, or in a dialog naming each language that needs attention – see Translation Results.
What Gets Translated
A variable is translated when it is missing or empty in the language, or still identical to the default language's. A variable with its own translation stays as it is. Each value of a countable variable is translated. A variable without text to translate, such as a number, a URL, or a lone {count}, is left out. On Kirby 5.6 and later, a variable named like one of Kirby's own translation strings, such as search or next, is left out too, since Kirby refuses to save it from the Panel.
Variable Placeholders and KirbyTags
Variable placeholders such as {count} or {{ name }}, which tt() and tc() fill in, come back as written. When a translation loses or changes one, the variable is not saved, and the notification names it: 1 of 7 variables was not translated: cart.items. A KirbyTag in a variable is translated like one in a field: only the attributes named in kirbyTags.