Skip to content

Commit 6af1766

Browse files
stonebuzzbtry
authored andcommitted
feat(DropdownField): Load translation for plugin too
1 parent 78d4d41 commit 6af1766

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

inc/field/dropdownfield.class.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@
6363
use QueryUnion;
6464
use GlpiPlugin\Formcreator\Exception\ComparisonException;
6565
use Glpi\Application\View\TemplateRenderer;
66+
use Plugin;
67+
6668
class DropdownField extends PluginFormcreatorAbstractField
6769
{
6870
const ENTITY_RESTRICT_USER = 1;
@@ -713,6 +715,9 @@ public function parseObjectProperties(
713715
// We need english locale to search searchOptions by name
714716
$oldLocale = $TRANSLATE->getLocale();
715717
$TRANSLATE->setLocale("en_GB");
718+
if ($plug = isPluginItemType($itemtype)) {
719+
Plugin::loadLang(strtolower($plug['plugin']), "en_GB");
720+
}
716721

717722
$item = new $itemtype;
718723
$item->getFromDB($answer);
@@ -774,6 +779,10 @@ public function parseObjectProperties(
774779
}
775780
// Put the old locales on succes or if an expection was thrown
776781
$TRANSLATE->setLocale($oldLocale);
782+
if ($plug = isPluginItemType($itemtype)) {
783+
Plugin::loadLang(strtolower($plug['plugin']), $oldLocale);
784+
}
785+
777786
return $content;
778787
}
779788

0 commit comments

Comments
 (0)