Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-15T02:35:27.417Z
Answers.Text: 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 !
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-15T02:38:53.283Z
Answers.Text: Ahh... no worries. I can guarantee you that your English is far superior my attempt at your native language.
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-15T02:41:16.120Z
Answers.Text: lol you speak german?
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-15T02:48:41.773Z
Answers.Text: Ich bin ein Berliner!
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-15T03:26:51.573Z
Answers.Text: 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.
Answers.UserDisplayName: narration_sd
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-15T02:24:00.440Z
Answers.LastActivityDate: 2014-06-15T02:24:00.440Z
Answers.UserDisplayName: Brad Bell
Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-06T08:43:56.180Z
Answers.Text: Just tested this and it works like a charm, Bill & @Lindsey!
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-06T09:40:26.600Z
Answers.Text: 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!
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-06T13:10:19.317Z
Answers.Text: 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?
Answers.UserDisplayName: Bill Criswell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-06T15:33:25.800Z
Answers.Text: 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`.
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-15T02:52:27.920Z
Answers.Text: 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!
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-15T03:10:57.460Z
Answers.Text: No problem! Hopefully it can help you get to a solution you want.
Answers.UserDisplayName: Bill Criswell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-15T03:14:07.893Z
Answers.Text: That's a very clever solution! I'm curious to hear if this works... Please let us know @ChristianSeelbach!
Answers.UserDisplayName: Lindsey D
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-17T17:21:56.113Z
Answers.Text: 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.
Answers.UserDisplayName: Justin K
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-15T02:32:16.213Z
Answers.LastActivityDate: 2014-08-06T09:38:06.463Z
Answers.LastEditDate: 2014-08-06T09:38:06.463Z
Answers.UserDisplayName: Bill Criswell
Body: <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>
  
Tags: <localization>
Title: Is it possible to manage language translations without directly accessing the PHP translations file?
ThreadText: # 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.
  
  ```php
  <?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;
  
  ```
  
  ~~This is totally untested.~~
  
  > **Comments:**
  > **username_0**: Wow username_3, 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, username_3 & @username_4!  
  > **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, username_3!  
  > **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 username_1, 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.  
  
  ---
  
  