Hi there,
My directory structure is set up as explained here https://github.com/phalcon/incubator/tree/master/Library/Phalcon/Translate/Adapter, In my ControllerBase, I'have a function:
protected function _getTranslation()
{
return new Phalcon\Translate\Adapter\Gettext(array(
'locale' => 'fr_FR',
'file' => 'messages',
'directory' => '../app/lang'
));
}
messages.po and messages.mo are alvailable in app/lang/fr_FR/LC_MESSAGES
In IndexController, IndexAction:
$this->view->setVar("t", $this->_getTranslation());
And in index.volt view:
{{ t._('Hello') }}
But nothing is translated and I've got no errors... What am I doing wrong ?
########## SOLVED ###########
After double checking my code with xdebug, and being sure that everything is OK, I've inspected my gettext installation (linux debian 7): 1/ be sure that all the locales you need are activated in /etc/locale.gen 2/ generate them with locale-gen 3/ in Phalcon\Translate\Adapter\Gettext configuration array use for the locale : fr_FR.UTF8 (you have to specify the character encoding otherwise it won't work).