Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial commit.

  • Loading branch information...
commit b659b1a6f35b57374f62c54806cf47393d9fe6c4 0 parents
@davidpersson davidpersson authored
Showing with 1,842 additions and 0 deletions.
  1. +25 −0 LICENSE.txt
  2. +15 −0 README.md
  3. +19 −0 config/bootstrap.php
  4. +30 −0 resources/g11n/php/ar/message/default.php
  5. +21 −0 resources/g11n/php/bg/message/default.php
  6. +21 −0 resources/g11n/php/ca/message/default.php
  7. +21 −0 resources/g11n/php/cs/message/default.php
  8. +21 −0 resources/g11n/php/da/message/default.php
  9. +16 −0 resources/g11n/php/da_DK/validation/default.php
  10. +21 −0 resources/g11n/php/de/message/default.php
  11. +16 −0 resources/g11n/php/de_BE/validation/default.php
  12. +16 −0 resources/g11n/php/de_DE/validation/default.php
  13. +21 −0 resources/g11n/php/el/message/default.php
  14. +21 −0 resources/g11n/php/en/message/default.php
  15. +17 −0 resources/g11n/php/en_CA/validation/default.php
  16. +18 −0 resources/g11n/php/en_GB/validation/default.php
  17. +18 −0 resources/g11n/php/en_US/validation/default.php
  18. +21 −0 resources/g11n/php/eo/message/default.php
  19. +21 −0 resources/g11n/php/es/message/default.php
  20. +21 −0 resources/g11n/php/et/message/default.php
  21. +21 −0 resources/g11n/php/eu/message/default.php
  22. +21 −0 resources/g11n/php/fa/message/default.php
  23. +21 −0 resources/g11n/php/fi/message/default.php
  24. +21 −0 resources/g11n/php/fo/message/default.php
  25. +21 −0 resources/g11n/php/fr/message/default.php
  26. +16 −0 resources/g11n/php/fr_BE/validation/default.php
  27. +17 −0 resources/g11n/php/fr_CA/validation/default.php
  28. +21 −0 resources/g11n/php/ga/message/default.php
  29. +17 −0 resources/g11n/php/gd/message/default.php
  30. +21 −0 resources/g11n/php/he/message/default.php
  31. +28 −0 resources/g11n/php/hr/message/default.php
  32. +21 −0 resources/g11n/php/hu/message/default.php
  33. +21 −0 resources/g11n/php/it/message/default.php
  34. +16 −0 resources/g11n/php/it_IT/validation/default.php
  35. +21 −0 resources/g11n/php/ja/message/default.php
  36. +21 −0 resources/g11n/php/ko/message/default.php
  37. +21 −0 resources/g11n/php/lo/message/default.php
  38. +29 −0 resources/g11n/php/lt/message/default.php
  39. +21 −0 resources/g11n/php/lv/message/default.php
  40. +21 −0 resources/g11n/php/nl/message/default.php
  41. +16 −0 resources/g11n/php/nl_BE/validation/default.php
  42. +16 −0 resources/g11n/php/nl_NL/validation/default.php
  43. +21 −0 resources/g11n/php/nn/message/default.php
  44. +21 −0 resources/g11n/php/no/message/default.php
  45. +28 −0 resources/g11n/php/pl/message/default.php
  46. +21 −0 resources/g11n/php/pt/message/default.php
  47. +21 −0 resources/g11n/php/pt_BR/message/default.php
  48. +23 −0 resources/g11n/php/ro/message/default.php
  49. +28 −0 resources/g11n/php/ru/message/default.php
  50. +21 −0 resources/g11n/php/sk/message/default.php
  51. +30 −0 resources/g11n/php/sl/message/default.php
  52. +28 −0 resources/g11n/php/sr/message/default.php
  53. +21 −0 resources/g11n/php/sv/message/default.php
  54. +21 −0 resources/g11n/php/th/message/default.php
  55. +21 −0 resources/g11n/php/tr/message/default.php
  56. +28 −0 resources/g11n/php/uk/message/default.php
  57. +21 −0 resources/g11n/php/vi/message/default.php
  58. +30 −0 resources/g11n/php/wen/message/default.php
  59. +21 −0 resources/g11n/php/zh/message/default.php
  60. +451 −0 tests/integration/g11n/ResourcesMessageTest.php
  61. +137 −0 tests/integration/g11n/ResourcesValidatorTest.php
