I'm trying to get gettext to work in a localserver, but it's just not working. It's not giving me any kind of error, it just returns my string in spanish instead of translating it to english.
This is index.php
<html>
<?php
$locale = "en_US";
putenv("LC_ALL=$locale");
setlocale(LC_ALL, $locale);
bindtextdomain("messages", "./locale");
bind_textdomain_codeset("messages", 'UTF-8');
textdomain("messages");
?>
<?= _("Volver al Panel") ?>
</htlm>
This is messages.po, located in locale/en_US/LC_MESSAGES/
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION
"
"Report-Msgid-Bugs-To:
"
"POT-Creation-Date: 2014-10-01 11:31-0300
"
"PO-Revision-Date: 2014-10-01 11:38-0300
"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>
"
"Language-Team: LANGUAGE <LL@li.org>
"
"MIME-Version: 1.0
"
"Content-Type: text/plain; charset=UTF-8
"
"Content-Transfer-Encoding: 8bit
"
"X-Generator: Poedit 1.5.4
"
#: index.php:10
msgid "Volver al Panel"
msgstr "Back to Panel"
Of course, i also create the messages.mo with "sudo msgfmt messages.po" without a problem.
The thing is it should return "Back to Panel" instead of "Volver al Panel", am i wrong?