Load translation messages from all available modules

@param string $language
@return void
763843
private function loadTranslationMessages($language)
    {
        // Reset any previous translations if any
        $this->moduleManager->clearTranslations();
        $this->translator->reset();

        // Now load new ones
        $this->moduleManager->loadAllTranslations($language);
        $this->translator->extend($this->moduleManager->getTranslations());
    }
367124
private function LoadFrontendTranslations(Site $site)
    {
        $language = $site->GetLanguage()->GetCode();
        $frontendTranslations = PathUtil::FrontendBundleTranslationFile($this->BundleName(), $language);
        if (File::Exists($frontendTranslations))
        {
            require_once $frontendTranslations;
        }
        
    }
768192
public function loadTranslations($translations)
    {
        if (is_object($translations) && $translations instanceof Translations) {
            $translations = PhpArray::generate($translations, ['includeHeaders' => false]);
        } elseif (is_string($translations) && is_file($translations)) {
            $translations = include $translations;
        } elseif (!is_array($translations)) {
            throw new \InvalidArgumentException(
                'Invalid Translator: only arrays, files or instance of Translations are allowed'
            );
        }

        $this->addTranslations($translations);

        return $this;
    }
320025
public function loadLanguage($language)
    {
        if ($this->isLoaded($language)) {
            return;
        }

        $this->strings[$language] = [];
        $this->languagesLoaded[] = $language;
    }
623065
final protected function loadTranslations($language)
    {
        // Don't load the same language twice, if that's the case
        if ($this->appConfig->getLanguage() !== $language) {

            $this->appConfig->setLanguage($language);
            $this->loadTranslationMessages($language);
            return true;

        } else {
            return false;
        }
    }
685529
public function loadTranslations($languages)
    {
        $languages = (array)$languages;

        foreach ($languages as $language) {
            $this->getTranslation($language);
        }
    }
1156606
public function load($locale)
    {
        if ($this->isLoaded($locale)) {
            return;
        }
        $this->languages[$locale] = $this->handler->load($locale);
    }
671891
private function loadDefaultTranslations()
    {
        $language = $this->appConfig->getLanguage();

        if ($language !== null) {
            $this->loadTranslationMessages($language);
        }
    }
455833
public function getTranslation($language = null)
    {
        if ($language === null) {
            $language = $this->getLanguage();
        }

        if (!isset($this->owner->{$this->translationsAttribute}[$language])) {
            $this->owner->{$this->translationsAttribute}[$language] = $this->loadTranslation($language);
        }

        return $this->owner->{$this->translationsAttribute}[$language];
    }
5299
private function loadMessages($files, $trans)
    {
        $message = [];
        foreach ($files as $file) {
            // Merge the language strings into the sub message array
            if (is_readable($file)) {
                $message = array_merge($message, include $file);
            }
        }
        // Append to the sub message array, preventing overloading files
        $trans += $message;

        return $trans;
    }
313193
public function registerTranslations()
    {
        $langPath = resource_path('lang/modules/translate');

        if (is_dir($langPath)) {
            $this->loadTranslationsFrom($langPath, 'translate');
        } else {
            $this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'translate');
        }
    }
1373883
public function addLanguage($language)
    {
        $this->backup();

        file_put_contents($this->languageFilesPath.DIRECTORY_SEPARATOR."$language.json",
            json_encode((object) [], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT)
        );
    }
1284890
public function loadInLang($language, $oxid)
    {
        // set new lang to this object
        $this->setLanguage($language);
        // reset
        $this->_sViewTable = false;

        return $this->load($oxid);
    }
823002
public function setLang($lang = 'en-us') {
		$this->lang = $lang;

		try {
			$this->messages = parse_ini_file(__DIR__ . '/Lang/' . $this->lang . '.ini');
		} catch (Exception $e) {
			throw $e;
		}
	}
892752
private function loadModuleTranslation(AbstractModule $module, $language)
    {
        // Translations are optional
        if (method_exists($module, 'getTranslations')) {
            $translations = $module->getTranslations($language);

            // Only array must be provided, otherwise ignore another type
            if (is_array($translations)) {
                // If that's an array, then append translations
                foreach ($translations as $string => $translation) {
                    $this->translations[$string] = $translation;
                }

                // And indicate success
                return true;
            }
        }

        // Failure by default
        return false;
    }
740029
public function getMessages($category, $language)
    {
        $key = $language . '/' . $category;
        if (!isset($this->_messages[$key])) {
            $this->_messages[$key] = $this->loadMessages($category, $language);
        }

        return $this->_messages[$key];
    }
299981
protected function loadMessagesFromDb($category, $language)
    {
        $mainQuery = new Query();
        $mainQuery->select(['t1.message message', 't2.translation translation'])
            ->from(["$this->sourceMessageTable t1", "$this->messageTable t2"])
            ->where('t1.id = t2.id AND t1.category = :category AND t2.language = :language')
            ->params([':category' => $category, ':language' => $language]);

        $fallbackLanguage = substr($language, 0, 2);
        if ($fallbackLanguage != $language) {
            $fallbackQuery = new Query();
            $fallbackQuery->select(['t1.message message', 't2.translation translation'])
                ->from(["$this->sourceMessageTable t1", "$this->messageTable t2"])
                ->where('t1.id = t2.id AND t1.category = :category AND t2.language = :fallbackLanguage')
                ->andWhere("t2.id NOT IN (SELECT id FROM $this->messageTable WHERE language = :language)")
                ->params([':category' => $category, ':language' => $language, ':fallbackLanguage' => $fallbackLanguage]);

            $mainQuery->union($fallbackQuery, true);
        }

        $messages = $mainQuery->createCommand($this->db)->queryAll();

        return ArrayHelper::map($messages, 'message', 'translation');
    }