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)));
}
}
}