Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
  • Loading branch information...
commit cb96255e8072ec62867ac754d1540f5c98636f71 1 parent 894d487
@chillu chillu authored
View
15 code/controllers/CMSMain.php
@@ -927,15 +927,24 @@ public function deletefromlive($data, $form) {
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
12 lang/en.yml
@@ -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
12 tasks/SiteTreeMaintenanceTask.php
@@ -17,10 +17,18 @@ public function makelinksunique() {
$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();
}
Please sign in to comment.
Something went wrong with that request. Please try again.