خرید بک لینک

Vote count: 0

I'm trying to add translations to my webpage. Unfortunately my translation isn't being read.

However, one translation is read (even though I ask for a different one).

My php code looks like this:

    $language = "en_US"; //Hardcoded for debugging purposes
    define("FOLDER_SPECIFICATION", "./locale/");
    define("DOMAIN", "messages");
    define("CODE_SET", "UTF-8");

    putenv("LANG=" . $language);
    setlocale(LC_ALL, $language);

    bindtextdomain(DOMAIN, FOLDER_SPECIFICATION);
    bind_textdomain_codeset(DOMAIN, CODE_SET);

    textdomain(DOMAIN);

My folder structure looks like this:

root > 
    locale >
       en_US >
           LC_MESSAGES >
             messages.mo
             messages.po

       nl_NL >
           LC_MESSAGES >
             messages.mo
             messages.po

If I change the $language variable to en_US or nl_NL it still grabs the translation from nl_NL, if I remove the nl_NL folder it doesnt translate at all, this together means one thing: The en_US translation isn't being read.

Both messages.po contain headers and such and both are valid (I loaded them in poedit).

My question is: Why does it grab nl_NL even though I never told the code to grab it, and why isn't the other translation (en_US) being read?

Both .po files look like this (the 'Language' tag in the headers are obviously different):

msgid ""
msgstr ""
"Project-Id-Version: My Projectn"
"POT-Creation-Date: 2014-08-05 13:32+0100n"
"PO-Revision-Date: 2016-04-19 10:43+0200n"
"Last-Translator: n"
"Language-Team: someone <s.omeone@something.com> n"
"MIME-Version: 1.0n"
"Content-Type: text/plain; charset=UTF-8n"
"Content-Transfer-Encoding: 8bitn"
"X-Generator: Poedit 1.8.7n"
"X-Poedit-Basepath: .n"
"Plural-Forms: nplurals=2; plural=(n != 1);n"
"Language: nl_ULn"
"X-Poedit-SourceCharset: UTF-8n"

msgid "Banaan"
msgstr "Banana"

msgid "Appel"
msgstr "Apple"

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 6 ارديبهشت 1395 ساعت: 15:10

صفحه بندی