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

<p>You can hard code the locale in index.php in the doc root.</p>

<pre><code>define('CRAFT_LOCALE', $locale);
</code></pre>

<p>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:</p>

<pre><code>&lt;?php

// 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);
</code></pre>

<p>This hack is confined to the index.php so it seems pretty clean.</p>

CC BY-SA 3.0
2014-10-02T23:30:39.687Z
2014-10-02T23:30:39.687Z
Henry
<p>Pixel &amp; Tonic added an article on this some time ago which explains everything very well: <a href="https://craftcms.com/docs/localization-guide" rel="nofollow">https://craftcms.com/docs/localization-guide</a></p>

<p><strong>And it just rulez!</strong></p>

CC BY-SA 3.0
2016-05-25T23:07:47.227Z
2016-05-25T23:07:47.227Z
bennobo
<p>Its it possible to use the localization feature to create regional site versions.</p>

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

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

<pre><code>http://www.apple.com/au/
http://www.apple.com/nz/
http://www.apple.com/uk/
</code></pre>

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

<p>E.g.</p>

<pre><code>http://www.acme.com/nz/news/news-release
http://www.acme.com/au/news/news-release
http://www.acme.com/uk/news/news-release
</code></pre>

<p>...</p>

<p>The main point is we want the entire site open to users from anywhere.</p>

<p>We're not yet concerned with translations either.</p>

CC BY-SA 3.0
2014-10-02T22:37:05.627Z
Would it be possible to use the event system to catch requests to certain areas of the site and force the locale?
Henry
<localization>
Apple.com style Localization
# Apple.com style Localization

(Asked by: username_0 on 2014-10-02)

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.
http://www.apple.com/au/
http://www.apple.com/nz/
http://www.apple.com/uk/

We'd like to create new entries and have a draft appear in all regional sub directories.
E.g.
http://www.acme.com/nz/news/news-release
http://www.acme.com/au/news/news-release
http://www.acme.com/uk/news/news-release

...
The main point is we want the entire site open to users from anywhere.
We're not yet concerned with translations either.

**Tags:** localization

> **Comments:**
> **username_0**: Would it be possible to use the event system to catch requests to certain areas of the site and force the locale?  

---

## 2 answers

### Answer by username_0 on 2014-10-02. Score: 3 | Accepted answer

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:

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


---

### Answer by username_1 on 2016-05-25. Score: 2

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!**


---

