translate all labels of menus before passing them to the method to show the menu

This commit is contained in:
Uwe Steinmann 2022-09-08 09:50:33 +02:00
parent 12599bd712
commit 4d5139fe82
2 changed files with 18 additions and 18 deletions

View File

@ -342,14 +342,14 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
if (!$this->params['user']->isGuest()) {
$menuitems = array();
if ($accessobject->check_view_access('MyDocuments'))
$menuitems['my_documents'] = array('link'=>$this->params['settings']->_httpRoot."out/out.MyDocuments.php?inProcess=1", 'label'=>'my_documents');
$menuitems['my_documents'] = array('link'=>$this->params['settings']->_httpRoot."out/out.MyDocuments.php?inProcess=1", 'label'=>getMLText('my_documents'));
if ($accessobject->check_view_access('MyAccount'))
$menuitems['my_account'] = array('link'=>$this->params['settings']->_httpRoot."out/out.MyAccount.php", 'label'=>'my_account');
$menuitems['my_account'] = array('link'=>$this->params['settings']->_httpRoot."out/out.MyAccount.php", 'label'=>getMLText('my_account'));
if($this->hasHook('userMenuItems'))
$menuitems = $this->callHook('userMenuItems', $menuitems);
if($menuitems) {
foreach($menuitems as $menuitem) {
echo "<li><a href=\"".$menuitem['link']."\">".getMLText($menuitem['label'])."</a></li>";
echo "<li><a href=\"".$menuitem['link']."\">".$menuitem['label']."</a></li>";
}
echo " <li class=\"divider\"></li>\n";
}
@ -430,11 +430,11 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
echo " <ul class=\"nav\">\n";
$menuitems = array();
/* calendar {{{ */
if ($this->params['enablecalendar'] && $accessobject->check_view_access('Calendar')) $menuitems['calendar'] = array('link'=>$this->params['settings']->_httpRoot.'out/out.Calendar.php?mode='.$this->params['calendardefaultview'], 'label'=>"calendar");
if ($this->params['user']->isAdmin()) $menuitems['admintools'] = array('link'=>$this->params['settings']->_httpRoot.'out/out.AdminTools.php', 'label'=>"admin_tools");
if ($this->params['enablecalendar'] && $accessobject->check_view_access('Calendar')) $menuitems['calendar'] = array('link'=>$this->params['settings']->_httpRoot.'out/out.Calendar.php?mode='.$this->params['calendardefaultview'], 'label'=>getMLText("calendar"));
if ($this->params['user']->isAdmin()) $menuitems['admintools'] = array('link'=>$this->params['settings']->_httpRoot.'out/out.AdminTools.php', 'label'=>getMLText("admin_tools"));
if($this->params['enablehelp']) {
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$menuitems['help'] = array('link'=>$this->params['settings']->_httpRoot.'out/out.Help.php?context='.$tmp[1], 'label'=>"help");
$menuitems['help'] = array('link'=>$this->params['settings']->_httpRoot.'out/out.Help.php?context='.$tmp[1], 'label'=>getMLText("help"));
}
/* }}} End of calendar */
@ -444,14 +444,14 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
foreach($menuitems as $menuitem) {
if(!empty($menuitem['children'])) {
echo " <li class=\"dropdown\">\n";
echo " <a class=\"dropdown-toggle\" data-toggle=\"dropdown\">".getMLText($menuitem['label'])." <i class=\"fa fa-caret-down\"></i></a>\n";
echo " <a class=\"dropdown-toggle\" data-toggle=\"dropdown\">".$menuitem['label']." <i class=\"fa fa-caret-down\"></i></a>\n";
echo " <ul class=\"dropdown-menu\" role=\"menu\">\n";
foreach($menuitem['children'] as $submenuitem) {
echo " <li><a href=\"".$submenuitem['link']."\"".(isset($submenuitem['target']) ? ' target="'.$submenuitem['target'].'"' : '').">".getMLText($submenuitem['label'])."</a></li>\n";
echo " <li><a href=\"".$submenuitem['link']."\"".(isset($submenuitem['target']) ? ' target="'.$submenuitem['target'].'"' : '').">".$submenuitem['label']."</a></li>\n";
}
echo " </ul>\n";
} else {
echo "<li><a href=\"".$menuitem['link']."\"".(isset($menuitem['target']) ? ' target="'.$menuitem['target'].'"' : '').">".getMLText($menuitem['label'])."</a></li>";
echo "<li><a href=\"".$menuitem['link']."\"".(isset($menuitem['target']) ? ' target="'.$menuitem['target'].'"' : '').">".$menuitem['label']."</a></li>";
}
}
echo " </ul>\n";

View File

@ -337,11 +337,11 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
echo " <ul class=\"navbar-nav\">\n";
$menuitems = array();
/* calendar {{{ */
if ($this->params['enablecalendar'] && $accessobject->check_view_access('Calendar')) $menuitems['calendar'] = array('link'=>$this->params['settings']->_httpRoot.'out/out.Calendar.php?mode='.$this->params['calendardefaultview'], 'label'=>"calendar");
if ($this->params['user']->isAdmin()) $menuitems['admintools'] = array('link'=>$this->params['settings']->_httpRoot.'out/out.AdminTools.php', 'label'=>"admin_tools");
if ($this->params['enablecalendar'] && $accessobject->check_view_access('Calendar')) $menuitems['calendar'] = array('link'=>$this->params['settings']->_httpRoot.'out/out.Calendar.php?mode='.$this->params['calendardefaultview'], 'label'=>getMLText("calendar"));
if ($this->params['user']->isAdmin()) $menuitems['admintools'] = array('link'=>$this->params['settings']->_httpRoot.'out/out.AdminTools.php', 'label'=>getMLText("admin_tools"));
if($this->params['enablehelp']) {
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$menuitems['help'] = array('link'=>$this->params['settings']->_httpRoot.'out/out.Help.php?context='.$tmp[1], 'label'=>"help");
$menuitems['help'] = array('link'=>$this->params['settings']->_httpRoot.'out/out.Help.php?context='.$tmp[1], 'label'=>getMLText("help"));
}
/* }}} End of calendar */
@ -351,14 +351,14 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
foreach($menuitems as $menuitem) {
if(!empty($menuitem['children'])) {
echo " <li class=\"nav-item dropdown\">\n";
echo " <a class=\"nav-link dropdown-toggle\" data-toggle=\"dropdown\">".getMLText($menuitem['label'])."</a>\n";
echo " <a class=\"nav-link dropdown-toggle\" data-toggle=\"dropdown\">".$menuitem['label']."</a>\n";
echo " <div class=\"dropdown-menu dropdown-menu-left\">\n";
foreach($menuitem['children'] as $submenuitem) {
echo " <a class=\"dropdown-item\" href=\"".$submenuitem['link']."\"".(isset($submenuitem['target']) ? ' target="'.$submenuitem['target'].'"' : '').">".getMLText($submenuitem['label'])."</a>\n";
echo " <a class=\"dropdown-item\" href=\"".$submenuitem['link']."\"".(isset($submenuitem['target']) ? ' target="'.$submenuitem['target'].'"' : '').">".$submenuitem['label']."</a>\n";
}
echo " </div>\n";
} else {
echo "<li class=\"nav-item\"><a class=\"nav-link\" href=\"".$menuitem['link']."\"".(isset($menuitem['target']) ? ' target="'.$menuitem['target'].'"' : '').">".getMLText($menuitem['label'])."</a></li>";
echo "<li class=\"nav-item\"><a class=\"nav-link\" href=\"".$menuitem['link']."\"".(isset($menuitem['target']) ? ' target="'.$menuitem['target'].'"' : '').">".$menuitem['label']."</a></li>";
}
}
echo " </ul>\n";
@ -408,14 +408,14 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
if (!$this->params['user']->isGuest()) {
$menuitems = array();
if ($accessobject->check_view_access('MyDocuments'))
$menuitems['my_documents'] = array('link'=>$this->params['settings']->_httpRoot."out/out.MyDocuments.php?inProcess=1", 'label'=>'my_documents');
$menuitems['my_documents'] = array('link'=>$this->params['settings']->_httpRoot."out/out.MyDocuments.php?inProcess=1", 'label'=>getMLText('my_documents'));
if ($accessobject->check_view_access('MyAccount'))
$menuitems['my_account'] = array('link'=>$this->params['settings']->_httpRoot."out/out.MyAccount.php", 'label'=>'my_account');
$menuitems['my_account'] = array('link'=>$this->params['settings']->_httpRoot."out/out.MyAccount.php", 'label'=>getMLText('my_account'));
if($this->hasHook('userMenuItems'))
$menuitems = $this->callHook('userMenuItems', $menuitems);
if($menuitems) {
foreach($menuitems as $menuitem) {
echo " <a class=\"dropdown-item\" href=\"".$menuitem['link']."\">".getMLText($menuitem['label'])."</a>\n";
echo " <a class=\"dropdown-item\" href=\"".$menuitem['link']."\">".$menuitem['label']."</a>\n";
}
echo " <div class=\"dropdown-divider\"></div>\n";
}