<p>I assume this is for a language that the CP hasn't been translated into, yet?</p>

<p>If so, maybe the better solution here is to help us get the CP translated into that language at which point we'll officially start supporting it in future releases.  We're currently managing our translations on PhraseApp (<a href="http://phraseapp.com" rel="nofollow">http://phraseapp.com</a>) and gladly accept contributions.</p>

CC BY-SA 3.0
2014-06-15T02:35:27.417Z
Ouups Brad, didn't talk about stings of the CP but static stings in the template being translated with |translate filter. Added a link to make this clearer. Sometimes having trouble to articulate what I want in english O.o !
carlcs
CC BY-SA 3.0
2014-06-15T02:38:53.283Z
Ahh... no worries. I can guarantee you that your English is far superior my attempt at your native language.
Brad Bell
CC BY-SA 3.0
2014-06-15T02:41:16.120Z
lol you speak german?
carlcs
CC BY-SA 3.0
2014-06-15T02:48:41.773Z
Ich bin ein Berliner!
Brad Bell
CC BY-SA 3.0
2014-06-15T03:26:51.573Z
definitely a bun -- though I had a quite educated man assure me that what John Kennedy said was 'perfectly fine'. For the spirit of it, unquestionably. We forget too easily, under our own propaganda -- of certain parties.
narration_sd
CC BY-SA 3.0
2014-06-15T02:24:00.440Z
2014-06-15T02:24:00.440Z
Brad Bell
<p>I'm pretty new to Craft but I'll tell you what I'd try anyway for fun.</p>

<p>I'd create a "Translations" assets source that would hold files like <code>es.csv</code>.</p>

<p>Then, in <code>craft/translations/es.php</code>, I'd run through that CSV and build the array Craft wants and return it.</p>

<pre class="lang-php prettyprint-override"><code>&lt;?php

$path = $_SERVER['DOCUMENT_ROOT'].'/../craft/translations/translations.csv';
$delimiter = ';';
$skip_rows = 1; //skip header rows
$primary_locale_column = 0; //set primary locale column
$this_locale_column = 1; //set secondary locale column for this `lang.php` file

$translations = array();
$translations_file = fopen($path, 'r');

if ($translations_file) {
    while(($translation = fgetcsv($translations_file, 1024, $delimiter)) !== FALSE) {
        if($skip_rows != 0) { $skip_rows--; continue; }
        $translations[$translation[$primary_locale_column]] = $translation[$this_locale_column];
    }
}

return $translations;
</code></pre>

<p><s>This is totally untested.</s></p>

CC BY-SA 3.0
2014-08-06T08:43:56.180Z
Just tested this and it works like a charm, Bill & @Lindsey!
carlcs
CC BY-SA 3.0
2014-08-06T09:40:26.600Z
Very nice side effect of this technique is, that you can now manage all your translations in one csv file. Made some edits to the code to make this more easy. Hope you didn't mind, Bill!
carlcs
CC BY-SA 3.0
2014-08-06T13:10:19.317Z
I do not mind at all! I'm glad it worked out. How did you get them all into one sheet? Just a `lang` column?
Bill Criswell
CC BY-SA 3.0
2014-08-06T15:33:25.800Z
Yes. Just copy the script into each lang.php file (es.php, fr.php, de.php, etc.) and change the value of `$this_locale_column`.
carlcs
CC BY-SA 3.0
2014-06-15T02:52:27.920Z
Wow Bill, this is what I'd call a creative answer! :) Thanks. Will definitely try that (so you don't have to, hehe). A csv is without a doubt better then a php-array, but actually I was hoping for some nice html form or sth. Thanks again!
carlcs
CC BY-SA 3.0
2014-06-15T03:10:57.460Z
No problem! Hopefully it can help you get to a solution you want.
Bill Criswell
CC BY-SA 3.0
2014-06-15T03:14:07.893Z
That's a very clever solution! I'm curious to hear if this works... Please let us know @ChristianSeelbach!
Lindsey D
CC BY-SA 3.0
2016-06-17T17:21:56.113Z
This solution is working great for me. I'm wondering if there is a way to adapt the code so that it could allow for comments and empty lines within the CSV file storing the static translations. The ability to add a few comments and add some spacing between groups of translated items would be great. So far, any attempt at comments or empty lines has broken the functionality. I don't know much php.
Justin K
CC BY-SA 3.0
2014-06-15T02:32:16.213Z
2014-08-06T09:38:06.463Z
2014-08-06T09:38:06.463Z
Bill Criswell
<p>It is <a href="http://buildwithcraft.com/help/static-translations" rel="nofollow">beautifully described</a> in the docs how to translate static text using translation files.</p>

