Elgg\I18n\Translator::ensureTranslationsLoaded PHP Method

ensureTranslationsLoaded() private method

Make sure translations are loaded
private ensureTranslationsLoaded ( string $language ) : void
$language string Language
return void
    private function ensureTranslationsLoaded($language)
    {
        if (!isset($GLOBALS['_ELGG']->translations)) {
            // this means we probably had an exception before translations were initialized
            $this->registerTranslations($this->defaultPath);
        }
        if (!isset($GLOBALS['_ELGG']->translations[$language])) {
            // The language being requested is not the same as the language of the
            // logged in user, so we will have to load it separately. (Most likely
            // we're sending a notification and the recipient is using a different
            // language than the logged in user.)
            $this->loadTranslations($language);
        }
    }