BUGFIX Fixed sprintf detection bug in SiteTree->getClassDropdown()

ENHANCEMENT Appending classnames to translated pagetype titles in SiteTree->getClassDropdown() when the cms is loaded in a non-english version - see inline comment

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@68817 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-12-14 21:45:10 +00:00 committed by Sam Minnee
parent 915decb1f6
commit 1cdb9bb61d

View File

@ -1483,8 +1483,9 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
PR_MEDIUM,
"Pagetype selection dropdown with class names"
);
// @todo legacy fix to avoid empty classname dropdowns when translation doesn't include %s
if(strpos('%s', $translation) !== FALSE) {
if(strpos($translation, '%s') !== FALSE) {
$result[$class] = sprintf(
$translation,
$pageTypeName
@ -1493,6 +1494,14 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
$result[$class] = "{$translation} \"{$pageTypeName}\"";
}
}
// if we're in translation mode, the link between the translated pagetype
// title and the actual classname might not be obvious, so we add it in parantheses
// Example: class "RedirectorPage" has the title "Weiterleitung" in German,
// so it shows up as "Weiterleitung (RedirectorPage)"
if(i18n::get_locale() != 'en_US') {
$result[$class] = $result[$class] . " ({$class})";
}
}
// sort alphabetically, and put current on top