I've been having problems getting the translations to work on my local WAMP (v2.5) server. Here is an example of the issue.
putenv("LANG=frc"); //output: 1
setlocale(LC_ALL, "frc"); //output: French_Canada.1252
$domain = 'messages';
bindtextdomain($domain, "locale"); //output: D:\wamp\www\[project folder]\locale
bind_textdomain_codeset($domain, 'UTF-8'); //output: UTF-8
textdomain($domain); //output: messages
echo gettext("Hello"); //output: Hello
And here is the folder structure:
locale
--> French_Canada.1252
--> LC_MESSAGES
--> messages.po
--> messages.mo
And finally the PO file:
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2016-02-10 14:01-0500\n"
"PO-Revision-Date: 2016-02-10 14:01-0500\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr_CA\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.2\n"
"X-Poedit-Basepath: ../../..\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Poedit-SearchPath-0: .\n"
#: test.php:11
msgid "Hello"
msgstr "Bonjour"
Here's what I've tried:
1) Uninstalling 64 bit WAMP and installing 32 bit WAMP in its place.
2) Using different locale codes like fr_CA, fr_FR, fr. fr is the only one that is recognized but I still had the same issue (even after renaming the folder to fr)
3) Changing the codeset to 1252 and Windows-1252 (In both the php file and the PO file)
4) Restarting all services after every change