mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-10 22:18:40 +00:00
Removing l11nManager from l11n
This commit is contained in:
parent
dd80569a88
commit
1a017e6719
|
|
@ -31,13 +31,6 @@ use phpOMS\Datatypes\Exception\InvalidEnumValue;
|
||||||
class Localization
|
class Localization
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* Localization manager.
|
|
||||||
*
|
|
||||||
* @var L11nManager
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public $l11nManager = null;
|
|
||||||
/**
|
/**
|
||||||
* Country ID.
|
* Country ID.
|
||||||
*
|
*
|
||||||
|
|
@ -136,9 +129,8 @@ class Localization
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
*/
|
*/
|
||||||
public function __construct(L11nManager $l11nManager = null)
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->l11nManager = $l11nManager;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -324,21 +316,4 @@ class Localization
|
||||||
{
|
{
|
||||||
$this->thousands = $thousands;
|
$this->thousands = $thousands;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get translation.
|
|
||||||
*
|
|
||||||
* @param string $module Module name
|
|
||||||
* @param string $theme Theme name
|
|
||||||
* @param string $translation Text
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getText(string $module, string $theme, string $translation)
|
|
||||||
{
|
|
||||||
return $this->l11nManager->getText($this->language, $module, $theme, $translation);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -338,6 +338,33 @@ class View implements \Serializable
|
||||||
$this->data[$id] = $data;
|
$this->data[$id] = $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get translation.
|
||||||
|
*
|
||||||
|
* @param string $module Module name
|
||||||
|
* @param string $theme Theme name
|
||||||
|
* @param string $translation Text
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
*/
|
||||||
|
public function getText(string $translation, string $module = null, string $theme = null)
|
||||||
|
{
|
||||||
|
if(!isset($module)) {
|
||||||
|
$match = '/Theme/';
|
||||||
|
$module = ($start = strripos($this->template, $match)) !== false ? substr($this->template, ($offset = $start+strlen($match)), strpos($this->template, '/', $offset)) : throw new \Exception('Unknown Theme');
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($theme)) {
|
||||||
|
$match = '/Modules/';
|
||||||
|
$module = ($start = strripos($this->template, $match)) !== false ? substr($this->template, ($offset = $start+strlen($match)), strpos($this->template, '/', $offset)) : throw new \Exception('Unknown Module');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->app->l11nManager->getText($this->l11n->getLanguage(), $module, $theme, $translation);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Arrayify view and it's subviews.
|
* Arrayify view and it's subviews.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user