25 LICENSE.txt
@@ -0,0 +1,25 @@
+Copyright (c) 2011, Union of RAD http://union-of-rad.org
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of Lithium, Union of Rad, nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15 README.md
@@ -0,0 +1,15 @@
+
+### About
+
+This Lithium plugin provides additional g11n resources. These intentionally haven't been bundled with the Lithium core to allow the community to extend and add to the resources collaboratively. The specialized nature of the resources as well as the sheer size have been another reason for not shipping the data with the core.
+
+Following resources are currently contained in this plugin:
+
+ * Plural rules for the most common languages. (`resources/g11n/<LOCALE>/message/default.php`)
+ * Validation rules. (`resources/g11n/<LOCALE>/validation/default.php`)
+
+### Installation
+
+Just install and register the plugin into your application as per [the manual](http://lithify.me/docs/manual). Resources contained within this plugin are automatically registered with the `Catalog` class while maintaining existing configurations. This makes the resources available to thee application this plugin is contained in. `Message::translate()` calls will utilize these resources automatically as long as no or the `li3_lldr` named configuration is selected.
+
+
19 config/bootstrap.php
@@ -0,0 +1,19 @@
+<?php
+
+use lithium\g11n\Catalog;
+
+/**
+ * Register the g11n resources with `Catalog` while maintaining existing
+ * configurations. This makes the resources contained in this plugin available
+ * to the application this plugin is contained in. `Message::translate()` calls
+ * will utilize these resources automatically as long as no or the `li3_lldr`
+ * named configuration is selected.
+ */
+Catalog::config(array(
+ 'li3_lldr' => array(
+ 'adapter' => 'Php',
+ 'path' => dirname(__DIR__) . '/resources/g11n/php'
+ )
+) + Catalog::config());
+
+?>
30 resources/g11n/php/ar/message/default.php
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `ar`.
+ */
+return array(
+ 'pluralForms' => 6,
+ 'pluralRule' => function ($n) {
+ if ($n == 0) {
+ return 0;
+ } elseif ($n == 1) {
+ return 1;
+ } elseif ($n == 2) {
+ return 2;
+ } elseif ($n >=3 && $n <= 10) {
+ return 3;
+ } elseif ($n >= 11 && $n <= 99) {
+ return 4;
+ }
+ return 5;
+ }
+);
+
+?>
21 resources/g11n/php/bg/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `bg`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 2,
+ 'pluralRule' => function ($n) { return $n != 1 ? 1 : 0; }
+);
+
+?>
21 resources/g11n/php/ca/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `ca`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 2,
+ 'pluralRule' => function ($n) { return $n != 1 ? 1 : 0; }
+);
+
+?>
21 resources/g11n/php/cs/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `cs`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 3,
+ 'pluralRule' => function ($n) { return ($n == 1) ? 0 : (($n >= 2 && $n <= 4) ? 1 : 2); }
+);
+
+?>
21 resources/g11n/php/da/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `da`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 2,
+ 'pluralRule' => function ($n) { return $n != 1 ? 1 : 0; }
+);
+
+?>
16 resources/g11n/php/da_DK/validation/default.php
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Validation data for `da_DK`.
+ */
+return array(
+ 'ssn' => '/\\A\\b[0-9]{6}-[0-9]{4}\\b\\z/i'
+);
+
+?>
21 resources/g11n/php/de/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `de`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 2,
+ 'pluralRule' => function ($n) { return $n != 1 ? 1 : 0; }
+);
+
+?>
16 resources/g11n/php/de_BE/validation/default.php
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Validation data for `de_BE`.
+ */
+return array(
+ 'postalCode' => '/^[1-9]{1}[0-9]{3}$/i'
+);
+
+?>
16 resources/g11n/php/de_DE/validation/default.php
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Validation data for `de_DE`.
+ */
+return array(
+ 'postalCode' => '/^[0-9]{5}$/i'
+);
+
+?>
21 resources/g11n/php/el/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `el`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 2,
+ 'pluralRule' => function ($n) { return $n != 1 ? 1 : 0; }
+);
+
+?>
21 resources/g11n/php/en/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `en`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 2,
+ 'pluralRule' => function ($n) { return $n != 1 ? 1 : 0; }
+);
+
+?>
17 resources/g11n/php/en_CA/validation/default.php
@@ -0,0 +1,17 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Validation data for `en_CA`.
+ */
+return array(
+ 'phone' => '/^(?:\+?1)?[-. ]?\\(?[2-9][0-8][0-9]\\)?[-. ]?[2-9][0-9]{2}[-. ]?[0-9]{4}$/',
+ 'postalCode' => '/\\A\\b[ABCEGHJKLMNPRSTVXY][0-9][A-Z] [0-9][A-Z][0-9]\\b\\z/i'
+);
+
+?>
18 resources/g11n/php/en_GB/validation/default.php
@@ -0,0 +1,18 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Validation data for `en_GB`.
+ *
+ * @link http://en.wikipedia.org/wiki/UK_postcodes#Format
+ */
+return array(
+ 'postalCode' => '/\\A\\b[A-Z]{1,2}[0-9][A-Z0-9]? [0-9][ABD-HJLNP-UW-Z]{2}\\b\\z/i'
+);
+
+?>
18 resources/g11n/php/en_US/validation/default.php
@@ -0,0 +1,18 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Validation data for `en_US`.
+ */
+return array(
+ 'phone' => '/^(?:\+?1)?[-. ]?\\(?[2-9][0-8][0-9]\\)?[-. ]?[2-9][0-9]{2}[-. ]?[0-9]{4}$/',
+ 'postalCode' => '/\\A\\b[0-9]{5}(?:-[0-9]{4})?\\b\\z/i',
+ 'ssn' => '/\\A\\b[0-9]{3}-[0-9]{2}-[0-9]{4}\\b\\z/i'
+);
+
+?>
21 resources/g11n/php/eo/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `eo`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 2,
+ 'pluralRule' => function ($n) { return $n != 1 ? 1 : 0; }
+);
+
+?>
21 resources/g11n/php/es/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `es`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 2,
+ 'pluralRule' => function ($n) { return $n != 1 ? 1 : 0; }
+);
+
+?>
21 resources/g11n/php/et/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `et`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 2,
+ 'pluralRule' => function ($n) { return $n != 1 ? 1 : 0; }
+);
+
+?>
21 resources/g11n/php/eu/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `eu`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 2,
+ 'pluralRule' => function ($n) { return $n != 1 ? 1 : 0; }
+);
+
+?>
21 resources/g11n/php/fa/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `fa`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 1,
+ 'pluralRule' => function ($n) { return 0; }
+);
+
+?>
21 resources/g11n/php/fi/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `fi`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 2,
+ 'pluralRule' => function ($n) { return $n != 1 ? 1 : 0; }
+);
+
+?>
21 resources/g11n/php/fo/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `fo`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 2,
+ 'pluralRule' => function ($n) { return $n != 1 ? 1 : 0; }
+);
+
+?>
21 resources/g11n/php/fr/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `fr`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 2,
+ 'pluralRule' => function ($n) { return $n > 1 ? 1 : 0; }
+);
+
+?>
16 resources/g11n/php/fr_BE/validation/default.php
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Validation data for `fr_BE`.
+ */
+return array(
+ 'postalCode' => '/^[1-9]{1}[0-9]{3}$/i'
+);
+
+?>
17 resources/g11n/php/fr_CA/validation/default.php
@@ -0,0 +1,17 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Validation data for `fr_CA`.
+ */
+return array(
+ 'phone' => '/^(?:\+?1)?[-. ]?\\(?[2-9][0-8][0-9]\\)?[-. ]?[2-9][0-9]{2}[-. ]?[0-9]{4}$/',
+ 'postalCode' => '/\\A\\b[ABCEGHJKLMNPRSTVXY][0-9][A-Z] [0-9][A-Z][0-9]\\b\\z/i'
+);
+
+?>
21 resources/g11n/php/ga/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `ga`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 3,
+ 'pluralRule' => function ($n) { return $n == 1 ? 0 : ($n == 2 ? 1 : 2); }
+);
+
+?>
17 resources/g11n/php/gd/message/default.php
@@ -0,0 +1,17 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `gd`.
+ */
+return array(
+ 'pluralForms' => 3,
+ 'pluralRule' => function ($n) { return $n == 1 ? 0 : ($n == 2 ? 1 : 2); }
+);
+
+?>
21 resources/g11n/php/he/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `he`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 2,
+ 'pluralRule' => function ($n) { return $n != 1 ? 1 : 0; }
+);
+
+?>
28 resources/g11n/php/hr/message/default.php
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `hr`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 3,
+ 'pluralRule' => function ($n) {
+ if ($n % 10 == 1 && $n % 100 != 11) {
+ return 0;
+ } elseif ($n % 10 >= 2 && $n % 10 <= 4 && ($n % 100 < 10 || $n % 100 >= 20)) {
+ return 1;
+ }
+ return 2;
+ }
+);
+
+?>
21 resources/g11n/php/hu/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `hu`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 2,
+ 'pluralRule' => function ($n) { return $n != 1 ? 1 : 0; }
+);
+
+?>
21 resources/g11n/php/it/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `it`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 2,
+ 'pluralRule' => function ($n) { return $n != 1 ? 1 : 0; }
+);
+
+?>
16 resources/g11n/php/it_IT/validation/default.php
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Validation data for `it_IT`.
+ */
+return array(
+ 'postalCode' => '/^[0-9]{5}$/i'
+);
+
+?>
21 resources/g11n/php/ja/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `ja`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 1,
+ 'pluralRule' => function ($n) { return 0; }
+);
+
+?>
21 resources/g11n/php/ko/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `ko`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 1,
+ 'pluralRule' => function ($n) { return 0; }
+);
+
+?>
21 resources/g11n/php/lo/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `lo`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 1,
+ 'pluralRule' => function ($n) { return 0; }
+);
+
+?>
29 resources/g11n/php/lt/message/default.php
@@ -0,0 +1,29 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `lt`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 3,
+ 'pluralRule' => function ($n) {
+ if ($n % 10 == 1 && $n % 100 != 11) {
+ return 0;
+ }
+ if ($n % 10 >= 2 && ($n % 100 < 10 || $n % 100 >= 20 )) {
+ return 1;
+ }
+ return 2;
+ }
+);
+
+?>
21 resources/g11n/php/lv/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `lv`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 3,
+ 'pluralRule' => function ($n) { return $n == 0 ? 0 : ($n % 10 == 1 && $n % 100 != 11 ? 1 : 2); }
+);
+
+?>
21 resources/g11n/php/nl/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `nl`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 2,
+ 'pluralRule' => function ($n) { return $n != 1 ? 1 : 0; }
+);
+
+?>
16 resources/g11n/php/nl_BE/validation/default.php
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Validation data for `nl_BE`.
+ */
+return array(
+ 'postalCode' => '/^[1-9]{1}[0-9]{3}$/i'
+);
+
+?>
16 resources/g11n/php/nl_NL/validation/default.php
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Validation data for `nl_NL`.
+ */
+return array(
+ 'ssn' => '/\\A\\b[0-9]{9}\\b\\z/i'
+);
+
+?>
21 resources/g11n/php/nn/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `nn`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 2,
+ 'pluralRule' => function ($n) { return $n != 1 ? 1 : 0; }
+);
+
+?>
21 resources/g11n/php/no/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `no`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 2,
+ 'pluralRule' => function ($n) { return $n != 1 ? 1 : 0; }
+);
+
+?>
28 resources/g11n/php/pl/message/default.php
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `pl`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 3,
+ 'pluralRule' => function ($n) {
+ if ($n == 1) {
+ return 0;
+ } elseif ($n % 10 >= 2 && $n % 10 <= 4 && ($n % 100 < 10 || $n % 100 >= 20)) {
+ return 1;
+ }
+ return 2;
+ }
+);
+
+?>
21 resources/g11n/php/pt/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `pt`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 2,
+ 'pluralRule' => function ($n) { return $n != 1 ? 1 : 0; }
+);
+
+?>
21 resources/g11n/php/pt_BR/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `pt_BR`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 2,
+ 'pluralRule' => function ($n) { return $n > 1 ? 1 : 0; }
+);
+
+?>
23 resources/g11n/php/ro/message/default.php
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `ro`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 3,
+ 'pluralRule' => function ($n) {
+ return $n == 1 ? 0 : (($n == 0 || ($n % 100 > 0 && $n % 100 < 20)) ? 1 : 2);
+ }
+);
+
+?>
28 resources/g11n/php/ru/message/default.php
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `ru`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 3,
+ 'pluralRule' => function ($n) {
+ if ($n % 10 == 1 && $n % 100 != 11) {
+ return 0;
+ } elseif ($n % 10 >= 2 && $n % 10 <= 4 && ($n % 100 < 10 || $n % 100 >= 20)) {
+ return 1;
+ }
+ return 2;
+ }
+);
+
+?>
21 resources/g11n/php/sk/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `sk`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 3,
+ 'pluralRule' => function ($n) { return ($n == 1) ? 0 : (($n >= 2 && $n <= 4) ? 1 : 2); }
+);
+
+?>
30 resources/g11n/php/sl/message/default.php
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `sl`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 4,
+ 'pluralRule' => function ($n) {
+ if ($n % 100 == 1) {
+ return 0;
+ } elseif ($n % 100 == 2) {
+ return 1;
+ } elseif ($n % 100 == 3 || $n % 100 == 4) {
+ return 2;
+ }
+ return 3;
+ }
+);
+
+?>
28 resources/g11n/php/sr/message/default.php
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `sr`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 3,
+ 'pluralRule' => function ($n) {
+ if ($n % 10 == 1 && $n % 100 != 11) {
+ return 0;
+ } elseif ($n % 10 >= 2 && $n % 10 <= 4 && ($n % 100 < 10 || $n % 100 >= 20)) {
+ return 1;
+ }
+ return 2;
+ }
+);
+
+?>
21 resources/g11n/php/sv/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `sv`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 2,
+ 'pluralRule' => function ($n) { return $n != 1 ? 1 : 0; }
+);
+
+?>
21 resources/g11n/php/th/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `th`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 1,
+ 'pluralRule' => function ($n) { return 0; }
+);
+
+?>
21 resources/g11n/php/tr/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `tr`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 2,
+ 'pluralRule' => function ($n) { return $n != 1 ? 1 : 0; }
+);
+
+?>
28 resources/g11n/php/uk/message/default.php
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `uk`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 3,
+ 'pluralRule' => function ($n) {
+ if ($n % 10 == 1 && $n % 100 != 11) {
+ return 0;
+ } elseif ($n % 10 >= 2 && $n % 10 <= 4 && ($n % 100 < 10 || $n % 100 >= 20)) {
+ return 1;
+ }
+ return 2;
+ }
+);
+
+?>
21 resources/g11n/php/vi/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `vi`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 1,
+ 'pluralRule' => function ($n) { return 0; }
+);
+
+?>
30 resources/g11n/php/wen/message/default.php
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `wen`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 4,
+ 'pluralRule' => function ($n) {
+ if ($n % 100 == 1) {
+ return 0;
+ } elseif ($n % 100 == 2) {
+ return 1;
+ } elseif ($n % 100 == 3 || $n % 100 == 4) {
+ return 2;
+ }
+ return 3;
+ }
+);
+
+?>
21 resources/g11n/php/zh/message/default.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+/**
+ * Message data for `zh`.
+ *
+ * Plural rule and forms derived from the GNU gettext documentation.
+ *
+ * @link http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
+ */
+return array(
+ 'pluralForms' => 1,
+ 'pluralRule' => function ($n) { return 0; }
+);
+
+?>
451 tests/integration/g11n/ResourcesMessageTest.php
@@ -0,0 +1,451 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+namespace li3_lldr\tests\integration\g11n;
+
+use lithium\core\Libraries;
+use lithium\g11n\Catalog;
+use lithium\util\Validator;
+
+/**
+ * Test for integration of g11n resources. Numbers of rules refer to those documented in
+ * the document on pluralization at Mozilla.
+ *
+ * @link https://developer.mozilla.org/en/Localization_and_Plurals
+ */
+class ResourcesMessageTest extends \lithium\test\Unit {
+
+ protected $_backups = array();
+
+ public function setUp() {
+ $this->_backups['catalogConfig'] = Catalog::config();
+ Catalog::reset();
+ Catalog::config(array(
+ 'li3_lldr' => array(
+ 'adapter' => 'Php',
+ 'path' => Libraries::get('li3_lldr', 'path') . '/resources/g11n/php'
+ )));
+ }
+
+ public function tearDown() {
+ Catalog::reset();
+ Catalog::config($this->_backups['catalogConfig']);
+ }
+
+ /**
+ * Tests the plural rule #0 which applies to the following languages
+ * grouped by family and sorted alphabetically.
+ *
+ * Asian family:
+ * - Japanese (ja)
+ * - Korean (ko)
+ * - Vietnamese (vi)
+ *
+ * @return void
+ */
+ public function testPlurals0() {
+ $locales = array(
+ 'ja', 'ko', 'vi'
+ );
+ foreach ($locales as $locale) {
+ $expected = 1;
+ $result = Catalog::read(true, 'message.pluralForms', $locale);
+ $this->assertEqual($expected, $result, "Locale: `{$locale}`\n{:message}");
+
+ $rule = Catalog::read(true, 'message.pluralRule', $locale);
+
+ $expected = '00000000000000000000000000000000000000000000000000';
+ $expected .= '00000000000000000000000000000000000000000000000000';
+ $expected .= '00000000000000000000000000000000000000000000000000';
+ $expected .= '00000000000000000000000000000000000000000000000000';
+ $result = '';
+
+ for ($n = 0; $n < 200; $n++) {
+ $result .= $rule($n);
+ }
+ $this->assertIdentical($expected, $result, "Locale: `{$locale}`\n{:message}");
+ }
+ }
+
+ /**
+ * Tests the plural rule #1 which applies to the following languages
+ * grouped by family and sorted alphabetically.
+ *
+ * Constructed language:
+ * - Esperanto (eo)
+ *
+ * Germanic family:
+ * - Danish (da)
+ * - Dutch (nl)
+ * - English (en)
+ * - Faroese (fo)
+ * - German (de)
+ * - Norwegian (no)
+ * - Norwegian Nynorsk (nn)
+ * - Swedish (sv)
+ *
+ * Finno-Urgic family:
+ * - Estonian (et)
+ * - Finnish (fi)
+ * - Hungarian (hu)
+ *
+ * Latin/Greek family:
+ * - Greek (el)
+ *
+ * Romanic family:
+ * - Italian (it)
+ * - Portuguese (pt)
+ * - Spanish (es)
+ *
+ * Semitic family:
+ * - Hebrew (he)
+ *
+ * Slavic family:
+ * - Bulgarian (bg)
+ *
+ * Turkic family:
+ * - Turkish (tr)
+ *
+ * @return void
+ */
+ public function testPlurals1() {
+ $locales = array(
+ 'eo',
+ 'da', 'nl', 'en', 'fo', 'de', 'no', 'nn', 'sv',
+ 'et', 'fi', 'hu',
+ 'eu',
+ 'el',
+ 'ca', 'it', 'pt', 'es',
+ 'he',
+ 'bg',
+ 'tr'
+ );
+ foreach ($locales as $locale) {
+ $expected = 2;
+ $result = Catalog::read(true, 'message.pluralForms', $locale);
+ $this->assertEqual($expected, $result, "Locale: `{$locale}`\n{:message}");
+
+ $rule = Catalog::read(true, 'message.pluralRule', $locale);
+
+ $expected = '10111111111111111111111111111111111111111111111111';
+ $expected .= '11111111111111111111111111111111111111111111111111';
+ $expected .= '11111111111111111111111111111111111111111111111111';
+ $expected .= '11111111111111111111111111111111111111111111111111';
+ $result = '';
+
+ for ($n = 0; $n < 200; $n++) {
+ $result .= $rule($n);
+ }
+ $this->assertIdentical($expected, $result, "Locale: `{$locale}`\n{:message}");
+ }
+ }
+
+ /**
+ * Tests the plural rule #2 which applies to the following languages
+ * grouped by family and sorted alphabetically.
+ *
+ * Romanic family:
+ * - French (fr)
+ * - Brazilian Portuguese (pt_BR)
+ *
+ * @return void
+ */
+ public function testPlurals2() {
+ $locales = array(
+ 'fr', 'pt_BR'
+ );
+ foreach ($locales as $locale) {
+ $expected = 2;
+ $result = Catalog::read(true, 'message.pluralForms', $locale);
+ $this->assertEqual($expected, $result, "Locale: `{$locale}`\n{:message}");
+
+ $rule = Catalog::read(true, 'message.pluralRule', $locale);
+
+ $expected = '00111111111111111111111111111111111111111111111111';
+ $expected .= '11111111111111111111111111111111111111111111111111';
+ $expected .= '11111111111111111111111111111111111111111111111111';
+ $expected .= '11111111111111111111111111111111111111111111111111';
+ $result = '';
+
+ for ($n = 0; $n < 200; $n++) {
+ $result .= $rule($n);
+ }
+ $this->assertIdentical($expected, $result, "Locale: `{$locale}`\n{:message}");
+ }
+ }
+
+ /**
+ * Tests the plural rule #3 which applies to the following languages
+ * grouped by family and sorted alphabetically.
+ *
+ * Baltic family:
+ * - Latvian (lv)
+ *
+ * @return void
+ */
+ public function testPlurals3() {
+ $locales = array(
+ 'lv'
+ );
+ foreach ($locales as $locale) {
+ $expected = 3;
+ $result = Catalog::read(true, 'message.pluralForms', $locale);
+ $this->assertEqual($expected, $result, "Locale: `{$locale}`\n{:message}");
+
+ $rule = Catalog::read(true, 'message.pluralRule', $locale);
+
+ $expected = '01222222222222222222212222222221222222222122222222';
+ $expected .= '21222222222122222222212222222221222222222122222222';
+ $expected .= '21222222222222222222212222222221222222222122222222';
+ $expected .= '21222222222122222222212222222221222222222122222222';
+ $result = '';
+
+ for ($n = 0; $n < 200; $n++) {
+ $result .= $rule($n);
+ }
+ $this->assertIdentical($expected, $result, "Locale: `{$locale}`\n{:message}");
+ }
+ }
+
+ /**
+ * Tests the plural rule #5 which applies to the following languages
+ * grouped by family and sorted alphabetically.
+ *
+ * Romanic family:
+ * - Romanian (ro)
+ *
+ * @return void
+ */
+ public function testPlurals5() {
+ $locales = array(
+ 'ro'
+ );
+ foreach ($locales as $locale) {
+ $expected = 3;
+ $result = Catalog::read(true, 'message.pluralForms', $locale);
+ $this->assertEqual($expected, $result, "Locale: `{$locale}`\n{:message}");
+
+ $rule = Catalog::read(true, 'message.pluralRule', $locale);
+
+ $expected = '10111111111111111111222222222222222222222222222222';
+ $expected .= '22222222222222222222222222222222222222222222222222';
+ $expected .= '21111111111111111111222222222222222222222222222222';
+ $expected .= '22222222222222222222222222222222222222222222222222';
+ $result = '';
+
+ for ($n = 0; $n < 200; $n++) {
+ $result .= $rule($n);
+ }
+ $this->assertIdentical($expected, $result, "Locale: `{$locale}`\n{:message}");
+ }
+ }
+
+ /**
+ * Tests the plural rule #6 which applies to the following languages
+ * grouped by family and sorted alphabetically.
+ *
+ * Baltic family:
+ * - Lithuanian (lt)
+ *
+ * @return void
+ */
+ public function testPlurals6() {
+ $locales = array(
+ 'lt'
+ );
+ foreach ($locales as $locale) {
+ $expected = 3;
+ $result = Catalog::read(true, 'message.pluralForms', $locale);
+ $this->assertEqual($expected, $result, "Locale: `{$locale}`\n{:message}");
+
+ $rule = Catalog::read(true, 'message.pluralRule', $locale);
+
+ $expected = '20111111112222222222201111111120111111112011111111';
+ $expected .= '20111111112011111111201111111120111111112011111111';
+ $expected .= '20111111112222222222201111111120111111112011111111';
+ $expected .= '20111111112011111111201111111120111111112011111111';
+ $result = '';
+
+ for ($n = 0; $n < 200; $n++) {
+ $result .= $rule($n);
+ }
+ $this->assertIdentical($expected, $result, "Locale: `{$locale}`\n{:message}");
+ }
+ }
+
+ /**
+ * Tests the plural rule #7 which applies to the following languages
+ * grouped by family and sorted alphabetically.
+ *
+ * Slavic family:
+ * - Croatian (hr)
+ * - Serbian (sr)
+ * - Russian (ru)
+ * - Ukrainian (uk)
+ *
+ * @return void
+ */
+ public function testPlurals7() {
+ $locales = array(
+ 'hr', 'sr', 'ru', 'uk'
+ );
+ foreach ($locales as $locale) {
+ $expected = 3;
+ $result = Catalog::read(true, 'message.pluralForms', $locale);
+ $this->assertEqual($expected, $result, "Locale: `{$locale}`\n{:message}");
+
+ $rule = Catalog::read(true, 'message.pluralRule', $locale);
+
+ $expected = '20111222222222222222201112222220111222222011122222';
+ $expected .= '20111222222011122222201112222220111222222011122222';
+ $expected .= '20111222222222222222201112222220111222222011122222';
+ $expected .= '20111222222011122222201112222220111222222011122222';
+ $result = '';
+
+ for ($n = 0; $n < 200; $n++) {
+ $result .= $rule($n);
+ }
+ $this->assertIdentical($expected, $result, "Locale: `{$locale}`\n{:message}");
+ }
+ }
+
+ /**
+ * Tests the plural rule #8 which applies to the following languages
+ * grouped by family and sorted alphabetically.
+ *
+ * Slavic family:
+ * - Slovak (sk)
+ * - Czech (cs)
+ *
+ * @return void
+ */
+ public function testPlurals8() {
+ $locales = array(
+ 'sk', 'cs'
+ );
+ foreach ($locales as $locale) {
+ $expected = 3;
+ $result = Catalog::read(true, 'message.pluralForms', $locale);
+ $this->assertEqual($expected, $result, "Locale: `{$locale}`\n{:message}");
+
+ $rule = Catalog::read(true, 'message.pluralRule', $locale);
+
+ $expected = '20111222222222222222222222222222222222222222222222';
+ $expected .= '22222222222222222222222222222222222222222222222222';
+ $expected .= '22222222222222222222222222222222222222222222222222';
+ $expected .= '22222222222222222222222222222222222222222222222222';
+ $result = '';
+
+ for ($n = 0; $n < 200; $n++) {
+ $result .= $rule($n);
+ }
+ $this->assertIdentical($expected, $result, "Locale: `{$locale}`\n{:message}");
+ }
+ }
+
+ /**
+ * Tests the plural rule #9 which applies to the following languages
+ * grouped by family and sorted alphabetically.
+ *
+ * Slavic family:
+ * - Polish (pl)
+ *
+ * @return void
+ */
+ public function testPlurals9() {
+ $locales = array(
+ 'pl'
+ );
+ foreach ($locales as $locale) {
+ $expected = 3;
+ $result = Catalog::read(true, 'message.pluralForms', $locale);
+ $this->assertEqual($expected, $result, "Locale: `{$locale}`\n{:message}");
+
+ $rule = Catalog::read(true, 'message.pluralRule', $locale);
+
+ $expected = '20111222222222222222221112222222111222222211122222';
+ $expected .= '22111222222211122222221112222222111222222211122222';
+ $expected .= '22111222222222222222221112222222111222222211122222';
+ $expected .= '22111222222211122222221112222222111222222211122222';
+ $result = '';
+
+ for ($n = 0; $n < 200; $n++) {
+ $result .= $rule($n);
+ }
+ $this->assertIdentical($expected, $result, "Locale: `{$locale}`\n{:message}");
+ }
+ }
+
+ /**
+ * Tests the plural rule #10 which applies to the following languages
+ * grouped by family and sorted alphabetically.
+ *
+ * Slavic family:
+ * - Slovenian (sl)
+ *
+ * @return void
+ */
+ public function testPlurals10() {
+ $locales = array(
+ 'sl'
+ );
+ foreach ($locales as $locale) {
+ $expected = 4;
+ $result = Catalog::read(true, 'message.pluralForms', $locale);
+ $this->assertEqual($expected, $result, "Locale: `{$locale}`\n{:message}");
+
+ $rule = Catalog::read(true, 'message.pluralRule', $locale);
+
+ $expected = '30122333333333333333333333333333333333333333333333';
+ $expected .= '33333333333333333333333333333333333333333333333333';
+ $expected .= '30122333333333333333333333333333333333333333333333';
+ $expected .= '33333333333333333333333333333333333333333333333333';
+ $result = '';
+
+ for ($n = 0; $n < 200; $n++) {
+ $result .= $rule($n);
+ }
+ $this->assertIdentical($expected, $result, "Locale: `{$locale}`\n{:message}");
+ }
+ }
+
+ /**
+ * Tests the plural rule #11 which applies to the following languages
+ * grouped by family and sorted alphabetically.
+ *
+ * Celtic family:
+ * - Irish (ga)
+ *
+ * @return void
+ */
+ public function testPlurals11() {
+ $locales = array(
+ 'ga'
+ );
+ foreach ($locales as $locale) {
+ $expected = 3;
+ $result = Catalog::read(true, 'message.pluralForms', $locale);
+ $this->assertEqual($expected, $result, "Locale: `{$locale}`\n{:message}");
+
+ $rule = Catalog::read(true, 'message.pluralRule', $locale);
+
+ $expected = '20122222222222222222222222222222222222222222222222';
+ $expected .= '22222222222222222222222222222222222222222222222222';
+ $expected .= '22222222222222222222222222222222222222222222222222';
+ $expected .= '22222222222222222222222222222222222222222222222222';
+ $result = '';
+
+ for ($n = 0; $n < 200; $n++) {
+ $result .= $rule($n);
+ }
+ $this->assertIdentical($expected, $result, "Locale: `{$locale}`\n{:message}");
+ }
+ }
+}
+
+?>
137 tests/integration/g11n/ResourcesValidatorTest.php
@@ -0,0 +1,137 @@
+<?php
+/**
+ * Lithium: the most rad php framework
+ *
+ * @copyright Copyright 2011, Union of RAD (http://union-of-rad.org)
+ * @license http://opensource.org/licenses/bsd-license.php The BSD License
+ */
+
+namespace li3_lldr\tests\integration\g11n;
+
+use lithium\core\Libraries;
+use lithium\g11n\Catalog;
+use lithium\util\Validator;
+
+class ResourcesValidatorTest extends \lithium\test\Unit {
+
+ protected $_backups = array();
+
+ public function setUp() {
+ $this->_backups['catalogConfig'] = Catalog::config();
+ Catalog::reset();
+ Catalog::config(array(
+ 'li3_lldr' => array(
+ 'adapter' => 'Php',
+ 'path' => Libraries::get('li3_lldr', 'path') . '/resources/g11n/php'
+ )));
+ Validator::__init();
+ }
+
+ public function tearDown() {
+ Catalog::reset();
+ Catalog::config($this->_backups['catalogConfig']);
+ }
+
+ public function testDaDk() {
+ Validator::add(Catalog::read(true, 'validation', 'da_DK'));
+
+ $this->assertTrue(Validator::isSsn('123456-1234'));
+ $this->assertFalse(Validator::isSsn('12345-1234'));
+ }
+
+ public function testDeBe() {
+ Validator::add(Catalog::read(true, 'validation', 'de_BE'));
+
+ $this->assertTrue(Validator::isPostalCode('1234'));
+ $this->assertTrue(Validator::isPostalCode('1234'));
+ $this->assertFalse(Validator::isPostalCode('0123'));
+ }
+
+ public function testDeDe() {
+ Validator::add(Catalog::read(true, 'validation', 'de_DE'));
+
+ $this->assertTrue(Validator::isPostalCode('12345'));
+ $this->assertFalse(Validator::isPostalCode('123456'));
+ }
+
+ public function testEnCa() {
+ Validator::add(Catalog::read(true, 'validation', 'en_CA'));
+
+ $this->assertTrue(Validator::isPhone('(401) 321-9876'));
+
+ $this->assertTrue(Validator::isPostalCode('M5J 2G8'));
+ $this->assertTrue(Validator::isPostalCode('H2X 3X5'));
+ }
+
+ public function testEnGb() {
+ Validator::add(Catalog::read(true, 'validation', 'en_GB'));
+
+ $this->assertTrue(Validator::isPostalCode('M1 1AA'));
+ $this->assertTrue(Validator::isPostalCode('M60 1NW'));
+ $this->assertTrue(Validator::isPostalCode('CR2 6XH'));
+ $this->assertTrue(Validator::isPostalCode('DN55 1PT'));
+ $this->assertTrue(Validator::isPostalCode('W1A 1HQ'));
+ $this->assertTrue(Validator::isPostalCode('EC1A 1BB'));
+ $this->assertTrue(Validator::isPostalCode('FK7 0AQ'));
+ $this->assertTrue(Validator::isPostalCode('FK8 2ET'));
+ $this->assertTrue(Validator::isPostalCode('FK8 1EB'));
+ $this->assertTrue(Validator::isPostalCode('EH1 1QX'));
+ $this->assertFalse(Validator::isPostalCode('EH1-1QX'));
+ $this->assertFalse(Validator::isPostalCode('EH11QX'));
+ $this->assertFalse(Validator::isPostalCode('FEH1 1QX'));
+ }
+
+ public function testEnUs() {
+ Validator::add(Catalog::read(true, 'validation', 'en_US'));
+
+ $this->assertTrue(Validator::isPhone('(401) 321-9876'));
+
+ $this->assertTrue(Validator::isPostalCode('11201'));
+ $this->assertTrue(Validator::isPostalCode('11201-0456'));
+
+ $this->assertTrue(Validator::isSsn('478-36-4120'));
+ $this->assertFalse(Validator::isSsn('478-36-41200'));
+ $this->assertFalse(Validator::isSsn('478364120'));
+ }
+
+ public function testFrBe() {
+ Validator::add(Catalog::read(true, 'validation', 'fr_BE'));
+
+ $this->assertTrue(Validator::isPostalCode('1234'));
+ $this->assertTrue(Validator::isPostalCode('1234'));
+ $this->assertFalse(Validator::isPostalCode('0123'));
+ }
+
+ public function testFrCa() {
+ Validator::add(Catalog::read(true, 'validation', 'fr_CA'));
+
+ $this->assertTrue(Validator::isPhone('(401) 321-9876'));
+
+ $this->assertTrue(Validator::isPostalCode('M5J 2G8'));
+ $this->assertTrue(Validator::isPostalCode('H2X 3X5'));
+ }
+
+ public function testItIt() {
+ Validator::add(Catalog::read(true, 'validation', 'it_IT'));
+
+ $this->assertTrue(Validator::isPostalCode('12345'));
+ $this->assertFalse(Validator::isPostalCode('123456'));
+ }
+
+ public function testNlBe() {
+ Validator::add(Catalog::read(true, 'validation', 'nl_BE'));
+
+ $this->assertTrue(Validator::isPostalCode('1234'));
+ $this->assertTrue(Validator::isPostalCode('1234'));
+ $this->assertFalse(Validator::isPostalCode('0123'));
+ }
+
+ public function testNlNl() {
+ Validator::add(Catalog::read(true, 'validation', 'nl_NL'));
+
+ $this->assertTrue(Validator::isSsn('123456789'));
+ $this->assertFalse(Validator::isSsn('12345678'));
+ }
+}
+
+?>
Please sign in to comment.
Something went wrong with that request. Please try again.