Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>this is what im doing in my cms:</p> <ul> <li>for <code>each</code> plugin/program/entity (you name it) i develop, i create a <code>/translations</code> folder.</li> <li>i put there all my translations, named like <strong>el.txt, de.txt, uk.txt</strong> etc. all languages</li> <li>i store the translation data in <strong>JSON</strong>, because its easy to store to, easy to read from and easiest for everyone to post theirs.</li> <li>files can be easily UTF8 encoded in-file without messing with databases, making it possible to read them in file-mode. (just <code>JSON.parse</code> them)</li> <li>on installation of such plugins, i just loop through all translations and put them in database, each language per table row. (etc. <code>a data column of TEXT datatype</code>)</li> <li>for each page render i just query once the database for taking this row of selected language, and call <code>json_decode()</code> to the whole result to get it once; then put it in a <strong>$_SESSION</strong> so the next time to <em>get flash-speed translated strings</em> for current selected language.</li> </ul> <p>the whole thing was developed having i mind both <strong>performance and compatibility</strong>.</p> <p>in your case a row in such file could be like:</p> <p>in <strong>en.txt</strong></p> <pre><code>{"id":"LNG_1","str":"My word"} </code></pre> <p>in <strong>de.txt</strong></p> <pre><code>{"id":"LNG_1","str":"Mein Wort"} </code></pre> <p>The current language could be stored in session like <strong>$_SESSION["language"];</strong> and use that as starting point. Then, you can read translations like:</p> <pre><code>lang("LNG_1"); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload