iam implement gettext on phalcon:
in service.php
$di->set('voltService', function ($view, $di) use ($config) {
$voltOptions = array();
$volt = new \Phalcon\Mvc\View\Engine\Volt($view, $di);
$compiler = $volt->getCompiler();
if ($config->application->debug) {
$voltOptions['compileAlways'] = true;
$volt->setOptions($voltOptions);
}
// Funcion para que volt reconozca multilenguaje
$compiler->addFunction('_', function($resolvedArgs) {
return 'gettext(' . $resolvedArgs . ')';
});
$compiler->addFilter('ucf', 'ucfirst');
$compiler->addFilter('flv', 'floatval');
return $volt;
});
in my boostrap:
$lang_default_client = $s_lang_cookie;
putenv("LANG=$lang_default_client");
setlocale(LC_ALL, 'C.UTF-8');
bindtextdomain("messages", APP_PATH . "public/locale/$lang_default_client");
bind_textdomain_codeset('messages', 'UTF-8');
textdomain("messages");
in my views:
{{ _('Enviar email al grupo de soporte') }}
;)