mirror of
https://github.com/tips-of-mine/GLPI-Plugin-SOC-Case-Management.git
synced 2025-06-28 13:48:42 +02:00
Add multilanguage support to GLPI SOC Plugin
This commit is contained in:
20
plugin.php
20
plugin.php
@ -70,6 +70,9 @@ function plugin_init_soc() {
|
||||
$PLUGIN_HOOKS['javascript']['soc'] = ['/plugins/soc/js/soc.js'];
|
||||
$PLUGIN_HOOKS['add_css']['soc'] = ['/plugins/soc/css/soc.css'];
|
||||
|
||||
// Initialize translations
|
||||
$PLUGIN_HOOKS['init_translations']['soc'] = 'initTranslations';
|
||||
|
||||
if (Session::haveRight('plugin_soc_case', READ)) {
|
||||
$PLUGIN_HOOKS['menu_toadd']['soc'] = ['management' => 'PluginSocCase'];
|
||||
}
|
||||
@ -87,4 +90,21 @@ function plugin_init_soc() {
|
||||
'addtabtypes' => ['Ticket']
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize plugin translations
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function initTranslations() {
|
||||
global $CFG_GLPI;
|
||||
|
||||
$domain = 'soc';
|
||||
$locale_dir = GLPI_ROOT . '/plugins/soc/locales/';
|
||||
|
||||
if (file_exists($locale_dir)) {
|
||||
// Load plugin translations
|
||||
$GLOBALS['LANG']->addTranslationFile('gettext', $locale_dir, $domain, $_SESSION['glpilanguage']);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user