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.
To allow your users to define and switch languages from the Panel, you first have to enable it in
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.
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.
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.
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
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.
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.
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:
Kirby can detect the preferred language of the visitor. This has to be enabled in your config: