Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
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 661a4a2492196bd237bbe7a6497a8e5fec145833 1 parent c054ab4
@chillu chillu authored
View
11 forms/RequiredFields.php
@@ -85,8 +85,15 @@ public function php($data) {
}
if($formField && $error) {
- $errorMessage = sprintf(_t('Form.FIELDISREQUIRED', '%s is required'),
- strip_tags('"' . ($formField->Title() ? $formField->Title() : $fieldName) . '"'));
+ $errorMessage = _t(
+ 'Form.FIELDISREQUIRED',
+ '{name} is required',
+ array(
+ 'name' => strip_tags(
+ '"' . ($formField->Title() ? $formField->Title() : $fieldName) . '"'
+ )
+ )
+ );
if($msg = $formField->getCustomValidationMessage()) {
$errorMessage = $msg;
View
14 forms/gridfield/GridFieldDetailForm.php
@@ -412,10 +412,16 @@ public function doSave($data, $form) {
// TODO Save this item into the given relationship
- $message = sprintf(
- _t('GridFieldDetailForm.Saved', 'Saved %s %s'),
- $this->record->singular_name(),
- '<a href="' . $this->Link('edit') . '">"' . htmlspecialchars($this->record->Title, ENT_QUOTES) . '"</a>'
+ $link = '<a href="' . $this->Link('edit') . '">"'
+ . htmlspecialchars($this->record->Title, ENT_QUOTES)
+ . '"</a>';
+ $message = _t(
+ 'GridFieldDetailForm.Saved',
+ 'Saved {name} {link}',
+ array(
+ 'name' => $this->record->singular_name(),
+ 'link' => $link
+ )
);
$form->sessionMessage($message, 'good');
View
8 lang/en.yml
@@ -1,6 +1,5 @@
en:
AssetAdmin:
- ALLOWEDEXTS: 'Allowed extensions'
NEWFOLDER: NewFolder
AssetTableField:
CREATED: 'First uploaded'
@@ -198,7 +197,7 @@ en:
TEXT2: 'password reset link'
TEXT3: for
Form:
- FIELDISREQUIRED: '%s is required'
+ FIELDISREQUIRED: '{name} is required'
SubmitBtnLabel: Go
VALIDATIONCREDITNUMBER: 'Please ensure you have entered the {number} credit card number correctly'
VALIDATIONNOTUNIQUE: 'The value entered is not unique'
@@ -237,7 +236,9 @@ en:
DeletePermissionsFailure: 'No delete permissions'
Deleted: 'Deleted %s %s'
Save: Save
- Saved: 'Saved %s %s'
+ Saved: 'Saved {name} {link}'
+ GridFieldEditButton.ss:
+ EDIT: Edit
GridFieldItemEditView.ss:
'Go back': 'Go back'
Group:
@@ -368,6 +369,7 @@ en:
NEWPASSWORD: 'New Password'
PASSWORD: Password
PLURALNAME: Members
+ PROFILESAVESUCCESS: 'Successfully saved.'
REMEMBERME: 'Remember me next time?'
SINGULARNAME: Member
SUBJECTPASSWORDCHANGED: 'Your password has been changed'
Please sign in to comment.
Something went wrong with that request. Please try again.