Here is my messages.po file
#
msgid "_greet1"
msgstr "Hello"
msgid "_greet2"
msgstr "Bye"
I get this po file compiled to mo file using PO Edit, and when I use the mo file inside translation code, I see msgid of the string instead of msgstr. I am using exactly same code written in PHP documentation for gettext.
Any suggestions...
I had the same problem and my folder path was correct too. The reason of the issue was that I was using 'pl_PL' as locale instead of 'pl_PL.utf8' (in source code and as a folder name).
Solution - remember about UTF-8:
Check in console what locales you have and what are their real names: locale -a
. (In case there is no locale you are interested on you can type: sudo apt-get install locales-all
)
Use correct locale name in your code, for instance: setlocale(LC_ALL, 'pl_PL.utf8');
*.mo
and *.po
file is: /var/www/project/locale/pl_PL.utf8/LC_MESSAGES