ソースを参照

CaptchaHelper: Direct call of `__d()` for each number string

Because of better maintaining `tools.pot`, gettext is called directly for
each number in the array instead of passing a variable. The Cake I18n Shell
better recognizes these strings.

`tools.pot` and `{ces,deu,spa}/LC_MESSAGES/tools.po` have also been
adjusted:

* `cake i18n extract` for generating `tools.pot`
* `msgmerge --no-wrap --update --backup=off $lang/LC_MESSAGES/tools.po tools.pot`
  for each language (`cd cakephp-tools/Locale` before)
Jan Rio Krause 11 年 前
コミット
6971aebdf5

+ 45 - 1
Locale/ces/LC_MESSAGES/tools.po

@@ -5,7 +5,7 @@
 msgid ""
 msgid ""
 msgstr ""
 msgstr ""
 "Project-Id-Version: PROJECT VERSION\n"
 "Project-Id-Version: PROJECT VERSION\n"
-"POT-Creation-Date: 2014-11-08 22:21+0000\n"
+"POT-Creation-Date: 2014-11-08 23:24+0000\n"
 "PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n"
 "PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n"
 "Last-Translator: NAME <EMAIL@ADDRESS>\n"
 "Last-Translator: NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
@@ -653,6 +653,50 @@ msgstr ""
 msgid "Page %page% of %pages%, showing %current% records out of %count% total"
 msgid "Page %page% of %pages%, showing %current% records out of %count% total"
 msgstr ""
 msgstr ""
 
 
+#: View/Helper/CaptchaHelper.php:40
+msgid "zero"
+msgstr ""
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "one"
+msgstr ""
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "two"
+msgstr ""
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "three"
+msgstr ""
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "four"
+msgstr ""
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "five"
+msgstr ""
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "six"
+msgstr ""
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "seven"
+msgstr ""
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "eight"
+msgstr ""
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "nine"
+msgstr ""
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "ten"
+msgstr ""
+
 #: View/Helper/CaptchaHelper.php:43
 #: View/Helper/CaptchaHelper.php:43
 msgid "calcPlus"
 msgid "calcPlus"
 msgstr ""
 msgstr ""

+ 45 - 34
Locale/deu/LC_MESSAGES/tools.po

@@ -5,7 +5,7 @@
 msgid ""
 msgid ""
 msgstr ""
 msgstr ""
 "Project-Id-Version: PROJECT VERSION\n"
 "Project-Id-Version: PROJECT VERSION\n"
-"POT-Creation-Date: 2014-11-08 22:21+0000\n"
+"POT-Creation-Date: 2014-11-08 23:24+0000\n"
 "PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n"
 "PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n"
 "Last-Translator: NAME <EMAIL@ADDRESS>\n"
 "Last-Translator: NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
@@ -653,6 +653,50 @@ msgstr ""
 msgid "Page %page% of %pages%, showing %current% records out of %count% total"
 msgid "Page %page% of %pages%, showing %current% records out of %count% total"
 msgstr ""
 msgstr ""
 
 
+#: View/Helper/CaptchaHelper.php:40
+msgid "zero"
+msgstr "null"
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "one"
+msgstr "eins"
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "two"
+msgstr "zwei"
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "three"
+msgstr "drei"
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "four"
+msgstr "vier"
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "five"
+msgstr "fünf"
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "six"
+msgstr "sechs"
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "seven"
+msgstr "sieben"
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "eight"
+msgstr "acht"
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "nine"
+msgstr "neun"
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "ten"
+msgstr "zehn"
+
 #: View/Helper/CaptchaHelper.php:43
 #: View/Helper/CaptchaHelper.php:43
 msgid "calcPlus"
 msgid "calcPlus"
 msgstr "plus"
 msgstr "plus"
@@ -826,39 +870,6 @@ msgstr ""
 msgid "List %s"
 msgid "List %s"
 msgstr ""
 msgstr ""
 
 
-#~ msgid "one"
-#~ msgstr "eins"
-
-#~ msgid "two"
-#~ msgstr "zwei"
-
-#~ msgid "three"
-#~ msgstr "drei"
-
-#~ msgid "four"
-#~ msgstr "vier"
-
-#~ msgid "five"
-#~ msgstr "fünf"
-
-#~ msgid "six"
-#~ msgstr "sechs"
-
-#~ msgid "seven"
-#~ msgstr "sieben"
-
-#~ msgid "eight"
-#~ msgstr "acht"
-
-#~ msgid "nine"
-#~ msgstr "neun"
-
-#~ msgid "ten"
-#~ msgstr "zehn"
-
-#~ msgid "zero"
-#~ msgstr "null"
-
 #~ msgid "valErrProvideCurrentPwd"
 #~ msgid "valErrProvideCurrentPwd"
 #~ msgstr "Bitte das bisherige Passwort eingeben"
 #~ msgstr "Bitte das bisherige Passwort eingeben"
 
 

+ 45 - 1
Locale/spa/LC_MESSAGES/tools.po

@@ -5,7 +5,7 @@
 msgid ""
 msgid ""
 msgstr ""
 msgstr ""
 "Project-Id-Version: PROJECT VERSION\n"
 "Project-Id-Version: PROJECT VERSION\n"
-"POT-Creation-Date: 2014-11-08 22:21+0000\n"
+"POT-Creation-Date: 2014-11-08 23:24+0000\n"
 "PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n"
 "PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n"
 "Last-Translator: NAME <EMAIL@ADDRESS>\n"
 "Last-Translator: NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