<p>As the client has no access to that file and managing a php array is not what I want them to do, I am looking for a way to make edits to the translation file feasible directly in the Control Panel.</p>

<p>This would allow me to set things up in the template and then hand off the actual translation work to someone else.</p>

<p>Yes, you probably have to write a plugin for that. But can you edit the files from a plugin? Is there any API or service available that might help?</p>

<localization>
Is it possible to manage language translations without directly accessing the PHP translations file?
# Is it possible to manage language translations without directly accessing the PHP translations file?

(Asked by: username_0 on 2014-06-15)

It is [beautifully described](http://buildwithcraft.com/help/static-translations) in the docs how to translate static text using translation files.

As the client has no access to that file and managing a php array is not what I want them to do, I am looking for a way to make edits to the translation file feasible directly in the Control Panel.

This would allow me to set things up in the template and then hand off the actual translation work to someone else.

Yes, you probably have to write a plugin for that. But can you edit the files from a plugin? Is there any API or service available that might help?

**Tags:** localization


---

## 2 answers

### Answer by username_3 on 2014-06-15. Score: 5 | Accepted answer

I'm pretty new to Craft but I'll tell you what I'd try anyway for fun.
I'd create a "Translations" assets source that would hold files like es.csv.
Then, in craft/translations/es.php, I'd run through that CSV and build the array Craft wants and return it.

This is totally untested.

> **Comments:**
> **username_0**: Wow Bill, this is what I'd call a creative answer! :) Thanks. Will definitely try that (so you don't have to, hehe). A csv is without a doubt better then a php-array, but actually I was hoping for some nice html form or sth. Thanks again!  
> **username_3**: No problem! Hopefully it can help you get to a solution you want.  
> **username_4**: That's a very clever solution! I'm curious to hear if this works... Please let us know @ChristianSeelbach!  
> **username_0**: Just tested this and it works like a charm, Bill & @Lindsey!  
> **username_0**: Very nice side effect of this technique is, that you can now manage all your translations in one csv file. Made some edits to the code to make this more easy. Hope you didn't mind, Bill!  
> **username_3**: I do not mind at all! I'm glad it worked out. How did you get them all into one sheet? Just a `lang` column?  
> **username_0**: Yes. Just copy the script into each lang.php file (es.php, fr.php, de.php, etc.) and change the value of `$this_locale_column`.  
> **username_5**: This solution is working great for me. I'm wondering if there is a way to adapt the code so that it could allow for comments and empty lines within the CSV file storing the static translations. The ability to add a few comments and add some spacing between groups of translated items would be great. So far, any attempt at comments or empty lines has broken the functionality. I don't know much php.  

---

### Answer by username_1 on 2014-06-15. Score: 0

I assume this is for a language that the CP hasn't been translated into, yet?

If so, maybe the better solution here is to help us get the CP translated into that language at which point we'll officially start supporting it in future releases. We're currently managing our translations on PhraseApp (<http://phraseapp.com>) and gladly accept contributions.

> **Comments:**
> **username_0**: Ouups Brad, didn't talk about stings of the CP but static stings in the template being translated with |translate filter. Added a link to make this clearer. Sometimes having trouble to articulate what I want in english O.o !  
> **username_1**: Ahh... no worries. I can guarantee you that your English is far superior my attempt at your native language.  
> **username_0**: lol you speak german?  
> **username_1**: Ich bin ein Berliner!  
> **username_2**: definitely a bun -- though I had a quite educated man assure me that what John Kennedy said was 'perfectly fine'. For the spirit of it, unquestionably. We forget too easily, under our own propaganda -- of certain parties.  

---

