BUGFIX Fixed i18n display of menu titles rendered by CMSMenu in LeftAndMain->MainMenu()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@68176 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-12-10 08:57:40 +00:00 committed by Sam Minnee
parent e52672b314
commit c09aed0fda
2 changed files with 7 additions and 3 deletions

View File

@ -50,10 +50,13 @@ class CMSMenu extends Object implements Iterator, i18nEntityProvider
$rule => $controllerClass
));
// doesn't work if called outside of a controller context (e.g. in _config.php)
// as the locale won't be detected properly. Use {@link LeftAndMain->MainMenu()} to update
// titles for existing menu entries
$defaultTitle = LeftAndMain::menu_title_for_class($controllerClass);
$menuTitle = _t("{$controllerClass}.MENUTITLE", $defaultTitle);
// Add menu item
$defaultTitle = LeftAndMain::menu_title_for_class($controllerClass);
$menuTitle = _t('LeftAndMain.' . strtoupper($controllerClass) . '_MENU', $defaultTitle);
return self::add_menu_item(
$controllerClass,
$menuTitle,

View File

@ -367,7 +367,8 @@ class LeftAndMain extends Controller {
// context, so doesn't respect the current user locale in _t() calls - as a workaround,
// we simply call LeftAndMain::menu_title_for_class() again if we're dealing with a controller
if($menuItem->controller) {
$title = LeftAndMain::menu_title_for_class($menuItem->controller);
$defaultTitle = LeftAndMain::menu_title_for_class($menuItem->controller);
$title = _t("{$menuItem->controller}.MENUTITLE", $defaultTitle);
} else {
$title = $menuItem->title;
}