Hello, I'm trying to configure a multilingual Phalcon website using Phalcon\Translate\Adapter\Gettext but it seems i'm making some mistakes that i can't figure out where they are.
I just only see the strings untranslated. For example if a echo this:
echo $this->translation->_("hola-mundo");
But I get this:
hola-mundo
First of all, I'm starting a new project via console:
phalcon project translate-gettext
Then I register the new service:
use Phalcon\Translate\Adapter\Gettext as TranslationService;
$di->setShared('translation', function () use ($di)
{
    $translate = new TranslationService(array(
        'locale'        => 'es_ES',
        'file'          => 'messages',
        'defaultDomain' => 'messages',
        'directory'     => APP_PATH . '/languages/',
        'category'      => LC_MESSAGES,
    ));
    return $translate;
});
My APP_PATH is at (config.php):
defined('APP_PATH') || define('APP_PATH', BASE_PATH . '/app');
In ControllerBase.php, I create the method initialize() and set a var to use it inside my volt files (but, for this sample, I will not use it):
public function initialize()
{
    $this->view->setVars([
        't' => $this->translation
    ]);
}
Then, in IndexController.php:
public function indexAction()
{
    echo $this->translation->_("hola-mundo");
    $this->view->disable();
}
Now, I create the language directories:
app/languages/es_ES/LC_MESSAGES/
With Poedit, I start a new translation file, with español(España) as my language
I save the file inside app/languages/es_ES/LC_MESSAGES/ as messages.po
Then, I extract the strings form the source code, defining the directories to find these strings as app/
It detects me the string at IndexController.php, then I translate it, save the file, and Poedit inserts the string inside messages.po and compile it to messages.mo
This is the messages.po:
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2016-10-01 11:57+0200\n"
"PO-Revision-Date: 2016-10-01 11:58+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es_ES\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.9\n"
"X-Poedit-Basepath: ../../..\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-SearchPath-0: .\n"
#: controllers/IndexController.php:11
msgid "hola-mundo""
msgstr "Hola Mundo!"
OK, I think I made it all in the right way, then I visited the website (https://www.phalcon.dev/translate-gettext/) and it showed me:
hola-mundo
So, it is not working
What am I doing wrong?
I have echoed the language directory to view if it is correct:
echo $this->translation->getDirectory();
And it is ok:
/var/www/vhosts/phalcon.dev/translate-gettext/app/languages/
I have tried changing the language to en_US -> no changes at all
Also, changing the directory name to es_ES.utf8 and the 'locale' variable to 'es_ES.utf8' Apache gaves me an "500 Internal Server Error" This is the line in apache_error.log:
[error] [client ::1] FastCGI: incomplete headers (0 bytes) received from server "/Applications/MAMP/fcgi-bin/php7.0.10.fcgi", referer: https://www.phalcon.dev/
I thought I made all the steps in the right way, but it seems I don't.
Please, I need some help to make work this simple thing