Removed direct sprintf() usage from _t() calls

Parameterized strings are easier to understand,
and more fail-proof, don't fatal out when not enough sprintf() args
This commit is contained in:
Ingo Schommer 2012-12-21 11:18:18 +01:00
parent 894d48789c
commit cb96255e80
3 changed files with 27 additions and 12 deletions

View File

@ -927,15 +927,24 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
Versioned::reading_stage('Stage');
if(isset($descendantsRemoved)) {
$descRemoved = " and $descendantsRemoved descendants";
$descRemoved = ' ' . _t('CMSMain.DESCREMOVED', 'and {count} descendants', array('count' => $descendantsRemoved));
$descRemoved = ' ' . _t(
'CMSMain.DESCREMOVED',
'and {count} descendants',
array('count' => $descendantsRemoved)
);
} else {
$descRemoved = '';
}
$this->response->addHeader(
'X-Status',
rawurlencode(sprintf(_t('CMSMain.REMOVED', 'Deleted \'%s\'%s from live site'), $recordTitle, $descRemoved))
rawurlencode(
_t(
'CMSMain.REMOVED',
'Deleted \'{title}\'{description} from live site',
array('title' => $recordTitle, 'description' => $descRemoved)
)
)
);
// Even if the record has been deleted from stage and live, it can be viewed in "archive mode"

View File

@ -1,6 +1,7 @@
en:
AssetAdmin:
ADDFILES: 'Add Files'
ALLOWEDEXTS: 'Allowed extensions'
ActionAdd: 'Add folder'
AppCategoryArchive: Archive
AppCategoryAudio: Audio
@ -93,7 +94,7 @@ en:
PUBALLFUN2: "Pressing this button will do the equivalent of going to every page and pressing \"publish\". It's\n intended to be used after there have been massive edits of the content, such as when the site was\n first built."
PUBPAGES: 'Done: Published {count} pages'
PageAdded: 'Successfully created page'
REMOVED: 'Deleted ''%s''%s from live site'
REMOVED: 'Deleted ''{title}''{description} from live site'
REMOVEDPAGE: 'Removed ''{title}'' from the published site'
REMOVEDPAGEFROMDRAFT: 'Removed ''%s'' from the draft site'
RESTORE: Restore
@ -138,7 +139,6 @@ en:
MENUTITLE: Pages
TreeView: 'Tree View'
CMSPagesController_ContentToolbar.ss:
ENABLEDRAGGING: 'Drag''n''drop'
MULTISELECT: Multi-selection
CMSPagesController_Tools.ss:
FILTER: Filter
@ -173,7 +173,7 @@ en:
PUBLISHEDSITE: 'Published Site'
Password: Password
PostInstallTutorialIntro: 'This website is a simplistic version of a SilverStripe 3 site. To extend this, please take a look at {link}.'
StartEditing: 'You can start editing your site\''s content by opening <a href="{link}">the CMS</a>.'
StartEditing: 'You can start editing your content by opening <a href="{link}">the CMS</a>.'
UnableDeleteInstall: 'Unable to delete installation files. Please delete the files below manually'
VIEWPAGEIN: 'View Page in:'
ErrorPage:
@ -323,9 +323,9 @@ en:
LINKCHANGENOTE: 'Changing this page''s link will also affect the links of all child pages.'
MENUTITLE: 'Navigation label'
METADESC: 'Meta Description'
METADESCHELP: 'Search engines use this content for displaying search results (although it will not influence their ranking).'
METAEXTRA: 'Custom Meta Tags'
METAEXTRAHELP: 'HTML tags for additional meta information. For example &lt;meta name="customName" content="your custom content here" /&gt;'
METAKEYWORDS: 'Meta Keywords'
METATITLE: 'Meta Title'
MODIFIEDONDRAFTHELP: 'Page has unpublished changes'
MODIFIEDONDRAFTSHORT: Modified
MetadataToggle: Metadata
@ -387,8 +387,6 @@ en:
VIEWLAST: 'View last'
VIEWNEXT: 'View next'
VIEWPREVIOUS: 'View previous'
TreeTools:
DisplayLabel: 'Display:'
ViewArchivedEmail.ss:
CANACCESS: 'You can access the archived site at this link:'
HAVEASKED: 'You have asked to view the content of our site on'

View File

@ -17,10 +17,18 @@ class SiteTreeMaintenanceTask extends Controller {
$urlSegment = $page->URLSegment;
$page->write();
if($urlSegment != $page->URLSegment) {
echo sprintf(_t('SiteTree.LINKSCHANGEDTO', " changed %s -> %s"), $urlSegment, $page->URLSegment);
echo _t(
'SiteTree.LINKSCHANGEDTO',
" changed {url1} -> {url2}",
array('url1' => $urlSegment, 'url2' => $page->URLSegment)
);
}
else {
echo sprintf(_t('SiteTree.LINKSALREADYUNIQUE', " %s is already unique"), $urlSegment);
echo _t(
'SiteTree.LINKSALREADYUNIQUE',
" {url} is already unique",
array('url' => $urlSegment)
);
}
die();
}