diff --git a/Localization/L11nManager.php b/Localization/L11nManager.php index 60f7fe71a..68cf4d21c 100644 --- a/Localization/L11nManager.php +++ b/Localization/L11nManager.php @@ -108,6 +108,34 @@ class L11nManager } } + /** + * Load language from file. + * + * One module can only be loaded once. Once the module got loaded it's not + * possible to load more language files later on. + * + * @param string $language Language iso code + * @param string $from Module name + * @param string $file File to import language from + * + * @return void + * + * @throws + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function loadLanguageFromFile(string $language, string $from, string $file) + { + $lang = []; + if (file_exists(file)) { + /** @noinspection PhpIncludeInspection */ + $lang = include $file; + } + + $this->loadLanguage($language, $from, $lang); + } + /** * Get application language. *