Setup

Learn how to setup multiple languages for your site.

Kirby has built-in support for multi-language sites.

Setup

Languages are being added in /site/config/config.php

c::set('languages', array(
  array(
    'code'    => 'en',
    'name'    => 'English',
    'default' => true,
    'locale'  => 'en_US',
    'url'     => '/',
  ),
  array(
    'code'    => 'de',
    'name'    => 'Deutsch',
    'locale'  => 'de_DE',
    'url'     => '/de',
  ),
));

As soon as more than one languages are setup in the languages array, multi-language support is switched on.

Automatic Language Detection

Kirby can detect the prefered language of the visitor. This has to be activated by adding:

c::set('language.detect', true);

Attention! Switching from single-language to multi-language

If you start with a single language setup and wish to switch to multiple languages later, you have to rename your text files to include the language code.

i.e.
projects.txt > projects.en.txt
myimage.jpg.txt > myimage.jpg.en.txt

This process is not yet handled by Kirby and can lead to broken content.