Skip to content

Commit

Permalink
feat(DropdownField): Load translation for plugin too
Browse files Browse the repository at this point in the history
  • Loading branch information
stonebuzz authored and btry committed Sep 29, 2023
1 parent fa142e2 commit 16a1379
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions inc/field/dropdownfield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@ public function parseObjectProperties(
// We need english locale to search searchOptions by name
$oldLocale = $TRANSLATE->getLocale();
$TRANSLATE->setLocale("en_GB");
$_SESSION['glpilanguage'] = "en_GB";
if ($plug = isPluginItemType($itemtype)) {
Plugin::loadLang(strtolower($plug['plugin']), "en_GB");
}
Expand All @@ -736,6 +737,7 @@ public function parseObjectProperties(
if (count($searchOption) == 0) {
trigger_error("No search option found for $property", E_USER_WARNING);
$TRANSLATE->setLocale($oldLocale);
$_SESSION['glpilanguage'] = $oldLocale;
return $content;
}

Expand Down Expand Up @@ -779,6 +781,7 @@ public function parseObjectProperties(
}
// Put the old locales on succes or if an expection was thrown
$TRANSLATE->setLocale($oldLocale);
$_SESSION['glpilanguage'] = $oldLocale;
if ($plug = isPluginItemType($itemtype)) {
Plugin::loadLang(strtolower($plug['plugin']), $oldLocale);
}
Expand Down

0 comments on commit 16a1379

Please sign in to comment.