Kirby comes with built-in support for multi-language sites. Languages can be defined, added and switched right in the Panel.
- Define any number of languages for your site.
- Add new languages from the Panel.
- Set a different default language from the Panel.
- Use custom language variables to define string translations, for example for buttons, forms, options.
- Define custom language URLs.
- RTL languages are supported too.
Enabling the multi-lang feature in the Panel
To allow your users to define and switch languages from the Panel, you first have to enable it in
The first language must always be defined as the default language. Make sure to only define one default language.
If your site already has content, make sure to set your first language to the language of this content.
New language definitions are created in the
/site/languages folder. To add a new language, create a new PHP file with a filename consisting of the language code of the new language and the extension
For example, to add English as a new language:
Repeat for every new language you want to use.
If you encounter issues with functions like
strftime that depend on the locale setting, you might have to add a suffix to the locale code that specifies the encoding format. Depending on your operating system and setup, try adding e.g.
.utf-8 to your locale codes. Some operating systems however use different notations such as
You can list all available locales on your system by typing
locale -a on the command line.
If you don't use the Panel, you have to add the language extension to your text files manually. The language extension is mandatory, otherwise Kirby will not work as expected.
Via the Panel
After enabling languages in your config as described above, you can find the language setup on the Panel in the "Settings" page.
To add the first/a new language, click on "Add a new language" and add the language name, code, direction and PHP locale string.
Once the default language is defined, you can add more languages as secondary languages. The Panel automatically renames all existing content and file meta data files and includes the language extension.
Manage languages in the Panel
The Panel offers options to delete and edit a language. You can access them by clicking on the menu icon (three dots):
Edit: Change the name, locale or reading direction of the language.
Delete: Delete the language.
If you delete a language, all of its content files are deleted. This can even result in all your content being deleted if you delete the wrong language.
Language specific URLs
By default, the URL of your site changes and the language code is added to the URL. If you want to keep the root URL for the default language, you can set the URL manually using the
Using the root URL for the default language will disable automatic language detection.
Using different domains for each language
Kirby supports cross-domain multi-language sites. You can define the domain for each language like this:
Make sure that both domains point to your Kirby site.
Detailed locale settings
If you need more control over your locale settings for each language, you can pass an array of locales:
This is useful if specific locales need to be set to a different value.
LC_ALL locale should always be set as it is used as a default locale internally in the Kirby core. Other locales can be set to override the default
LC_ALL locale for specific use-cases.
Language specific date handlers
By default, Kirby uses PHP's
date function to format dates for pages and files.
date() does not respect locale settings and always creates English month and day names. You can switch to
strftime() as your primary date handler, which uses a different format for dates, but also supports translated month and day names. To switch the handler, add the following to your config:
Automatic language detection
Kirby can detect the preferred language of the visitor. This has to be enabled in your config: