Languages
Add or remove languages
Reminder:
- Setup languages before populating content
- One default language must exist at all times
- Do not delete default language
- Reference: https://getkirby.com/docs/guide/languages
Panel language
- Panel language is the language in which the content editors will experience the panel
- Content editors can select their preferred language by visiting
/panel/account
- The panel already includes a wide variety of translations for the stock interface (stock interface only)
- Admin/developer must include translated blueprints in order to display translated fields
Content language
- Content language is the language in which visitors will experience the website front-end
- Content language includes:
- Page content: blog posts, articles, etc.
- Template variables: button labels, alert messages, navigation hints, etc.
Add language
- Visit
/panel/settings
> Add a new language - A language switcher will appear in the front-end
- A language switcher will appear in the panel (for editors to translate content)
- If no translation is available yet content in default language will be displayed
- Translate template variables:
- Open source file
/site/languages/{newLang}.php
- Add translations as an array
'translations' => [...]
- Use any existing language at
/site/languages/*.php
as a reference - All language files must contain the same set of and translations
- Open source file
- Translate content
- Visit
/panel
> Select page > Select language > Translate content
- Visit
Delete language
- To delete a language visit
/panel/settings
> Click language > Delete - When a language is deleted all content and associated files will be deleted too
- Do this for any language you are not going to use
- Do not delete default language
Change language path
- Open source files
/site/languages/*.php
- Change line
'url' => /{path}
to whatever path you want'url' => NULL
will use default code automatically'url' => '/'
will use no code, only one language can use this, usually default language
Changing default language
- This is a manual process
- At least two language definitions must exist already
- Open all source files at
/site/languages/*
- Make sure only one of these file is set to
'default' => true
(the one you'd like to be default) - Review filenames of source files at
/content/**/*
- If there are no files with the new default language as a suffix, you must rename files manually
- E.g. rename all
default.en.txt
todefault.{newLang}.txt
- Server will look for a text file with a language suffix that matches the visitor language selection, if it does not exist the default language file will be served, if none exist the page will be rendered blank