mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-20 03:16:12 +00:00
Refactoring setLocale()
This commit is contained in:
parent
6573e70ae3
commit
57e6e8d829
@ -91,7 +91,7 @@ class ApiControllerBase extends ControllerRoot
|
||||
{
|
||||
// disable view processing
|
||||
set_error_handler(array($this, 'APIErrorHandler'));
|
||||
self::setLocale();
|
||||
self::setLocale(self::getLangEncode());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -46,13 +46,15 @@ class ControllerBase extends ControllerRoot
|
||||
*/
|
||||
public function getTranslator()
|
||||
{
|
||||
$lang_encoding = self::getLangEncode();
|
||||
|
||||
$ret = new ViewTranslator(array(
|
||||
'directory' => '/usr/local/share/locale',
|
||||
'defaultDomain' => 'OPNsense',
|
||||
'locale' => "en_US.UTF-8",
|
||||
'locale' => $lang_encoding,
|
||||
));
|
||||
|
||||
self::setLocale();
|
||||
self::setLocale($lang_encoding);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
@ -49,9 +49,9 @@ class ControllerRoot extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Set locale for gettext
|
||||
* Get lang encoding for gettext
|
||||
*/
|
||||
public static function setLocale()
|
||||
public static function getLangEncode()
|
||||
{
|
||||
$lang = 'en_US';
|
||||
|
||||
@ -63,7 +63,14 @@ class ControllerRoot extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
$lang_encoding = $lang . '.UTF-8';
|
||||
return $lang . '.UTF-8';
|
||||
}
|
||||
|
||||
/**
|
||||
* Set locale for gettext
|
||||
*/
|
||||
public static function setLocale($lang_encoding)
|
||||
{
|
||||
$textdomain = 'OPNsense';
|
||||
|
||||
/* this isn't being done by Phalcon */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user