From 6e15211e0a1b9672de29fc684d1c90f25f0032a1 Mon Sep 17 00:00:00 2001 From: Walid Date: Mon, 18 Aug 2014 19:24:12 +0200 Subject: [PATCH] closes #4 load loading itemtype locale --- inc/type.class.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/inc/type.class.php b/inc/type.class.php index 5828f0c8..91f0c48b 100644 --- a/inc/type.class.php +++ b/inc/type.class.php @@ -1339,13 +1339,15 @@ static function registerOneType($itemtype) { * @return nothing */ static function includeLocales($name) { - global $CFG_GLPI; + global $CFG_GLPI,$LANG; $prefix = GENERICOBJECT_LOCALES_PATH . "/$name/$name"; + //Dirty hack because the plugin doesn't support gettext... + $language= str_replace('.mo', '', $CFG_GLPI["languages"][$_SESSION["glpilanguage"]][1]); if (isset ($_SESSION["glpilanguage"]) - && file_exists($prefix . "." . $CFG_GLPI["languages"][$_SESSION["glpilanguage"]][1])) { - include_once ($prefix . "." . $CFG_GLPI["languages"][$_SESSION["glpilanguage"]][1]); - + && file_exists("$prefix.$language.php")) { + include_once ("$prefix.$language.php"); + } else { if (file_exists($prefix . ".en_GB.php")) { include_once ($prefix . ".en_GB.php"); @@ -1660,4 +1662,4 @@ static function uninstall() { $query = "DROP TABLE IF EXISTS `glpi_plugin_genericobject_types`"; $DB->query($query) or die($DB->error()); } -} \ No newline at end of file +}