Language variables can be stored in two places in Kirby:
- As an array of key/value pairs in your language definition files in
- As an array of key/value pairs in a plugin using the
Those arrays can contain as many custom variables as you need.
Once you have added one or more languages, you can start adding translation variables via the Language editor. Visit the language you want to edit. You can now add language variables as key/value pairs. These variables will also be stored in the language definition files.
Access to the language editor can be restricted via permissions
Language variables that you add in other languages than the default language will be stored in the default language as well. Language variables added in the default language will only be stored once translated.
If you stored your language variables in separate files as described in this cookbook recipe they will be read by the Panel, but then moved to the language definition files.
Core translation variables and translation variables from plugins are ignored and cannot be overwritten via the Panel.
Those translated variables can be fetched in your template, plugins or snippets with the
You can provide a fallback if the language variable is not defined:
Check out the following cookbook recipes to find out how to make language variables more flexible: