<p>In Craft 3 the setup works a little bit different from the Craft 2 setup. You don't actually have to make changes to your <code>index.php</code> to switch the languages. </p>

<p>The languages are defined on a Site base. The translation folder now lives in the root of your projects: <code>projectFolder/translations/fr/site.php</code>. </p>

<p>As of Craft 3.1, you can set the Base Url of each site to a variable in your <code>.env</code> file and use that variable in the admin panel with the site setup. <code>@web</code> as your Base URL doesn't work to properly detect what site you are on.</p>

<p>So in your case, make two sites in the admin panel. Make two variables in your <code>.env</code> file:</p>

<pre><code>SITE_URL_FR = '...'fr/'
SITE_URL_EN = '.../en/'
</code></pre>

<p>Use those variables to set your Base Url in the sites config. You can target them with <code>$SITE_URL_FR</code>. That should do the trick.</p>

CC BY-SA 4.0
2019-01-25T10:21:22.583Z
Thank you @Jan_dh

I've remove "/www/fr" and "/www/en" folders
I've add SITE_URL_FR and SITE_URL_EN in .env file
I've change my sites config with this new env variables
It's easier to manage now

But, frontend still load english translation in the french environnement
akagibi
CC BY-SA 4.0
2019-01-25T10:52:38.757Z
Are you on Craft 3.1?
Jan_dh
CC BY-SA 4.0
2019-01-25T10:53:56.940Z
Does the folders you made in the translations also match the language handles of the site?
Jan_dh
CC BY-SA 4.0
2019-01-25T11:25:33.550Z
Craft CMS 3.1.3 - Yes, "/craftfolder/translations/en/site.php"
akagibi
CC BY-SA 4.0
2019-01-25T11:25:39.297Z
Not sure if it's relevant but when you visit your site, if you have have another tab opened and you're logged in as a user with english set as your main language, it might be taking over your frontend language maybe..? Not able to test but this came to mind when I read your issue :)
Oli
CC BY-SA 4.0
2019-01-25T11:34:41.447Z
@Olivier Bon - No, same problem. Logged out, devMode false, ... strange because i've got other website without problem. ??..
akagibi
CC BY-SA 4.0
2019-01-25T11:46:34.027Z
Cleared your cache?
Oli
CC BY-SA 4.0
2019-01-25T11:53:21.460Z
Yes cache clear. I think there is an error during install
akagibi
CC BY-SA 4.0
2019-01-25T15:34:54.347Z
Hey, Craft 3.1.4 was available. After the update, everything work fine !
akagibi
CC BY-SA 4.0
2019-01-25T15:47:51.583Z
Good news! Glad you got it sorted :)
Oli
CC BY-SA 4.0
2019-01-25T09:37:23.297Z
2019-01-25T09:51:55.877Z
2019-01-25T09:51:55.877Z
Jan_dh
<p>I have 2 sites (fr and en), fr is default.</p>

<p>In <code>index.php</code>, I have <code>define('CRAFT_SITE', 'fr')</code> and <code>define('CRAFT_SITE', 'en')</code></p>

<p>In templates, I'm using <code>{{ 'Texte FR'|t }}</code> tag.</p>

<p>In <code>/craft/translations/en/site.php</code>, I have my translation : <code>'Texte FR' =&gt; 'Text EN'</code></p>

<p>When I test the English version, it's OK.</p>

<p>When I test the French version, English translations are displayed.</p>

<p>If I remove translations folder, of course, it's OK.</p>

<p>If I add 'fr' folder in translations, Englishis  still displayed.</p>

<p>Is there a way to trace the choice of the translation file by Craft?</p>

<p>I can't find why ...</p>

<p>Thank for help. :)</p>

<craft3><localization>
Craft CMS 3 - Always load "en" translation file
# Craft CMS 3 - Always load "en" translation file

(Asked by: username_0 on 2019-01-25)

I have 2 sites (fr and en), fr is default.

In `index.php`, I have `define('CRAFT_SITE', 'fr')` and `define('CRAFT_SITE', 'en')`

In templates, I'm using `{{ 'Texte FR'|t }}` tag.

In `/craft/translations/en/site.php`, I have my translation : `'Texte FR' => 'Text EN'`

When I test the English version, it's OK.

When I test the French version, English translations are displayed.

If I remove translations folder, of course, it's OK.

If I add 'fr' folder in translations, Englishis still displayed.

Is there a way to trace the choice of the translation file by Craft?

I can't find why ...

Thank for help. :)

**Tags:** craft3, localization

---

## 1 answers

### Answer by username_1 on 2019-01-25. Score: 1

In Craft 3 the setup works a little bit different from the Craft 2 setup. You don't actually have to make changes to your index.php to switch the languages. 
The languages are defined on a Site base. The translation folder now lives in the root of your projects: projectFolder/translations/fr/site.php. 
As of Craft 3.1, you can set the Base Url of each site to a variable in your .env file and use that variable in the admin panel with the site setup. @web as your Base URL doesn't work to properly detect what site you are on.
So in your case, make two sites in the admin panel. Make two variables in your .env file:
SITE_URL_FR = '...'fr/'
SITE_URL_EN = '.../en/'

Use those variables to set your Base Url in the sites config. You can target them with $SITE_URL_FR. That should do the trick.

> **Comments:**
> **username_0**: Thank you @Jan_dh  I've remove "/www/fr" and "/www/en" folders I've add SITE_URL_FR and SITE_URL_EN in .env file I've change my sites config with this new env variables It's easier to manage now  But, frontend still load english translation in the french environnement  
> **username_1**: Are you on Craft 3.1?  
> **username_1**: Does the folders you made in the translations also match the language handles of the site?  
> **username_0**: Craft CMS 3.1.3 - Yes, "/craftfolder/translations/en/site.php"  
> **username_2**: Not sure if it's relevant but when you visit your site, if you have have another tab opened and you're logged in as a user with english set as your main language, it might be taking over your frontend language maybe..? Not able to test but this came to mind when I read your issue :)  
> **username_0**: @Olivier Bon - No, same problem. Logged out, devMode false, ... strange because i've got other website without problem. ??..  
> **username_2**: Cleared your cache?  
> **username_0**: Yes cache clear. I think there is an error during install  
> **username_0**: Hey, Craft 3.1.4 was available. After the update, everything work fine !  
> **username_2**: Good news! Glad you got it sorted :)  

---

