From 933fbf8ea47cee85eb3ab324fc9b690d4774f0a0 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Fri, 12 Apr 2013 01:09:53 +0200 Subject: [PATCH] l10n key to make "yes" and "no" translatable (see #1749) --- forms/CheckboxField.php | 2 +- lang/en.yml | 8 ++++---- model/fieldtypes/Boolean.php | 6 +++--- tests/forms/CheckboxFieldTest.php | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/forms/CheckboxField.php b/forms/CheckboxField.php index c90341037..7f7bd1d34 100644 --- a/forms/CheckboxField.php +++ b/forms/CheckboxField.php @@ -62,7 +62,7 @@ class CheckboxField_Readonly extends ReadonlyField { } public function Value() { - return Convert::raw2xml($this->value ? _t('CheckboxField.YES', 'Yes') : _t('CheckboxField.NO', 'No')); + return Convert::raw2xml($this->value ? _t('CheckboxField.YESANSWER', 'Yes') : _t('CheckboxField.NOANSWER', 'No')); } } diff --git a/lang/en.yml b/lang/en.yml index 3c1d2561b..40a64be71 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -60,8 +60,8 @@ en: ERRORNOTREC: 'That username / password isn''t recognised' Boolean: ANY: Any - NO: No - YES: Yes + NOANSWER: No + YESANSWER: Yes CMSLoadingScreen.ss: LOADING: Loading... REQUIREJS: 'The CMS requires that you have JavaScript enabled.' @@ -79,8 +79,8 @@ en: HELLO: Hi PASSWORD: Password CheckboxField: - NO: No - YES: Yes + NOANSWER: No + YESANSWER: Yes ComplexTableField: CLOSEPOPUP: 'Close Popup' SUCCESSADD2: 'Added {name}' diff --git a/model/fieldtypes/Boolean.php b/model/fieldtypes/Boolean.php index 2b363ee3d..0431813bb 100644 --- a/model/fieldtypes/Boolean.php +++ b/model/fieldtypes/Boolean.php @@ -27,7 +27,7 @@ class Boolean extends DBField { } public function Nice() { - return ($this->value) ? _t('Boolean.YES', 'Yes') : _t('Boolean.NO', 'No'); + return ($this->value) ? _t('Boolean.YESANSWER', 'Yes') : _t('Boolean.NOANSWER', 'No'); } public function NiceAsBoolean() { @@ -53,8 +53,8 @@ class Boolean extends DBField { public function scaffoldSearchField($title = null) { $anyText = _t('Boolean.ANY', 'Any'); $source = array( - 1 => _t('Boolean.YES', 'Yes'), - 0 => _t('Boolean.NO', 'No') + 1 => _t('Boolean.YESANSWER', 'Yes'), + 0 => _t('Boolean.NOANSWER', 'No') ); $field = new DropdownField($this->name, $title, $source); diff --git a/tests/forms/CheckboxFieldTest.php b/tests/forms/CheckboxFieldTest.php index 28fac29a4..986ad690f 100644 --- a/tests/forms/CheckboxFieldTest.php +++ b/tests/forms/CheckboxFieldTest.php @@ -122,18 +122,18 @@ class CheckboxFieldTest extends SapphireTest { // Test 1: a checked checkbox goes to "Yes" $field1 = new CheckboxField('IsChecked', 'Checked'); $field1->setValue('on'); - $this->assertEquals(_t('CheckboxField.YES', 'Yes'), + $this->assertEquals(_t('CheckboxField.YESANSWER', 'Yes'), trim(strip_tags($field1->performReadonlyTransformation()->Field()))); // Test 2: an checkbox with the value set to false to "No" $field2 = new CheckboxField('IsChecked', 'Checked'); $field2->setValue(false); - $this->assertEquals(_t('CheckboxField.NO', 'No'), + $this->assertEquals(_t('CheckboxField.NOANSWER', 'No'), trim(strip_tags($field2->performReadonlyTransformation()->Field()))); // Test 3: an checkbox with no value ever set goes to "No" $field3 = new CheckboxField('IsChecked', 'Checked'); - $this->assertEquals(_t('CheckboxField.NO', 'No'), + $this->assertEquals(_t('CheckboxField.NOANSWER', 'No'), trim(strip_tags($field3->performReadonlyTransformation()->Field()))); }