Skip to content

Commit

Permalink
Merge pull request #12 from robbieaverill/bugfix/remove-sprintf-in-tr…
Browse files Browse the repository at this point in the history
…anslations

FIX Remove legacy sprintf style translations in favour of placeholders
  • Loading branch information
Damian Mooyman authored Jul 31, 2017
2 parents 2fd1c00 + 43be1a0 commit 533fb62
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lang/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ en:
has_many_Versions: Versions
SilverStripe\Versioned\VersionedGridFieldItemRequest:
ARCHIVE: Archive
Archived: 'Archived %s %s'
Archived: 'Archived {name} {title}'
BUTTONARCHIVEDESC: 'Unpublish and send to archive'
BUTTONPUBLISH: Publish
BUTTONUNPUBLISH: Unpublish
BUTTONUNPUBLISHDESC: 'Remove this record from the published site'
Published: 'Published {name} {link}'
Unpublished: 'Unpublished %s %s'
SilverStripe\Versioned\VersionedHTTPMiddleware:
Unpublished: 'Unpublished {name} {title}'
DRAFT_SITE_ACCESS_RESTRICTION: 'You must log in with your CMS password in order to view the draft or archived content. <a href="{link}">Click here to go back to the published site.</a>'
22 changes: 14 additions & 8 deletions src/VersionedGridFieldItemRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,13 @@ public function doArchive($data, $form)
$title = $record->Title;
$record->doArchive();

$message = sprintf(
_t('SilverStripe\\Versioned\\VersionedGridFieldItemRequest.Archived', 'Archived %s %s'),
$record->i18n_singular_name(),
Convert::raw2xml($title)
$message = _t(
__CLASS__ . '.Archived',
'Archived {name} {title}',
[
'name' => $record->i18n_singular_name(),
'title' => Convert::raw2xml($title)
]
);
$this->setFormMessage($form, $message);

Expand Down Expand Up @@ -171,10 +174,13 @@ public function doUnpublish($data, $form)
$title = $record->Title;
$record->doUnpublish();

$message = sprintf(
_t('SilverStripe\\Versioned\\VersionedGridFieldItemRequest.Unpublished', 'Unpublished %s %s'),
$record->i18n_singular_name(),
Convert::raw2xml($title)
$message = _t(
__CLASS__ . '.Unpublished',
'Unpublished {name} {title}',
[
'name' => $record->i18n_singular_name(),
'title' => Convert::raw2xml($title)
]
);
$this->setFormMessage($form, $message);

Expand Down

0 comments on commit 533fb62

Please sign in to comment.