Its it possible to use the localization feature to create regional site versions.

Currently when I attempt to use this feature I can only view pages in my locale.

The Apple.com website shows a great example of what we're trying to achieve.


We'd like to create new entries and have a draft appear in all regional sub directories.




The main point is we want the entire site open to users from anywhere.

We're not yet concerned with translations either.

  • Would it be possible to use the event system to catch requests to certain areas of the site and force the locale?
    – Henry
    Oct 2 '14 at 22:37

I had some helpful advice via Craft's support channels. Here was the solution I arrived at with their assistance:

You can hard code the locale in index.php in the doc root.

define('CRAFT_LOCALE', $locale);

The normal approach seems to be that multiple index.php pages can be used in a multi-locale site. I prefered to keep the one, so I used this tiny hack that derives from the url what the desired locale is:


// Path to your craft/ folder
$craftPath = '../craft';

$url_folder = substr(substr($_SERVER["REQUEST_URI"],1), 0,
    strpos(substr($_SERVER["REQUEST_URI"],1), "/"));
$locale = 'en_nz';

if($url_folder === 'worldwide') {
    $locale = 'en_zz';
else {
    $locale = 'en_' . $url_folder;

define('CRAFT_LOCALE', $locale);

This hack is confined to the index.php so it seems pretty clean.


Pixel & Tonic added an article on this some time ago which explains everything very well: https://craftcms.com/docs/localization-guide

And it just rulez!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.