@@ -653,6 +653,50 @@ msgstr ""
 msgid "Page %page% of %pages%, showing %current% records out of %count% total"
 msgid "Page %page% of %pages%, showing %current% records out of %count% total"
 msgstr ""
 msgstr ""
 
 
+#: View/Helper/CaptchaHelper.php:40
+msgid "zero"
+msgstr ""
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "one"
+msgstr ""
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "two"
+msgstr ""
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "three"
+msgstr ""
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "four"
+msgstr ""
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "five"
+msgstr ""
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "six"
+msgstr ""
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "seven"
+msgstr ""
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "eight"
+msgstr ""
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "nine"
+msgstr ""
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "ten"
+msgstr ""
+
 #: View/Helper/CaptchaHelper.php:43
 #: View/Helper/CaptchaHelper.php:43
 msgid "calcPlus"
 msgid "calcPlus"
 msgstr ""
 msgstr ""

+ 45 - 1
Locale/tools.pot

@@ -5,7 +5,7 @@
 msgid ""
 msgid ""
 msgstr ""
 msgstr ""
 "Project-Id-Version: PROJECT VERSION\n"
 "Project-Id-Version: PROJECT VERSION\n"
-"POT-Creation-Date: 2014-11-08 22:21+0000\n"
+"POT-Creation-Date: 2014-11-08 23:24+0000\n"
 "PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n"
 "PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n"
 "Last-Translator: NAME <EMAIL@ADDRESS>\n"
 "Last-Translator: NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
@@ -652,6 +652,50 @@ msgstr ""
 msgid "Page %page% of %pages%, showing %current% records out of %count% total"
 msgid "Page %page% of %pages%, showing %current% records out of %count% total"
 msgstr ""
 msgstr ""
 
 
+#: View/Helper/CaptchaHelper.php:40
+msgid "zero"
+msgstr ""
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "one"
+msgstr ""
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "two"
+msgstr ""
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "three"
+msgstr ""
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "four"
+msgstr ""
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "five"
+msgstr ""
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "six"
+msgstr ""
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "seven"
+msgstr ""
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "eight"
+msgstr ""
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "nine"
+msgstr ""
+
+#: View/Helper/CaptchaHelper.php:40
+msgid "ten"
+msgstr ""
+
 #: View/Helper/CaptchaHelper.php:43
 #: View/Helper/CaptchaHelper.php:43
 msgid "calcPlus"
 msgid "calcPlus"
 msgstr ""
 msgstr ""

+ 2 - 2
View/Helper/CaptchaHelper.php

@@ -37,7 +37,7 @@ class CaptchaHelper extends AppHelper {
 		parent::__construct($View, $config);
 		parent::__construct($View, $config);
 
 
 		// First of all we are going to set up an array with the text equivalents of all the numbers we will be using.
 		// First of all we are going to set up an array with the text equivalents of all the numbers we will be using.
-		$this->numberConvert = array(0 => 'zero', 1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four', 5 => 'five', 6 => 'six', 7 => 'seven', 8 => 'eight', 9 => 'nine', 10 => 'ten');
+		$this->numberConvert = array(0 => __d('tools', 'zero'), 1 => __d('tools', 'one'), 2 => __d('tools', 'two'), 3 => __d('tools', 'three'), 4 => __d('tools', 'four'), 5 => __d('tools', 'five'), 6 => __d('tools', 'six'), 7 => __d('tools', 'seven'), 8 => __d('tools', 'eight'), 9 => __d('tools', 'nine'), 10 => __d('tools', 'ten'));
 
 
 		// Set up an array with the operators that we want to use. With difficulty=1 it is only subtraction and addition.
 		// Set up an array with the operators that we want to use. With difficulty=1 it is only subtraction and addition.
 		$this->operatorConvert = array(0 => array('+', __d('tools', 'calcPlus')), 1 => array('-', __d('tools', 'calcMinus')), 2 => '*', __d('tools', 'calcTimes'));
 		$this->operatorConvert = array(0 => array('+', __d('tools', 'calcPlus')), 1 => array('-', __d('tools', 'calcMinus')), 2 => '*', __d('tools', 'calcTimes'));
@@ -60,7 +60,7 @@ class CaptchaHelper extends AppHelper {
 		$captchaOperator = $captchaOperatorSelection[mt_rand(0, 1)];
 		$captchaOperator = $captchaOperatorSelection[mt_rand(0, 1)];
 
 
 		// Get the equation in textual form to show to the user.
 		// Get the equation in textual form to show to the user.
-		$code = (mt_rand(0, 1) == 1 ? __d('tools', $this->numberConvert[$numberOne]) : $numberOne) . ' ' . $captchaOperator . ' ' . (mt_rand(0, 1) == 1 ? __d('tools', $this->numberConvert[$numberTwo]) : $numberTwo);
+		$code = (mt_rand(0, 1) == 1 ? $this->numberConvert[$numberOne] : $numberOne) . ' ' . $captchaOperator . ' ' . (mt_rand(0, 1) == 1 ? $this->numberConvert[$numberTwo] : $numberTwo);
 
 
 		// Evaluate the equation and get the result.
 		// Evaluate the equation and get the result.
 		eval('$result = ' . $numberOne . ' ' . $captchaOperatorSelection[0] . ' ' . $numberTwo . ';');
 		eval('$result = ' . $numberOne . ' ' . $captchaOperatorSelection[0] . ' ' . $numberTwo . ';');