Skip to content

Instantly share code, notes, and snippets.

@kaspar-allenbach
Last active February 21, 2018 08:58
Show Gist options
  • Save kaspar-allenbach/283f1359c74bb19dc8e284b97288e5e9 to your computer and use it in GitHub Desktop.
Save kaspar-allenbach/283f1359c74bb19dc8e284b97288e5e9 to your computer and use it in GitHub Desktop.
Craft 3 Multilang Setup

In Craft CMS 3 there are some minor adjustements to make when setting up a localized website. The Old Guide to setup a localized Site is still valid with some differences.

File Setup

You have to create a language folder in the public directory with a .htaccess and a index.php

Let's say you want english as a second language with the url extension yourdomain.com/en.

  1. create a folder en.
  2. Copy .htaccess & index.php from the public folder into the en folder.

index.php

Replace the line define('CRAFT_BASE_PATH', dirname(__DIR__));

with define('CRAFT_BASE_PATH', dirname(__DIR__,2));

Define which language should be loaded when accessing /en/. And with language Craft 3 means Site: Therfore add define('CRAFT_SITE', 'yourSiteHandle'); to the index.php.

Remember. Languages are now Site based. Therefore you mustn't use the locale handle but the site Handle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment