Commit c5e28bf2 authored by Franco Fichtner's avatar Franco Fichtner

mvc: fixup the translation plumbing for #406

Still missing language picking, will follow soon.
parent a5720ef1
<?php <?php
/** /**
* Copyright (C) 2015 Deciso B.V. * Copyright (C) 2015 Deciso B.V.
* *
...@@ -31,7 +32,6 @@ namespace OPNsense\Base; ...@@ -31,7 +32,6 @@ namespace OPNsense\Base;
use OPNsense\Core\Config; use OPNsense\Core\Config;
use Phalcon\Mvc\Controller; use Phalcon\Mvc\Controller;
use Phalcon\Translate\Adapter\Gettext; use Phalcon\Translate\Adapter\Gettext;
use Phalcon\Translate\Adapter\NativeArray;
/** /**
* Class ControllerBase implements core controller for OPNsense framework * Class ControllerBase implements core controller for OPNsense framework
...@@ -41,25 +41,23 @@ class ControllerBase extends ControllerRoot ...@@ -41,25 +41,23 @@ class ControllerBase extends ControllerRoot
{ {
/** /**
* translate a text * translate a text
* @return NativeArray * @return Gettext
*/ */
public function getTranslator() public function getTranslator()
{ {
/* $lang = 'en_US'; /* XXX select proper language */
if (function_exists("gettext")) { $lang_encoding = $lang . '.UTF-8';
// gettext installed, return gettext translator
return new Gettext(array( $ret = new Gettext(array(
"locale" => "en_US", 'directory' => '/usr/local/share/locale',
"directory" => "/usr/local/share/locale/", 'defaultDomain' => 'OPNsense',
'file' => 'LC_MESSAGES/OPNsense.pot', 'locale' => $lang_encoding,
));
} else {
*/
// no gettext installed, return original content
return new NativeArray(array(
"content" => array()
)); ));
//}
/* this isn't being done by Phalcon */
putenv('LANG=' . $lang_encoding);
return $ret;
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment