Elgg\I18n\Translator::loadPluginTranslations PHP 메소드

loadPluginTranslations() 개인적인 메소드

This is needed only if the current request uses a language that is neither English of the same as the language of the logged in user.
private loadPluginTranslations ( string $language ) : void
$language string Language code
리턴 void
    private function loadPluginTranslations($language)
    {
        // Get active plugins
        $plugins = _elgg_services()->plugins->find('active');
        if (!$plugins) {
            // Active plugins were not found, so no need to register plugin translations
            return;
        }
        foreach ($plugins as $plugin) {
            $languages_path = "{$plugin->getPath()}languages/";
            if (!is_dir($languages_path)) {
                // This plugin doesn't have anything to translate
                continue;
            }
            $language_file = "{$languages_path}{$language}.php";
            if (!file_exists($language_file)) {
                // This plugin doesn't have translations for the requested language
                $name = $plugin->getFriendlyName();
                _elgg_services()->logger->notice("Plugin {$name} is missing translations for {$language} language");
                continue;
            }
            // Register translations from the plugin languages directory
            if (!$this->registerTranslations($languages_path, false, $language)) {
                throw new \PluginException(sprintf('Cannot register languages for plugin %s (guid: %s) at %s.', array($plugin->getID(), $plugin->guid, $languages_path)));
            }
        }
    }