Skip to content
Extraits de code Groupes Projets
Valider dc0544c1 rédigé par Thomas Steur's avatar Thomas Steur
Parcourir les fichiers

refs #5863 we need to pass the langCode to loadPluginTranslations() otherwise...

refs #5863 we need to pass the langCode to loadPluginTranslations() otherwise langCode will be always an empty string. If there is no plugin loaded yet and no language generate a simple cache file for core translations, load a translation only if a langCode is there
parent 5d36a959
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -313,7 +313,7 @@ class FrontController extends Singleton
Filechecks::dieIfDirectoriesNotWritable($directoriesToCheck);
Translate::loadEnglishTranslation();
Plugin\Manager::getInstance()->loadPluginTranslations();
Plugin\Manager::getInstance()->loadPluginTranslations('en');
$exceptionToThrow = self::createConfigObject();
......
......@@ -650,9 +650,18 @@ class Manager extends Singleton
$language = Translate::getLanguageToLoad();
}
$cache = new CacheFile('tracker', 43200); // ttl=12hours
$cacheKey = 'PluginTranslations-' . $language;
$cacheKey .= '-' . md5(implode('', $this->getLoadedPluginsName())); // makes sure to create a translation in case loaded plugins change (ie Tests vs Tracker vs UI etc)
$cache = new CacheFile('tracker', 43200); // ttl=12hours
$cacheKey = 'PluginTranslations';
if (!empty($language)) {
$cacheKey .= '-' . trim($language);
}
if (!empty($this->loadedPlugins)) {
// makes sure to create a translation in case loaded plugins change (ie Tests vs Tracker vs UI etc)
$cacheKey .= '-' . md5(implode('', $this->getLoadedPluginsName()));
}
$translations = $cache->get($cacheKey);
if (!empty($translations) &&
......@@ -1015,7 +1024,10 @@ class Manager extends Singleton
}
// merge in specific language translations (to overwrite english defaults)
if ($defaultEnglishLangPath != $defaultLangPath && file_exists($defaultLangPath)) {
if (!empty($langCode) &&
$defaultEnglishLangPath != $defaultLangPath &&
file_exists($defaultLangPath)) {
$translations = $this->getTranslationsFromFile($defaultLangPath);
$translationsLoaded = true;
if (isset($translations[$pluginName])) {
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter