<p>I'm simply trying to follow the <a href="https://docs.craftcms.com/v3/static-translations.html#provide-the-translations" rel="nofollow noreferrer">docs</a> as good as possible.</p>

<h2>Try the following:</h2>

<h3>Example String we'll be using: <code>"cheese"</code> | <code>"fromage"</code></h3>

<ol>
<li>in your <code>config/general.php</code> make sure you have your <code>siteUrl</code> set as an array with at least two entries, example:<code>'siteUrl' =&gt; ['my_site_en' =&gt; 'http://localhost:1234, 'my_site_fr =&gt; 'http://localhost:1234/fr/'];</code></li>
<li><p>in your <code>translations/fr/site.php</code> make sure it only contains the following</p>

<pre><code>&lt;?php

return [
  'cheese' =&gt; 'fromage',
];
</code></pre></li>
<li><p>in your twig file add the following <code>&lt;h1&gt;{{ "cheese"|t }}&lt;/h1&gt;</code> </p></li>
</ol>

<p>4. <strong>important</strong>: Access your Control Panel (<code>cpTrigger</code> in <code>config/general.php</code> for the first part of the URL), => <code>http://localhost:1234/%CP_TRIGGER%/settings/sites</code> and make sure you have <strong>2 sites, both in the same group, one in <code>en</code>, one in <code>fr</code> &amp; their URLs must also be set!</strong>  <br/> It should look similar to this <a href="https://i.sstatic.net/4ez3U.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/4ez3U.png" alt="Craft CP with two sites, main english, additional french"></a></p>

<p>As long as all 4 steps are followed, it <strong>should</strong> work.</p>

<p>Hope this helps!</p>

CC BY-SA 4.0
2019-12-10T13:35:15.453Z
I was seriously hoping this would work, but it didn't. I seriously don't know what I am doing wrong, but it is genuinely frustrating!
Mikko109
CC BY-SA 4.0
2019-12-10T14:02:44.580Z
Alright well let's not give up just quite yet, we still have a few things we can try...

clear your logs `storage/logs/*` and then call an URL which *should* (if it worked) translate a string to another language.

After that please zip your entire `storage/logs` folder and upload it to some file-sharing website and post the link in the comments so I can take a look at it, I think that'd be a good place to check as the logs sometimes have some info which may get overlooked otherwise. (For example you could use https://send.firefox.com/)
Campiotti
CC BY-SA 4.0
2019-12-12T17:47:50.087Z
Hi Campiotti. Here are the logs files: https://send.firefox.com/download/49de7f59e66f4879/#bm3SAgphYcNqYAG4yThKtA

The two lines I'm trying to translate are called "Email Address" and "Go!" in case it helps you find something.
Mikko109
CC BY-SA 4.0
2019-12-16T06:46:04.087Z
Oh I forgot about the time-limit on the send.firefox.com downloads sorry!
I miseed the download span and am now unable to download the logs... I think it might be better if a more non-temporary file hoster would be used like https://mediafire.com . Sorry about that, but could you please upload the logs once more but to that file hoster? Then the link wouldn't expire so fast and I'll try and take a look at the logs to see if I can find anything, thanks.
Campiotti
CC BY-SA 4.0
2019-12-16T18:16:05.770Z
There you go: http://www.mediafire.com/file/8zkvrlzi2na9mvx/logs.zip/file
Mikko109
CC BY-SA 4.0
2019-12-17T08:15:22.743Z
I searched your logs and I wasn't able to find any occurrences of `Email Address` or `Go!` nor did I find any warnings or errors... so long your translations are in a file that should've been loaded, such as `home.twig`, I'm really not sure what could be the cause of this not functioning....


