mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 17:58:41 +00:00
Dynamic language loading
This allows dynamic language loading. Could however conflict with the language loading for the navigation module?
This commit is contained in:
parent
ebafbe059a
commit
6c570fb63c
|
|
@ -118,7 +118,7 @@ class L11nManager
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getLanguage(string $language, string $module = null) : array
|
||||
public function getModuleLanguage(string $language, string $module = null) : array
|
||||
{
|
||||
if (!isset($module) && isset($this->language[$language])) {
|
||||
return $this->language[$language];
|
||||
|
|
@ -144,11 +144,16 @@ class L11nManager
|
|||
public function getText(string $code, string $module, string $translation)
|
||||
{
|
||||
if (!isset($this->language[$code][$module][$translation])) {
|
||||
$this->logger->warning(FileLogger::MSG_FULL, [
|
||||
'message' => 'Undefined translation for \'' . $code . '/' . $module . '/' . $translation . '\'.'
|
||||
]);
|
||||
$class = '\Modules\\' . $module . '\\Controller';
|
||||
$this->loadLanguage($code, $module, $class::getLocalization($code, $module));
|
||||
|
||||
return 'ERROR';
|
||||
if (!isset($this->language[$code][$module][$translation])) {
|
||||
$this->logger->warning(FileLogger::MSG_FULL, [
|
||||
'message' => 'Undefined translation for \'' . $code . '/' . $module . '/' . $translation . '\'.'
|
||||
]);
|
||||
|
||||
return 'ERROR';
|
||||
}
|
||||
}
|
||||
|
||||
return $this->language[$code][$module][$translation];
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ abstract class ModuleAbstract
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getLocalization(string $language, string $destination) : array
|
||||
public static function getLocalization(string $language, string $destination) : array
|
||||
{
|
||||
$lang = [];
|
||||
if (($path = realpath($oldPath = __DIR__ . '/../../Modules/' . static::MODULE_NAME . '/Theme/' . $destination . '/Lang/' . $language . '.lang.php')) !== false) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user