Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I finally got it to work, I am posting here so maybe it can help someone else, it is somewhat confusing the way it is documented I think. </p> <p>I will use FR for french for this demo</p> <pre><code>$locale = "fr_fr"; putenv("LC_ALL=$locale"); setlocale(LC_ALL, $locale); bindtextdomain("default", "/includes/locale"); textdomain("default"); </code></pre> <p>In the <strong><code>bindtextdomain</code> function</strong> above, the first param is the name of the .po language file minus the extension. The second param is the path to the folder, this is where is gets a little tricky/undocumented... In the folder you set here you have to create a folder for each language with it's 2 digit country code, then inside this country code folder I had to add this folder named <strong><code>LC_MESSAGES</code></strong>, inside <code>LC_MESSAGES</code> is where your <code>default.po</code> file goes. </p> <p>This was the only way I could get it to work, kind of confusing since the path to the lang folder does not mention anything about the bold part here: </p> <blockquote> <p>langfolder/<strong>fr_FR/LC_MESSAGES</strong>/default.po</p> </blockquote> <p>It is still really strange though, <code>default.po</code> works for me but if I change it to something else in the code above and then change the filename of the .po and .mo files to match it will no longer work, only works with <code>default</code> name for me, I am starting to think maybe gettext does some sort of behind the scenes caching</p>
    singulars
    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