BUT I have *one more thing for you to try*: [This Craft3 Free Translations Plugin](https://github.com/jan-dh/translator#readme) This allows managing/translating static translated strings from your templates directly in the Control-Panel. 
I hope this works/fixes it.
Campiotti
CC BY-SA 4.0
2019-12-17T20:23:34.150Z
Hi Campiotti, thank you so much for your help. My problem did get solved! When I deployed my site to a web server, it worked. I can't make it work on localhost tho.
Mikko109
CC BY-SA 4.0
2020-01-08T07:53:42.200Z
strange... glad that it works on your deployed site though!

Not sure if they'd be able to fix it but maybe make a bug report on the craft cms 3 github issues page, this might be a bug or it might be some misconfigured aspect of your local installation which isn't present on the deployed server.
Campiotti
CC BY-SA 4.0
2019-12-09T11:59:12.560Z
2019-12-09T11:59:12.560Z
Campiotti
<p>I am making a website with Craft 3 and I have some static text that needs to be translated.</p>

<p>I followed Craft's documentation on it. I created my <code>translations/fr/site.php</code> file and use the <code>{{ 'String'|t }}</code> format to translate my strings. </p>

<p>I tried everything I found on the web, but I can not make it work. My strings stay in english and doesn't translate. It doesn't even seem to access the <code>site.php</code> file. </p>

<p>I tried to clear my cache, restart my Docker container, change the folder name to <code>fr-CA</code> instead of <code>fr</code> ...  </p>

<p>I found another member here that had the same problem as me, but he updated Craft and it worked. My Craft configuration is up to date... </p>

<p>Is there something I am missing? </p>

<p>Thank you. </p>

CC BY-SA 4.0
2019-12-05T23:01:51.817Z
What do you get in an incognito window?
Oli
CC BY-SA 4.0
2019-12-06T10:43:16.027Z
Have you tried copying a working translation's English string and "statically" translating it in it's stead to check if that works? 
---
Example: `{{ welcome_message|t }}` let's say `welcome_message` is `Welcome User!` so you replace the dynamic reference as follows `{{ 'Welcome User!'|t }}`
---
If that works but your other static translations don't, then there's an error with your input string or your translation array having the wrong text as key.
Campiotti
CC BY-SA 4.0
2019-12-06T13:16:36.660Z
Hi, I did try with an incognito windows and it didn't work. And I don't use dynamic reference, I simply use plain static strings.
Mikko109
<localization>
Craft 3 doesn't translate static strings
# Craft 3 doesn't translate static strings

(Asked by: username_0 on 2019-12-05)

I am making a website with Craft 3 and I have some static text that needs to be translated.

I followed Craft's documentation on it. I created my `translations/fr/site.php` file and use the `{{ 'String'|t }}` format to translate my strings.

I tried everything I found on the web, but I can not make it work. My strings stay in english and doesn't translate. It doesn't even seem to access the `site.php` file.

I tried to clear my cache, restart my Docker container, change the folder name to `fr-CA` instead of `fr` ...

I found another member here that had the same problem as me, but he updated Craft and it worked. My Craft configuration is up to date...

Is there something I am missing?

Thank you.

**Tags:** localization

> **Comments:**
> **username_1**: What do you get in an incognito window?  
> **username_2**: Have you tried copying a working translation's English string and "statically" translating it in it's stead to check if that works?  --- Example: `{{ welcome_message|t }}` let's say `welcome_message` is `Welcome User!` so you replace the dynamic reference as follows `{{ 'Welcome User!'|t }}` --- If that works but your other static translations don't, then there's an error with your input string or your translation array having the wrong text as key.  
> **username_0**: Hi, I did try with an incognito windows and it didn't work. And I don't use dynamic reference, I simply use plain static strings.  

---

## 1 answers

### Answer by username_2 on 2019-12-09. Score: 2

I'm simply trying to follow the docs as good as possible.
Try the following:
Example String we'll be using: "cheese" | "fromage"

in your config/general.php make sure you have your siteUrl set as an array with at least two entries, example:'siteUrl' => ['my_site_en' => 'http://localhost:1234, 'my_site_fr => 'http://localhost:1234/fr/'];
in your translations/fr/site.php make sure it only contains the following
 'fromage',
];

in your twig file add the following {{ "cheese"|t }} 

4. important: Access your Control Panel (cpTrigger in config/general.php for the first part of the URL), => http://localhost:1234/%CP_TRIGGER%/settings/sites and make sure you have 2 sites, both in the same group, one in en, one in fr & their URLs must also be set!  It should look similar to this 
As long as all 4 steps are followed, it should work.
Hope this helps!

> **Comments:**
> **username_0**: I was seriously hoping this would work, but it didn't. I seriously don't know what I am doing wrong, but it is genuinely frustrating!  
> **username_2**: Alright well let's not give up just quite yet, we still have a few things we can try...  clear your logs `storage/logs/*` and then call an URL which *should* (if it worked) translate a string to another language.  After that please zip your entire `storage/logs` folder and upload it to some file-sharing website and post the link in the comments so I can take a look at it, I think that'd be a good place to check as the logs sometimes have some info which may get overlooked otherwise. (For example you could use https://send.firefox.com/)  
> **username_0**: Hi username_2. Here are the logs files: https://send.firefox.com/download/49de7f59e66f4879/#bm3SAgphYcNqYAG4yThKtA  The two lines I'm trying to translate are called "Email Address" and "Go!" in case it helps you find something.  
> **username_2**: Oh I forgot about the time-limit on the send.firefox.com downloads sorry! I miseed the download span and am now unable to download the logs... I think it might be better if a more non-temporary file hoster would be used like https://mediafire.com . Sorry about that, but could you please upload the logs once more but to that file hoster? Then the link wouldn't expire so fast and I'll try and take a look at the logs to see if I can find anything, thanks.  
> **username_0**: There you go: http://www.mediafire.com/file/8zkvrlzi2na9mvx/logs.zip/file  
> **username_2**: I searched your logs and I wasn't able to find any occurrences of `Email Address` or `Go!` nor did I find any warnings or errors... so long your translations are in a file that should've been loaded, such as `home.twig`, I'm really not sure what could be the cause of this not functioning....   BUT I have *one more thing for you to try*: [This Craft3 Free Translations Plugin](https://github.com/jan-dh/translator#readme) This allows managing/translating static translated strings from your templates directly in the Control-Panel.  I hope this works/fixes it.  
> **username_0**: Hi username_2, thank you so much for your help. My problem did get solved! When I deployed my site to a web server, it worked. I can't make it work on localhost tho.  
> **username_2**: strange... glad that it works on your deployed site though!  Not sure if they'd be able to fix it but maybe make a bug report on the craft cms 3 github issues page, this might be a bug or it might be some misconfigured aspect of your local installation which isn't present on the deployed server.  

---

