pictcode / lib / Cake / Test / Case / I18n / I18nTest.php @ 635eef61
履歴 | 表示 | アノテート | ダウンロード (105.923 KB)
1 |
<?php
|
---|---|
2 |
/**
|
3 |
* I18nTest file
|
4 |
*
|
5 |
* CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
|
6 |
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
7 |
*
|
8 |
* Licensed under The MIT License
|
9 |
* For full copyright and license information, please see the LICENSE.txt
|
10 |
* Redistributions of files must retain the above copyright notice
|
11 |
*
|
12 |
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
13 |
* @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
|
14 |
* @package Cake.Test.Case.I18n
|
15 |
* @since CakePHP(tm) v 1.2.0.5432
|
16 |
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
17 |
*/
|
18 |
|
19 |
App::uses('I18n', 'I18n'); |
20 |
App::uses('CakeSession', 'Model/Datasource'); |
21 |
|
22 |
/**
|
23 |
* I18nTest class
|
24 |
*
|
25 |
* @package Cake.Test.Case.I18n
|
26 |
*/
|
27 |
class I18nTest extends CakeTestCase { |
28 |
|
29 |
/**
|
30 |
* setUp method
|
31 |
*
|
32 |
* @return void
|
33 |
*/
|
34 |
public function setUp() { |
35 |
parent::setUp();
|
36 |
|
37 |
Cache::delete('object_map', '_cake_core_'); |
38 |
App::build(array( |
39 |
'Locale' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Locale' . DS), |
40 |
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS) |
41 |
), App::RESET); |
42 |
CakePlugin::load(array('TestPlugin')); |
43 |
} |
44 |
|
45 |
/**
|
46 |
* tearDown method
|
47 |
*
|
48 |
* @return void
|
49 |
*/
|
50 |
public function tearDown() { |
51 |
parent::tearDown();
|
52 |
|
53 |
Cache::delete('object_map', '_cake_core_'); |
54 |
App::build();
|
55 |
CakePlugin::unload();
|
56 |
} |
57 |
|
58 |
/**
|
59 |
* testTranslationCaching method
|
60 |
*
|
61 |
* @return void
|
62 |
*/
|
63 |
public function testTranslationCaching() { |
64 |
Configure::write('Config.language', 'cache_test_po'); |
65 |
|
66 |
// reset internally stored entries
|
67 |
I18n::clear();
|
68 |
|
69 |
Cache::clear(false, '_cake_core_'); |
70 |
$lang = Configure::read('Config.language'); |
71 |
|
72 |
Cache::config('_cake_core_', Cache::config('default')); |
73 |
|
74 |
// make some calls to translate using different domains
|
75 |
$this->assertEquals('Dom 1 Foo', I18n::translate('dom1.foo', false, 'dom1')); |
76 |
$this->assertEquals('Dom 1 Bar', I18n::translate('dom1.bar', false, 'dom1')); |
77 |
$domains = I18n::domains(); |
78 |
$this->assertEquals('Dom 1 Foo', $domains['dom1']['cache_test_po']['LC_MESSAGES']['dom1.foo']['']); |
79 |
|
80 |
// reset internally stored entries
|
81 |
I18n::clear();
|
82 |
|
83 |
// now only dom1 should be in cache
|
84 |
$cachedDom1 = Cache::read('dom1_' . $lang, '_cake_core_'); |
85 |
$this->assertEquals('Dom 1 Foo', $cachedDom1['LC_MESSAGES']['dom1.foo']['']); |
86 |
$this->assertEquals('Dom 1 Bar', $cachedDom1['LC_MESSAGES']['dom1.bar']['']); |
87 |
// dom2 not in cache
|
88 |
$this->assertFalse(Cache::read('dom2_' . $lang, '_cake_core_')); |
89 |
|
90 |
// translate a item of dom2 (adds dom2 to cache)
|
91 |
$this->assertEquals('Dom 2 Foo', I18n::translate('dom2.foo', false, 'dom2')); |
92 |
|
93 |
// verify dom2 was cached through manual read from cache
|
94 |
$cachedDom2 = Cache::read('dom2_' . $lang, '_cake_core_'); |
95 |
$this->assertEquals('Dom 2 Foo', $cachedDom2['LC_MESSAGES']['dom2.foo']['']); |
96 |
$this->assertEquals('Dom 2 Bar', $cachedDom2['LC_MESSAGES']['dom2.bar']['']); |
97 |
|
98 |
// modify cache entry manually to verify that dom1 entries now will be read from cache
|
99 |
$cachedDom1['LC_MESSAGES']['dom1.foo'][''] = 'FOO'; |
100 |
Cache::write('dom1_' . $lang, $cachedDom1, '_cake_core_'); |
101 |
$this->assertEquals('FOO', I18n::translate('dom1.foo', false, 'dom1')); |
102 |
} |
103 |
|
104 |
/**
|
105 |
* testDefaultStrings method
|
106 |
*
|
107 |
* @return void
|
108 |
*/
|
109 |
public function testDefaultStrings() { |
110 |
$singular = $this->_singular(); |
111 |
$this->assertEquals('Plural Rule 1', $singular); |
112 |
|
113 |
$plurals = $this->_plural(); |
114 |
$this->assertTrue(in_array('0 = 0 or > 1', $plurals)); |
115 |
$this->assertTrue(in_array('1 = 1', $plurals)); |
116 |
$this->assertTrue(in_array('2 = 0 or > 1', $plurals)); |
117 |
$this->assertTrue(in_array('3 = 0 or > 1', $plurals)); |
118 |
$this->assertTrue(in_array('4 = 0 or > 1', $plurals)); |
119 |
$this->assertTrue(in_array('5 = 0 or > 1', $plurals)); |
120 |
$this->assertTrue(in_array('6 = 0 or > 1', $plurals)); |
121 |
$this->assertTrue(in_array('7 = 0 or > 1', $plurals)); |
122 |
$this->assertTrue(in_array('8 = 0 or > 1', $plurals)); |
123 |
$this->assertTrue(in_array('9 = 0 or > 1', $plurals)); |
124 |
$this->assertTrue(in_array('10 = 0 or > 1', $plurals)); |
125 |
$this->assertTrue(in_array('11 = 0 or > 1', $plurals)); |
126 |
$this->assertTrue(in_array('12 = 0 or > 1', $plurals)); |
127 |
$this->assertTrue(in_array('13 = 0 or > 1', $plurals)); |
128 |
$this->assertTrue(in_array('14 = 0 or > 1', $plurals)); |
129 |
$this->assertTrue(in_array('15 = 0 or > 1', $plurals)); |
130 |
$this->assertTrue(in_array('16 = 0 or > 1', $plurals)); |
131 |
$this->assertTrue(in_array('17 = 0 or > 1', $plurals)); |
132 |
$this->assertTrue(in_array('18 = 0 or > 1', $plurals)); |
133 |
$this->assertTrue(in_array('19 = 0 or > 1', $plurals)); |
134 |
$this->assertTrue(in_array('20 = 0 or > 1', $plurals)); |
135 |
$this->assertTrue(in_array('21 = 0 or > 1', $plurals)); |
136 |
$this->assertTrue(in_array('22 = 0 or > 1', $plurals)); |
137 |
$this->assertTrue(in_array('23 = 0 or > 1', $plurals)); |
138 |
$this->assertTrue(in_array('24 = 0 or > 1', $plurals)); |
139 |
$this->assertTrue(in_array('25 = 0 or > 1', $plurals)); |
140 |
|
141 |
$coreSingular = $this->_singularFromCore(); |
142 |
$this->assertEquals('Plural Rule 1 (from core)', $coreSingular); |
143 |
|
144 |
$corePlurals = $this->_pluralFromCore(); |
145 |
$this->assertTrue(in_array('0 = 0 or > 1 (from core)', $corePlurals)); |
146 |
$this->assertTrue(in_array('1 = 1 (from core)', $corePlurals)); |
147 |
$this->assertTrue(in_array('2 = 0 or > 1 (from core)', $corePlurals)); |
148 |
$this->assertTrue(in_array('3 = 0 or > 1 (from core)', $corePlurals)); |
149 |
$this->assertTrue(in_array('4 = 0 or > 1 (from core)', $corePlurals)); |
150 |
$this->assertTrue(in_array('5 = 0 or > 1 (from core)', $corePlurals)); |
151 |
$this->assertTrue(in_array('6 = 0 or > 1 (from core)', $corePlurals)); |
152 |
$this->assertTrue(in_array('7 = 0 or > 1 (from core)', $corePlurals)); |
153 |
$this->assertTrue(in_array('8 = 0 or > 1 (from core)', $corePlurals)); |
154 |
$this->assertTrue(in_array('9 = 0 or > 1 (from core)', $corePlurals)); |
155 |
$this->assertTrue(in_array('10 = 0 or > 1 (from core)', $corePlurals)); |
156 |
$this->assertTrue(in_array('11 = 0 or > 1 (from core)', $corePlurals)); |
157 |
$this->assertTrue(in_array('12 = 0 or > 1 (from core)', $corePlurals)); |
158 |
$this->assertTrue(in_array('13 = 0 or > 1 (from core)', $corePlurals)); |
159 |
$this->assertTrue(in_array('14 = 0 or > 1 (from core)', $corePlurals)); |
160 |
$this->assertTrue(in_array('15 = 0 or > 1 (from core)', $corePlurals)); |
161 |
$this->assertTrue(in_array('16 = 0 or > 1 (from core)', $corePlurals)); |
162 |
$this->assertTrue(in_array('17 = 0 or > 1 (from core)', $corePlurals)); |
163 |
$this->assertTrue(in_array('18 = 0 or > 1 (from core)', $corePlurals)); |
164 |
$this->assertTrue(in_array('19 = 0 or > 1 (from core)', $corePlurals)); |
165 |
$this->assertTrue(in_array('20 = 0 or > 1 (from core)', $corePlurals)); |
166 |
$this->assertTrue(in_array('21 = 0 or > 1 (from core)', $corePlurals)); |
167 |
$this->assertTrue(in_array('22 = 0 or > 1 (from core)', $corePlurals)); |
168 |
$this->assertTrue(in_array('23 = 0 or > 1 (from core)', $corePlurals)); |
169 |
$this->assertTrue(in_array('24 = 0 or > 1 (from core)', $corePlurals)); |
170 |
$this->assertTrue(in_array('25 = 0 or > 1 (from core)', $corePlurals)); |
171 |
} |
172 |
|
173 |
/**
|
174 |
* testPoRulesZero method
|
175 |
*
|
176 |
* @return void
|
177 |
*/
|
178 |
public function testPoRulesZero() { |
179 |
Configure::write('Config.language', 'rule_0_po'); |
180 |
$this->assertRulesZero();
|
181 |
} |
182 |
|
183 |
/**
|
184 |
* testMoRulesZero method
|
185 |
*
|
186 |
* @return void
|
187 |
*/
|
188 |
public function testMoRulesZero() { |
189 |
Configure::write('Config.language', 'rule_0_mo'); |
190 |
$this->assertRulesZero();
|
191 |
} |
192 |
|
193 |
/**
|
194 |
* Assertions for rules zero.
|
195 |
*
|
196 |
* @return void
|
197 |
*/
|
198 |
public function assertRulesZero() { |
199 |
$singular = $this->_singular(); |
200 |
$this->assertEquals('Plural Rule 0 (translated)', $singular); |
201 |
|
202 |
$plurals = $this->_plural(); |
203 |
$this->assertTrue(in_array('0 ends with any # (translated)', $plurals)); |
204 |
$this->assertTrue(in_array('1 ends with any # (translated)', $plurals)); |
205 |
$this->assertTrue(in_array('2 ends with any # (translated)', $plurals)); |
206 |
$this->assertTrue(in_array('3 ends with any # (translated)', $plurals)); |
207 |
$this->assertTrue(in_array('4 ends with any # (translated)', $plurals)); |
208 |
$this->assertTrue(in_array('5 ends with any # (translated)', $plurals)); |
209 |
$this->assertTrue(in_array('6 ends with any # (translated)', $plurals)); |
210 |
$this->assertTrue(in_array('7 ends with any # (translated)', $plurals)); |
211 |
$this->assertTrue(in_array('8 ends with any # (translated)', $plurals)); |
212 |
$this->assertTrue(in_array('9 ends with any # (translated)', $plurals)); |
213 |
$this->assertTrue(in_array('10 ends with any # (translated)', $plurals)); |
214 |
$this->assertTrue(in_array('11 ends with any # (translated)', $plurals)); |
215 |
$this->assertTrue(in_array('12 ends with any # (translated)', $plurals)); |
216 |
$this->assertTrue(in_array('13 ends with any # (translated)', $plurals)); |
217 |
$this->assertTrue(in_array('14 ends with any # (translated)', $plurals)); |
218 |
$this->assertTrue(in_array('15 ends with any # (translated)', $plurals)); |
219 |
$this->assertTrue(in_array('16 ends with any # (translated)', $plurals)); |
220 |
$this->assertTrue(in_array('17 ends with any # (translated)', $plurals)); |
221 |
$this->assertTrue(in_array('18 ends with any # (translated)', $plurals)); |
222 |
$this->assertTrue(in_array('19 ends with any # (translated)', $plurals)); |
223 |
$this->assertTrue(in_array('20 ends with any # (translated)', $plurals)); |
224 |
$this->assertTrue(in_array('21 ends with any # (translated)', $plurals)); |
225 |
$this->assertTrue(in_array('22 ends with any # (translated)', $plurals)); |
226 |
$this->assertTrue(in_array('23 ends with any # (translated)', $plurals)); |
227 |
$this->assertTrue(in_array('24 ends with any # (translated)', $plurals)); |
228 |
$this->assertTrue(in_array('25 ends with any # (translated)', $plurals)); |
229 |
|
230 |
$coreSingular = $this->_singularFromCore(); |
231 |
$this->assertEquals('Plural Rule 0 (from core translated)', $coreSingular); |
232 |
|
233 |
$corePlurals = $this->_pluralFromCore(); |
234 |
$this->assertTrue(in_array('0 ends with any # (from core translated)', $corePlurals)); |
235 |
$this->assertTrue(in_array('1 ends with any # (from core translated)', $corePlurals)); |
236 |
$this->assertTrue(in_array('2 ends with any # (from core translated)', $corePlurals)); |
237 |
$this->assertTrue(in_array('3 ends with any # (from core translated)', $corePlurals)); |
238 |
$this->assertTrue(in_array('4 ends with any # (from core translated)', $corePlurals)); |
239 |
$this->assertTrue(in_array('5 ends with any # (from core translated)', $corePlurals)); |
240 |
$this->assertTrue(in_array('6 ends with any # (from core translated)', $corePlurals)); |
241 |
$this->assertTrue(in_array('7 ends with any # (from core translated)', $corePlurals)); |
242 |
$this->assertTrue(in_array('8 ends with any # (from core translated)', $corePlurals)); |
243 |
$this->assertTrue(in_array('9 ends with any # (from core translated)', $corePlurals)); |
244 |
$this->assertTrue(in_array('10 ends with any # (from core translated)', $corePlurals)); |
245 |
$this->assertTrue(in_array('11 ends with any # (from core translated)', $corePlurals)); |
246 |
$this->assertTrue(in_array('12 ends with any # (from core translated)', $corePlurals)); |
247 |
$this->assertTrue(in_array('13 ends with any # (from core translated)', $corePlurals)); |
248 |
$this->assertTrue(in_array('14 ends with any # (from core translated)', $corePlurals)); |
249 |
$this->assertTrue(in_array('15 ends with any # (from core translated)', $corePlurals)); |
250 |
$this->assertTrue(in_array('16 ends with any # (from core translated)', $corePlurals)); |
251 |
$this->assertTrue(in_array('17 ends with any # (from core translated)', $corePlurals)); |
252 |
$this->assertTrue(in_array('18 ends with any # (from core translated)', $corePlurals)); |
253 |
$this->assertTrue(in_array('19 ends with any # (from core translated)', $corePlurals)); |
254 |
$this->assertTrue(in_array('20 ends with any # (from core translated)', $corePlurals)); |
255 |
$this->assertTrue(in_array('21 ends with any # (from core translated)', $corePlurals)); |
256 |
$this->assertTrue(in_array('22 ends with any # (from core translated)', $corePlurals)); |
257 |
$this->assertTrue(in_array('23 ends with any # (from core translated)', $corePlurals)); |
258 |
$this->assertTrue(in_array('24 ends with any # (from core translated)', $corePlurals)); |
259 |
$this->assertTrue(in_array('25 ends with any # (from core translated)', $corePlurals)); |
260 |
} |
261 |
|
262 |
/**
|
263 |
* testPoRulesOne method
|
264 |
*
|
265 |
* @return void
|
266 |
*/
|
267 |
public function testPoRulesOne() { |
268 |
Configure::write('Config.language', 'rule_1_po'); |
269 |
$this->assertRulesOne();
|
270 |
} |
271 |
|
272 |
/**
|
273 |
* testMoRulesOne method
|
274 |
*
|
275 |
* @return void
|
276 |
*/
|
277 |
public function testMoRulesOne() { |
278 |
Configure::write('Config.language', 'rule_1_mo'); |
279 |
$this->assertRulesOne();
|
280 |
} |
281 |
|
282 |
/**
|
283 |
* Assertions for plural rule one
|
284 |
*
|
285 |
* @return void
|
286 |
*/
|
287 |
public function assertRulesOne() { |
288 |
$singular = $this->_singular(); |
289 |
$this->assertEquals('Plural Rule 1 (translated)', $singular); |
290 |
|
291 |
$plurals = $this->_plural(); |
292 |
$this->assertTrue(in_array('0 = 0 or > 1 (translated)', $plurals)); |
293 |
$this->assertTrue(in_array('1 = 1 (translated)', $plurals)); |
294 |
$this->assertTrue(in_array('2 = 0 or > 1 (translated)', $plurals)); |
295 |
$this->assertTrue(in_array('3 = 0 or > 1 (translated)', $plurals)); |
296 |
$this->assertTrue(in_array('4 = 0 or > 1 (translated)', $plurals)); |
297 |
$this->assertTrue(in_array('5 = 0 or > 1 (translated)', $plurals)); |
298 |
$this->assertTrue(in_array('6 = 0 or > 1 (translated)', $plurals)); |
299 |
$this->assertTrue(in_array('7 = 0 or > 1 (translated)', $plurals)); |
300 |
$this->assertTrue(in_array('8 = 0 or > 1 (translated)', $plurals)); |
301 |
$this->assertTrue(in_array('9 = 0 or > 1 (translated)', $plurals)); |
302 |
$this->assertTrue(in_array('10 = 0 or > 1 (translated)', $plurals)); |
303 |
$this->assertTrue(in_array('11 = 0 or > 1 (translated)', $plurals)); |
304 |
$this->assertTrue(in_array('12 = 0 or > 1 (translated)', $plurals)); |
305 |
$this->assertTrue(in_array('13 = 0 or > 1 (translated)', $plurals)); |
306 |
$this->assertTrue(in_array('14 = 0 or > 1 (translated)', $plurals)); |
307 |
$this->assertTrue(in_array('15 = 0 or > 1 (translated)', $plurals)); |
308 |
$this->assertTrue(in_array('16 = 0 or > 1 (translated)', $plurals)); |
309 |
$this->assertTrue(in_array('17 = 0 or > 1 (translated)', $plurals)); |
310 |
$this->assertTrue(in_array('18 = 0 or > 1 (translated)', $plurals)); |
311 |
$this->assertTrue(in_array('19 = 0 or > 1 (translated)', $plurals)); |
312 |
$this->assertTrue(in_array('20 = 0 or > 1 (translated)', $plurals)); |
313 |
$this->assertTrue(in_array('21 = 0 or > 1 (translated)', $plurals)); |
314 |
$this->assertTrue(in_array('22 = 0 or > 1 (translated)', $plurals)); |
315 |
$this->assertTrue(in_array('23 = 0 or > 1 (translated)', $plurals)); |
316 |
$this->assertTrue(in_array('24 = 0 or > 1 (translated)', $plurals)); |
317 |
$this->assertTrue(in_array('25 = 0 or > 1 (translated)', $plurals)); |
318 |
|
319 |
$coreSingular = $this->_singularFromCore(); |
320 |
$this->assertEquals('Plural Rule 1 (from core translated)', $coreSingular); |
321 |
|
322 |
$corePlurals = $this->_pluralFromCore(); |
323 |
$this->assertTrue(in_array('0 = 0 or > 1 (from core translated)', $corePlurals)); |
324 |
$this->assertTrue(in_array('1 = 1 (from core translated)', $corePlurals)); |
325 |
$this->assertTrue(in_array('2 = 0 or > 1 (from core translated)', $corePlurals)); |
326 |
$this->assertTrue(in_array('3 = 0 or > 1 (from core translated)', $corePlurals)); |
327 |
$this->assertTrue(in_array('4 = 0 or > 1 (from core translated)', $corePlurals)); |
328 |
$this->assertTrue(in_array('5 = 0 or > 1 (from core translated)', $corePlurals)); |
329 |
$this->assertTrue(in_array('6 = 0 or > 1 (from core translated)', $corePlurals)); |
330 |
$this->assertTrue(in_array('7 = 0 or > 1 (from core translated)', $corePlurals)); |
331 |
$this->assertTrue(in_array('8 = 0 or > 1 (from core translated)', $corePlurals)); |
332 |
$this->assertTrue(in_array('9 = 0 or > 1 (from core translated)', $corePlurals)); |
333 |
$this->assertTrue(in_array('10 = 0 or > 1 (from core translated)', $corePlurals)); |
334 |
$this->assertTrue(in_array('11 = 0 or > 1 (from core translated)', $corePlurals)); |
335 |
$this->assertTrue(in_array('12 = 0 or > 1 (from core translated)', $corePlurals)); |
336 |
$this->assertTrue(in_array('13 = 0 or > 1 (from core translated)', $corePlurals)); |
337 |
$this->assertTrue(in_array('14 = 0 or > 1 (from core translated)', $corePlurals)); |
338 |
$this->assertTrue(in_array('15 = 0 or > 1 (from core translated)', $corePlurals)); |
339 |
$this->assertTrue(in_array('16 = 0 or > 1 (from core translated)', $corePlurals)); |
340 |
$this->assertTrue(in_array('17 = 0 or > 1 (from core translated)', $corePlurals)); |
341 |
$this->assertTrue(in_array('18 = 0 or > 1 (from core translated)', $corePlurals)); |
342 |
$this->assertTrue(in_array('19 = 0 or > 1 (from core translated)', $corePlurals)); |
343 |
$this->assertTrue(in_array('20 = 0 or > 1 (from core translated)', $corePlurals)); |
344 |
$this->assertTrue(in_array('21 = 0 or > 1 (from core translated)', $corePlurals)); |
345 |
$this->assertTrue(in_array('22 = 0 or > 1 (from core translated)', $corePlurals)); |
346 |
$this->assertTrue(in_array('23 = 0 or > 1 (from core translated)', $corePlurals)); |
347 |
$this->assertTrue(in_array('24 = 0 or > 1 (from core translated)', $corePlurals)); |
348 |
$this->assertTrue(in_array('25 = 0 or > 1 (from core translated)', $corePlurals)); |
349 |
} |
350 |
|
351 |
/**
|
352 |
* testMoRulesTwo method
|
353 |
*
|
354 |
* @return void
|
355 |
*/
|
356 |
public function testMoRulesTwo() { |
357 |
Configure::write('Config.language', 'rule_2_mo'); |
358 |
$this->assertRulesTwo();
|
359 |
} |
360 |
|
361 |
/**
|
362 |
* testPoRulesTwo method
|
363 |
*
|
364 |
* @return void
|
365 |
*/
|
366 |
public function testPoRulesTwo() { |
367 |
Configure::write('Config.language', 'rule_2_po'); |
368 |
$this->assertRulesTwo();
|
369 |
} |
370 |
|
371 |
/**
|
372 |
* Assertions for rules Two
|
373 |
*
|
374 |
* @return void
|
375 |
*/
|
376 |
public function assertRulesTwo() { |
377 |
$singular = $this->_singular(); |
378 |
$this->assertEquals('Plural Rule 2 (translated)', $singular); |
379 |
|
380 |
$plurals = $this->_plural(); |
381 |
$this->assertTrue(in_array('0 = 0 or 1 (translated)', $plurals)); |
382 |
$this->assertTrue(in_array('1 = 0 or 1 (translated)', $plurals)); |
383 |
$this->assertTrue(in_array('2 > 1 (translated)', $plurals)); |
384 |
$this->assertTrue(in_array('3 > 1 (translated)', $plurals)); |
385 |
$this->assertTrue(in_array('4 > 1 (translated)', $plurals)); |
386 |
$this->assertTrue(in_array('5 > 1 (translated)', $plurals)); |
387 |
$this->assertTrue(in_array('6 > 1 (translated)', $plurals)); |
388 |
$this->assertTrue(in_array('7 > 1 (translated)', $plurals)); |
389 |
$this->assertTrue(in_array('8 > 1 (translated)', $plurals)); |
390 |
$this->assertTrue(in_array('9 > 1 (translated)', $plurals)); |
391 |
$this->assertTrue(in_array('10 > 1 (translated)', $plurals)); |
392 |
$this->assertTrue(in_array('11 > 1 (translated)', $plurals)); |
393 |
$this->assertTrue(in_array('12 > 1 (translated)', $plurals)); |
394 |
$this->assertTrue(in_array('13 > 1 (translated)', $plurals)); |
395 |
$this->assertTrue(in_array('14 > 1 (translated)', $plurals)); |
396 |
$this->assertTrue(in_array('15 > 1 (translated)', $plurals)); |
397 |
$this->assertTrue(in_array('16 > 1 (translated)', $plurals)); |
398 |
$this->assertTrue(in_array('17 > 1 (translated)', $plurals)); |
399 |
$this->assertTrue(in_array('18 > 1 (translated)', $plurals)); |
400 |
$this->assertTrue(in_array('19 > 1 (translated)', $plurals)); |
401 |
$this->assertTrue(in_array('20 > 1 (translated)', $plurals)); |
402 |
$this->assertTrue(in_array('21 > 1 (translated)', $plurals)); |
403 |
$this->assertTrue(in_array('22 > 1 (translated)', $plurals)); |
404 |
$this->assertTrue(in_array('23 > 1 (translated)', $plurals)); |
405 |
$this->assertTrue(in_array('24 > 1 (translated)', $plurals)); |
406 |
$this->assertTrue(in_array('25 > 1 (translated)', $plurals)); |
407 |
|
408 |
$coreSingular = $this->_singularFromCore(); |
409 |
$this->assertEquals('Plural Rule 2 (from core translated)', $coreSingular); |
410 |
|
411 |
$corePlurals = $this->_pluralFromCore(); |
412 |
$this->assertTrue(in_array('0 = 0 or 1 (from core translated)', $corePlurals)); |
413 |
$this->assertTrue(in_array('1 = 0 or 1 (from core translated)', $corePlurals)); |
414 |
$this->assertTrue(in_array('2 > 1 (from core translated)', $corePlurals)); |
415 |
$this->assertTrue(in_array('3 > 1 (from core translated)', $corePlurals)); |
416 |
$this->assertTrue(in_array('4 > 1 (from core translated)', $corePlurals)); |
417 |
$this->assertTrue(in_array('5 > 1 (from core translated)', $corePlurals)); |
418 |
$this->assertTrue(in_array('6 > 1 (from core translated)', $corePlurals)); |
419 |
$this->assertTrue(in_array('7 > 1 (from core translated)', $corePlurals)); |
420 |
$this->assertTrue(in_array('8 > 1 (from core translated)', $corePlurals)); |
421 |
$this->assertTrue(in_array('9 > 1 (from core translated)', $corePlurals)); |
422 |
$this->assertTrue(in_array('10 > 1 (from core translated)', $corePlurals)); |
423 |
$this->assertTrue(in_array('11 > 1 (from core translated)', $corePlurals)); |
424 |
$this->assertTrue(in_array('12 > 1 (from core translated)', $corePlurals)); |
425 |
$this->assertTrue(in_array('13 > 1 (from core translated)', $corePlurals)); |
426 |
$this->assertTrue(in_array('14 > 1 (from core translated)', $corePlurals)); |
427 |
$this->assertTrue(in_array('15 > 1 (from core translated)', $corePlurals)); |
428 |
$this->assertTrue(in_array('16 > 1 (from core translated)', $corePlurals)); |
429 |
$this->assertTrue(in_array('17 > 1 (from core translated)', $corePlurals)); |
430 |
$this->assertTrue(in_array('18 > 1 (from core translated)', $corePlurals)); |
431 |
$this->assertTrue(in_array('19 > 1 (from core translated)', $corePlurals)); |
432 |
$this->assertTrue(in_array('20 > 1 (from core translated)', $corePlurals)); |
433 |
$this->assertTrue(in_array('21 > 1 (from core translated)', $corePlurals)); |
434 |
$this->assertTrue(in_array('22 > 1 (from core translated)', $corePlurals)); |
435 |
$this->assertTrue(in_array('23 > 1 (from core translated)', $corePlurals)); |
436 |
$this->assertTrue(in_array('24 > 1 (from core translated)', $corePlurals)); |
437 |
$this->assertTrue(in_array('25 > 1 (from core translated)', $corePlurals)); |
438 |
} |
439 |
|
440 |
/**
|
441 |
* testPoRulesThree method
|
442 |
*
|
443 |
* @return void
|
444 |
*/
|
445 |
public function testPoRulesThree() { |
446 |
Configure::write('Config.language', 'rule_3_po'); |
447 |
$this->assertRulesThree();
|
448 |
} |
449 |
|
450 |
/**
|
451 |
* testMoRulesThree method
|
452 |
*
|
453 |
* @return void
|
454 |
*/
|
455 |
public function testMoRulesThree() { |
456 |
Configure::write('Config.language', 'rule_3_mo'); |
457 |
$this->assertRulesThree();
|
458 |
} |
459 |
|
460 |
/**
|
461 |
* Assert rules for plural three.
|
462 |
*
|
463 |
* @return void
|
464 |
*/
|
465 |
public function assertRulesThree() { |
466 |
$singular = $this->_singular(); |
467 |
$this->assertEquals('Plural Rule 3 (translated)', $singular); |
468 |
|
469 |
$plurals = $this->_plural(); |
470 |
$this->assertTrue(in_array('0 = 0 (translated)', $plurals)); |
471 |
$this->assertTrue(in_array('1 ends 1 but not 11 (translated)', $plurals)); |
472 |
$this->assertTrue(in_array('2 everything else (translated)', $plurals)); |
473 |
$this->assertTrue(in_array('3 everything else (translated)', $plurals)); |
474 |
$this->assertTrue(in_array('4 everything else (translated)', $plurals)); |
475 |
$this->assertTrue(in_array('5 everything else (translated)', $plurals)); |
476 |
$this->assertTrue(in_array('6 everything else (translated)', $plurals)); |
477 |
$this->assertTrue(in_array('7 everything else (translated)', $plurals)); |
478 |
$this->assertTrue(in_array('8 everything else (translated)', $plurals)); |
479 |
$this->assertTrue(in_array('9 everything else (translated)', $plurals)); |
480 |
$this->assertTrue(in_array('10 everything else (translated)', $plurals)); |
481 |
$this->assertTrue(in_array('11 everything else (translated)', $plurals)); |
482 |
$this->assertTrue(in_array('12 everything else (translated)', $plurals)); |
483 |
$this->assertTrue(in_array('13 everything else (translated)', $plurals)); |
484 |
$this->assertTrue(in_array('14 everything else (translated)', $plurals)); |
485 |
$this->assertTrue(in_array('15 everything else (translated)', $plurals)); |
486 |
$this->assertTrue(in_array('16 everything else (translated)', $plurals)); |
487 |
$this->assertTrue(in_array('17 everything else (translated)', $plurals)); |
488 |
$this->assertTrue(in_array('18 everything else (translated)', $plurals)); |
489 |
$this->assertTrue(in_array('19 everything else (translated)', $plurals)); |
490 |
$this->assertTrue(in_array('20 everything else (translated)', $plurals)); |
491 |
$this->assertTrue(in_array('21 ends 1 but not 11 (translated)', $plurals)); |
492 |
$this->assertTrue(in_array('22 everything else (translated)', $plurals)); |
493 |
$this->assertTrue(in_array('23 everything else (translated)', $plurals)); |
494 |
$this->assertTrue(in_array('24 everything else (translated)', $plurals)); |
495 |
$this->assertTrue(in_array('25 everything else (translated)', $plurals)); |
496 |
|
497 |
$coreSingular = $this->_singularFromCore(); |
498 |
$this->assertEquals('Plural Rule 3 (from core translated)', $coreSingular); |
499 |
|
500 |
$corePlurals = $this->_pluralFromCore(); |
501 |
$this->assertTrue(in_array('0 = 0 (from core translated)', $corePlurals)); |
502 |
$this->assertTrue(in_array('1 ends 1 but not 11 (from core translated)', $corePlurals)); |
503 |
$this->assertTrue(in_array('2 everything else (from core translated)', $corePlurals)); |
504 |
$this->assertTrue(in_array('3 everything else (from core translated)', $corePlurals)); |
505 |
$this->assertTrue(in_array('4 everything else (from core translated)', $corePlurals)); |
506 |
$this->assertTrue(in_array('5 everything else (from core translated)', $corePlurals)); |
507 |
$this->assertTrue(in_array('6 everything else (from core translated)', $corePlurals)); |
508 |
$this->assertTrue(in_array('7 everything else (from core translated)', $corePlurals)); |
509 |
$this->assertTrue(in_array('8 everything else (from core translated)', $corePlurals)); |
510 |
$this->assertTrue(in_array('9 everything else (from core translated)', $corePlurals)); |
511 |
$this->assertTrue(in_array('10 everything else (from core translated)', $corePlurals)); |
512 |
$this->assertTrue(in_array('11 everything else (from core translated)', $corePlurals)); |
513 |
$this->assertTrue(in_array('12 everything else (from core translated)', $corePlurals)); |
514 |
$this->assertTrue(in_array('13 everything else (from core translated)', $corePlurals)); |
515 |
$this->assertTrue(in_array('14 everything else (from core translated)', $corePlurals)); |
516 |
$this->assertTrue(in_array('15 everything else (from core translated)', $corePlurals)); |
517 |
$this->assertTrue(in_array('16 everything else (from core translated)', $corePlurals)); |
518 |
$this->assertTrue(in_array('17 everything else (from core translated)', $corePlurals)); |
519 |
$this->assertTrue(in_array('18 everything else (from core translated)', $corePlurals)); |
520 |
$this->assertTrue(in_array('19 everything else (from core translated)', $corePlurals)); |
521 |
$this->assertTrue(in_array('20 everything else (from core translated)', $corePlurals)); |
522 |
$this->assertTrue(in_array('21 ends 1 but not 11 (from core translated)', $corePlurals)); |
523 |
$this->assertTrue(in_array('22 everything else (from core translated)', $corePlurals)); |
524 |
$this->assertTrue(in_array('23 everything else (from core translated)', $corePlurals)); |
525 |
$this->assertTrue(in_array('24 everything else (from core translated)', $corePlurals)); |
526 |
$this->assertTrue(in_array('25 everything else (from core translated)', $corePlurals)); |
527 |
} |
528 |
|
529 |
/**
|
530 |
* testPoRulesFour method
|
531 |
*
|
532 |
* @return void
|
533 |
*/
|
534 |
public function testPoRulesFour() { |
535 |
Configure::write('Config.language', 'rule_4_po'); |
536 |
$this->assertRulesFour();
|
537 |
} |
538 |
|
539 |
/**
|
540 |
* testMoRulesFour method
|
541 |
*
|
542 |
* @return void
|
543 |
*/
|
544 |
public function testMoRulesFour() { |
545 |
Configure::write('Config.language', 'rule_4_mo'); |
546 |
$this->assertRulesFour();
|
547 |
} |
548 |
|
549 |
/**
|
550 |
* Run the assertions for Rule 4 plurals.
|
551 |
*
|
552 |
* @return void
|
553 |
*/
|
554 |
public function assertRulesFour() { |
555 |
$singular = $this->_singular(); |
556 |
$this->assertEquals('Plural Rule 4 (translated)', $singular); |
557 |
|
558 |
$plurals = $this->_plural(); |
559 |
$this->assertTrue(in_array('0 everything else (translated)', $plurals)); |
560 |
$this->assertTrue(in_array('1 = 1 (translated)', $plurals)); |
561 |
$this->assertTrue(in_array('2 = 2 (translated)', $plurals)); |
562 |
$this->assertTrue(in_array('3 everything else (translated)', $plurals)); |
563 |
$this->assertTrue(in_array('4 everything else (translated)', $plurals)); |
564 |
$this->assertTrue(in_array('5 everything else (translated)', $plurals)); |
565 |
$this->assertTrue(in_array('6 everything else (translated)', $plurals)); |
566 |
$this->assertTrue(in_array('7 everything else (translated)', $plurals)); |
567 |
$this->assertTrue(in_array('8 everything else (translated)', $plurals)); |
568 |
$this->assertTrue(in_array('9 everything else (translated)', $plurals)); |
569 |
$this->assertTrue(in_array('10 everything else (translated)', $plurals)); |
570 |
$this->assertTrue(in_array('11 everything else (translated)', $plurals)); |
571 |
$this->assertTrue(in_array('12 everything else (translated)', $plurals)); |
572 |
$this->assertTrue(in_array('13 everything else (translated)', $plurals)); |
573 |
$this->assertTrue(in_array('14 everything else (translated)', $plurals)); |
574 |
$this->assertTrue(in_array('15 everything else (translated)', $plurals)); |
575 |
$this->assertTrue(in_array('16 everything else (translated)', $plurals)); |
576 |
$this->assertTrue(in_array('17 everything else (translated)', $plurals)); |
577 |
$this->assertTrue(in_array('18 everything else (translated)', $plurals)); |
578 |
$this->assertTrue(in_array('19 everything else (translated)', $plurals)); |
579 |
$this->assertTrue(in_array('20 everything else (translated)', $plurals)); |
580 |
$this->assertTrue(in_array('21 everything else (translated)', $plurals)); |
581 |
$this->assertTrue(in_array('22 everything else (translated)', $plurals)); |
582 |
$this->assertTrue(in_array('23 everything else (translated)', $plurals)); |
583 |
$this->assertTrue(in_array('24 everything else (translated)', $plurals)); |
584 |
$this->assertTrue(in_array('25 everything else (translated)', $plurals)); |
585 |
|
586 |
$coreSingular = $this->_singularFromCore(); |
587 |
$this->assertEquals('Plural Rule 4 (from core translated)', $coreSingular); |
588 |
|
589 |
$corePlurals = $this->_pluralFromCore(); |
590 |
$this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals)); |
591 |
$this->assertTrue(in_array('1 = 1 (from core translated)', $corePlurals)); |
592 |
$this->assertTrue(in_array('2 = 2 (from core translated)', $corePlurals)); |
593 |
$this->assertTrue(in_array('3 everything else (from core translated)', $corePlurals)); |
594 |
$this->assertTrue(in_array('4 everything else (from core translated)', $corePlurals)); |
595 |
$this->assertTrue(in_array('5 everything else (from core translated)', $corePlurals)); |
596 |
$this->assertTrue(in_array('6 everything else (from core translated)', $corePlurals)); |
597 |
$this->assertTrue(in_array('7 everything else (from core translated)', $corePlurals)); |
598 |
$this->assertTrue(in_array('8 everything else (from core translated)', $corePlurals)); |
599 |
$this->assertTrue(in_array('9 everything else (from core translated)', $corePlurals)); |
600 |
$this->assertTrue(in_array('10 everything else (from core translated)', $corePlurals)); |
601 |
$this->assertTrue(in_array('11 everything else (from core translated)', $corePlurals)); |
602 |
$this->assertTrue(in_array('12 everything else (from core translated)', $corePlurals)); |
603 |
$this->assertTrue(in_array('13 everything else (from core translated)', $corePlurals)); |
604 |
$this->assertTrue(in_array('14 everything else (from core translated)', $corePlurals)); |
605 |
$this->assertTrue(in_array('15 everything else (from core translated)', $corePlurals)); |
606 |
$this->assertTrue(in_array('16 everything else (from core translated)', $corePlurals)); |
607 |
$this->assertTrue(in_array('17 everything else (from core translated)', $corePlurals)); |
608 |
$this->assertTrue(in_array('18 everything else (from core translated)', $corePlurals)); |
609 |
$this->assertTrue(in_array('19 everything else (from core translated)', $corePlurals)); |
610 |
$this->assertTrue(in_array('20 everything else (from core translated)', $corePlurals)); |
611 |
$this->assertTrue(in_array('21 everything else (from core translated)', $corePlurals)); |
612 |
$this->assertTrue(in_array('22 everything else (from core translated)', $corePlurals)); |
613 |
$this->assertTrue(in_array('23 everything else (from core translated)', $corePlurals)); |
614 |
$this->assertTrue(in_array('24 everything else (from core translated)', $corePlurals)); |
615 |
$this->assertTrue(in_array('25 everything else (from core translated)', $corePlurals)); |
616 |
} |
617 |
|
618 |
/**
|
619 |
* testPoRulesFive method
|
620 |
*
|
621 |
* @return void
|
622 |
*/
|
623 |
public function testPoRulesFive() { |
624 |
Configure::write('Config.language', 'rule_5_po'); |
625 |
$this->assertRulesFive();
|
626 |
} |
627 |
|
628 |
/**
|
629 |
* testMoRulesFive method
|
630 |
*
|
631 |
* @return void
|
632 |
*/
|
633 |
public function testMoRulesFive() { |
634 |
Configure::write('Config.language', 'rule_5_mo'); |
635 |
$this->assertRulesFive();
|
636 |
} |
637 |
|
638 |
/**
|
639 |
* Run the assertions for rule 5 plurals
|
640 |
*
|
641 |
* @return void
|
642 |
*/
|
643 |
public function assertRulesFive() { |
644 |
$singular = $this->_singular(); |
645 |
$this->assertEquals('Plural Rule 5 (translated)', $singular); |
646 |
|
647 |
$plurals = $this->_plural(); |
648 |
$this->assertTrue(in_array('0 = 0 or ends in 01-19 (translated)', $plurals)); |
649 |
$this->assertTrue(in_array('0 = 0 or ends in 01-19 (translated)', $plurals)); |
650 |
$this->assertTrue(in_array('1 = 1 (translated)', $plurals)); |
651 |
$this->assertTrue(in_array('2 = 0 or ends in 01-19 (translated)', $plurals)); |
652 |
$this->assertTrue(in_array('3 = 0 or ends in 01-19 (translated)', $plurals)); |
653 |
$this->assertTrue(in_array('4 = 0 or ends in 01-19 (translated)', $plurals)); |
654 |
$this->assertTrue(in_array('5 = 0 or ends in 01-19 (translated)', $plurals)); |
655 |
$this->assertTrue(in_array('6 = 0 or ends in 01-19 (translated)', $plurals)); |
656 |
$this->assertTrue(in_array('7 = 0 or ends in 01-19 (translated)', $plurals)); |
657 |
$this->assertTrue(in_array('8 = 0 or ends in 01-19 (translated)', $plurals)); |
658 |
$this->assertTrue(in_array('9 = 0 or ends in 01-19 (translated)', $plurals)); |
659 |
$this->assertTrue(in_array('10 = 0 or ends in 01-19 (translated)', $plurals)); |
660 |
$this->assertTrue(in_array('11 = 0 or ends in 01-19 (translated)', $plurals)); |
661 |
$this->assertTrue(in_array('12 = 0 or ends in 01-19 (translated)', $plurals)); |
662 |
$this->assertTrue(in_array('13 = 0 or ends in 01-19 (translated)', $plurals)); |
663 |
$this->assertTrue(in_array('14 = 0 or ends in 01-19 (translated)', $plurals)); |
664 |
$this->assertTrue(in_array('15 = 0 or ends in 01-19 (translated)', $plurals)); |
665 |
$this->assertTrue(in_array('16 = 0 or ends in 01-19 (translated)', $plurals)); |
666 |
$this->assertTrue(in_array('17 = 0 or ends in 01-19 (translated)', $plurals)); |
667 |
$this->assertTrue(in_array('18 = 0 or ends in 01-19 (translated)', $plurals)); |
668 |
$this->assertTrue(in_array('19 = 0 or ends in 01-19 (translated)', $plurals)); |
669 |
$this->assertTrue(in_array('20 everything else (translated)', $plurals)); |
670 |
$this->assertTrue(in_array('21 everything else (translated)', $plurals)); |
671 |
$this->assertTrue(in_array('22 everything else (translated)', $plurals)); |
672 |
$this->assertTrue(in_array('23 everything else (translated)', $plurals)); |
673 |
$this->assertTrue(in_array('24 everything else (translated)', $plurals)); |
674 |
$this->assertTrue(in_array('25 everything else (translated)', $plurals)); |
675 |
|
676 |
$coreSingular = $this->_singularFromCore(); |
677 |
$this->assertEquals('Plural Rule 5 (from core translated)', $coreSingular); |
678 |
|
679 |
$corePlurals = $this->_pluralFromCore(); |
680 |
$this->assertTrue(in_array('0 = 0 or ends in 01-19 (from core translated)', $corePlurals)); |
681 |
$this->assertTrue(in_array('0 = 0 or ends in 01-19 (from core translated)', $corePlurals)); |
682 |
$this->assertTrue(in_array('1 = 1 (from core translated)', $corePlurals)); |
683 |
$this->assertTrue(in_array('2 = 0 or ends in 01-19 (from core translated)', $corePlurals)); |
684 |
$this->assertTrue(in_array('3 = 0 or ends in 01-19 (from core translated)', $corePlurals)); |
685 |
$this->assertTrue(in_array('4 = 0 or ends in 01-19 (from core translated)', $corePlurals)); |
686 |
$this->assertTrue(in_array('5 = 0 or ends in 01-19 (from core translated)', $corePlurals)); |
687 |
$this->assertTrue(in_array('6 = 0 or ends in 01-19 (from core translated)', $corePlurals)); |
688 |
$this->assertTrue(in_array('7 = 0 or ends in 01-19 (from core translated)', $corePlurals)); |
689 |
$this->assertTrue(in_array('8 = 0 or ends in 01-19 (from core translated)', $corePlurals)); |
690 |
$this->assertTrue(in_array('9 = 0 or ends in 01-19 (from core translated)', $corePlurals)); |
691 |
$this->assertTrue(in_array('10 = 0 or ends in 01-19 (from core translated)', $corePlurals)); |
692 |
$this->assertTrue(in_array('11 = 0 or ends in 01-19 (from core translated)', $corePlurals)); |
693 |
$this->assertTrue(in_array('12 = 0 or ends in 01-19 (from core translated)', $corePlurals)); |
694 |
$this->assertTrue(in_array('13 = 0 or ends in 01-19 (from core translated)', $corePlurals)); |
695 |
$this->assertTrue(in_array('14 = 0 or ends in 01-19 (from core translated)', $corePlurals)); |
696 |
$this->assertTrue(in_array('15 = 0 or ends in 01-19 (from core translated)', $corePlurals)); |
697 |
$this->assertTrue(in_array('16 = 0 or ends in 01-19 (from core translated)', $corePlurals)); |
698 |
$this->assertTrue(in_array('17 = 0 or ends in 01-19 (from core translated)', $corePlurals)); |
699 |
$this->assertTrue(in_array('18 = 0 or ends in 01-19 (from core translated)', $corePlurals)); |
700 |
$this->assertTrue(in_array('19 = 0 or ends in 01-19 (from core translated)', $corePlurals)); |
701 |
$this->assertTrue(in_array('20 everything else (from core translated)', $corePlurals)); |
702 |
$this->assertTrue(in_array('21 everything else (from core translated)', $corePlurals)); |
703 |
$this->assertTrue(in_array('22 everything else (from core translated)', $corePlurals)); |
704 |
$this->assertTrue(in_array('23 everything else (from core translated)', $corePlurals)); |
705 |
$this->assertTrue(in_array('24 everything else (from core translated)', $corePlurals)); |
706 |
$this->assertTrue(in_array('25 everything else (from core translated)', $corePlurals)); |
707 |
} |
708 |
|
709 |
/**
|
710 |
* testPoRulesSix method
|
711 |
*
|
712 |
* @return void
|
713 |
*/
|
714 |
public function testPoRulesSix() { |
715 |
Configure::write('Config.language', 'rule_6_po'); |
716 |
$this->assertRulesSix();
|
717 |
} |
718 |
|
719 |
/**
|
720 |
* testMoRulesSix method
|
721 |
*
|
722 |
* @return void
|
723 |
*/
|
724 |
public function testMoRulesSix() { |
725 |
Configure::write('Config.language', 'rule_6_mo'); |
726 |
$this->assertRulesSix();
|
727 |
} |
728 |
|
729 |
/**
|
730 |
* Assertions for the sixth plural rules.
|
731 |
*
|
732 |
* @return void
|
733 |
*/
|
734 |
public function assertRulesSix() { |
735 |
$singular = $this->_singular(); |
736 |
$this->assertEquals('Plural Rule 6 (translated)', $singular); |
737 |
|
738 |
$plurals = $this->_plural(); |
739 |
$this->assertTrue(in_array('0 ends in 0 or ends in 10-20 (translated)', $plurals)); |
740 |
$this->assertTrue(in_array('1 ends in 1, not 11 (translated)', $plurals)); |
741 |
$this->assertTrue(in_array('2 everything else (translated)', $plurals)); |
742 |
$this->assertTrue(in_array('3 everything else (translated)', $plurals)); |
743 |
$this->assertTrue(in_array('4 everything else (translated)', $plurals)); |
744 |
$this->assertTrue(in_array('5 everything else (translated)', $plurals)); |
745 |
$this->assertTrue(in_array('6 everything else (translated)', $plurals)); |
746 |
$this->assertTrue(in_array('7 everything else (translated)', $plurals)); |
747 |
$this->assertTrue(in_array('8 everything else (translated)', $plurals)); |
748 |
$this->assertTrue(in_array('9 everything else (translated)', $plurals)); |
749 |
$this->assertTrue(in_array('10 ends in 0 or ends in 10-20 (translated)', $plurals)); |
750 |
$this->assertTrue(in_array('11 ends in 0 or ends in 10-20 (translated)', $plurals)); |
751 |
$this->assertTrue(in_array('12 ends in 0 or ends in 10-20 (translated)', $plurals)); |
752 |
$this->assertTrue(in_array('13 ends in 0 or ends in 10-20 (translated)', $plurals)); |
753 |
$this->assertTrue(in_array('14 ends in 0 or ends in 10-20 (translated)', $plurals)); |
754 |
$this->assertTrue(in_array('15 ends in 0 or ends in 10-20 (translated)', $plurals)); |
755 |
$this->assertTrue(in_array('16 ends in 0 or ends in 10-20 (translated)', $plurals)); |
756 |
$this->assertTrue(in_array('17 ends in 0 or ends in 10-20 (translated)', $plurals)); |
757 |
$this->assertTrue(in_array('18 ends in 0 or ends in 10-20 (translated)', $plurals)); |
758 |
$this->assertTrue(in_array('19 ends in 0 or ends in 10-20 (translated)', $plurals)); |
759 |
$this->assertTrue(in_array('20 ends in 0 or ends in 10-20 (translated)', $plurals)); |
760 |
$this->assertTrue(in_array('21 ends in 1, not 11 (translated)', $plurals)); |
761 |
$this->assertTrue(in_array('22 everything else (translated)', $plurals)); |
762 |
$this->assertTrue(in_array('23 everything else (translated)', $plurals)); |
763 |
$this->assertTrue(in_array('24 everything else (translated)', $plurals)); |
764 |
$this->assertTrue(in_array('25 everything else (translated)', $plurals)); |
765 |
|
766 |
$coreSingular = $this->_singularFromCore(); |
767 |
$this->assertEquals('Plural Rule 6 (from core translated)', $coreSingular); |
768 |
|
769 |
$corePlurals = $this->_pluralFromCore(); |
770 |
$this->assertTrue(in_array('0 ends in 0 or ends in 10-20 (from core translated)', $corePlurals)); |
771 |
$this->assertTrue(in_array('1 ends in 1, not 11 (from core translated)', $corePlurals)); |
772 |
$this->assertTrue(in_array('2 everything else (from core translated)', $corePlurals)); |
773 |
$this->assertTrue(in_array('3 everything else (from core translated)', $corePlurals)); |
774 |
$this->assertTrue(in_array('4 everything else (from core translated)', $corePlurals)); |
775 |
$this->assertTrue(in_array('5 everything else (from core translated)', $corePlurals)); |
776 |
$this->assertTrue(in_array('6 everything else (from core translated)', $corePlurals)); |
777 |
$this->assertTrue(in_array('7 everything else (from core translated)', $corePlurals)); |
778 |
$this->assertTrue(in_array('8 everything else (from core translated)', $corePlurals)); |
779 |
$this->assertTrue(in_array('9 everything else (from core translated)', $corePlurals)); |
780 |
$this->assertTrue(in_array('10 ends in 0 or ends in 10-20 (from core translated)', $corePlurals)); |
781 |
$this->assertTrue(in_array('11 ends in 0 or ends in 10-20 (from core translated)', $corePlurals)); |
782 |
$this->assertTrue(in_array('12 ends in 0 or ends in 10-20 (from core translated)', $corePlurals)); |
783 |
$this->assertTrue(in_array('13 ends in 0 or ends in 10-20 (from core translated)', $corePlurals)); |
784 |
$this->assertTrue(in_array('14 ends in 0 or ends in 10-20 (from core translated)', $corePlurals)); |
785 |
$this->assertTrue(in_array('15 ends in 0 or ends in 10-20 (from core translated)', $corePlurals)); |
786 |
$this->assertTrue(in_array('16 ends in 0 or ends in 10-20 (from core translated)', $corePlurals)); |
787 |
$this->assertTrue(in_array('17 ends in 0 or ends in 10-20 (from core translated)', $corePlurals)); |
788 |
$this->assertTrue(in_array('18 ends in 0 or ends in 10-20 (from core translated)', $corePlurals)); |
789 |
$this->assertTrue(in_array('19 ends in 0 or ends in 10-20 (from core translated)', $corePlurals)); |
790 |
$this->assertTrue(in_array('20 ends in 0 or ends in 10-20 (from core translated)', $corePlurals)); |
791 |
$this->assertTrue(in_array('21 ends in 1, not 11 (from core translated)', $corePlurals)); |
792 |
$this->assertTrue(in_array('22 everything else (from core translated)', $corePlurals)); |
793 |
$this->assertTrue(in_array('23 everything else (from core translated)', $corePlurals)); |
794 |
$this->assertTrue(in_array('24 everything else (from core translated)', $corePlurals)); |
795 |
$this->assertTrue(in_array('25 everything else (from core translated)', $corePlurals)); |
796 |
} |
797 |
|
798 |
/**
|
799 |
* testPoRulesSeven method
|
800 |
*
|
801 |
* @return void
|
802 |
*/
|
803 |
public function testPoRulesSeven() { |
804 |
Configure::write('Config.language', 'rule_7_po'); |
805 |
$this->assertRulesSeven();
|
806 |
} |
807 |
|
808 |
/**
|
809 |
* testMoRulesSeven method
|
810 |
*
|
811 |
* @return void
|
812 |
*/
|
813 |
public function testMoRulesSeven() { |
814 |
Configure::write('Config.language', 'rule_7_mo'); |
815 |
$this->assertRulesSeven();
|
816 |
} |
817 |
|
818 |
/**
|
819 |
* Run assertions for seventh plural rules
|
820 |
*
|
821 |
* @return void
|
822 |
*/
|
823 |
public function assertRulesSeven() { |
824 |
$singular = $this->_singular(); |
825 |
$this->assertEquals('Plural Rule 7 (translated)', $singular); |
826 |
|
827 |
$plurals = $this->_plural(); |
828 |
$this->assertTrue(in_array('0 everything else (translated)', $plurals)); |
829 |
$this->assertTrue(in_array('1 ends in 1, not 11 (translated)', $plurals)); |
830 |
$this->assertTrue(in_array('2 ends in 2-4, not 12-14 (translated)', $plurals)); |
831 |
$this->assertTrue(in_array('3 ends in 2-4, not 12-14 (translated)', $plurals)); |
832 |
$this->assertTrue(in_array('4 ends in 2-4, not 12-14 (translated)', $plurals)); |
833 |
$this->assertTrue(in_array('5 everything else (translated)', $plurals)); |
834 |
$this->assertTrue(in_array('6 everything else (translated)', $plurals)); |
835 |
$this->assertTrue(in_array('7 everything else (translated)', $plurals)); |
836 |
$this->assertTrue(in_array('8 everything else (translated)', $plurals)); |
837 |
$this->assertTrue(in_array('9 everything else (translated)', $plurals)); |
838 |
$this->assertTrue(in_array('10 everything else (translated)', $plurals)); |
839 |
$this->assertTrue(in_array('11 everything else (translated)', $plurals)); |
840 |
$this->assertTrue(in_array('12 everything else (translated)', $plurals)); |
841 |
$this->assertTrue(in_array('13 everything else (translated)', $plurals)); |
842 |
$this->assertTrue(in_array('14 everything else (translated)', $plurals)); |
843 |
$this->assertTrue(in_array('15 everything else (translated)', $plurals)); |
844 |
$this->assertTrue(in_array('16 everything else (translated)', $plurals)); |
845 |
$this->assertTrue(in_array('17 everything else (translated)', $plurals)); |
846 |
$this->assertTrue(in_array('18 everything else (translated)', $plurals)); |
847 |
$this->assertTrue(in_array('19 everything else (translated)', $plurals)); |
848 |
$this->assertTrue(in_array('20 everything else (translated)', $plurals)); |
849 |
$this->assertTrue(in_array('21 ends in 1, not 11 (translated)', $plurals)); |
850 |
$this->assertTrue(in_array('22 ends in 2-4, not 12-14 (translated)', $plurals)); |
851 |
$this->assertTrue(in_array('23 ends in 2-4, not 12-14 (translated)', $plurals)); |
852 |
$this->assertTrue(in_array('24 ends in 2-4, not 12-14 (translated)', $plurals)); |
853 |
$this->assertTrue(in_array('25 everything else (translated)', $plurals)); |
854 |
|
855 |
$coreSingular = $this->_singularFromCore(); |
856 |
$this->assertEquals('Plural Rule 7 (from core translated)', $coreSingular); |
857 |
|
858 |
$corePlurals = $this->_pluralFromCore(); |
859 |
$this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals)); |
860 |
$this->assertTrue(in_array('1 ends in 1, not 11 (from core translated)', $corePlurals)); |
861 |
$this->assertTrue(in_array('2 ends in 2-4, not 12-14 (from core translated)', $corePlurals)); |
862 |
$this->assertTrue(in_array('3 ends in 2-4, not 12-14 (from core translated)', $corePlurals)); |
863 |
$this->assertTrue(in_array('4 ends in 2-4, not 12-14 (from core translated)', $corePlurals)); |
864 |
$this->assertTrue(in_array('5 everything else (from core translated)', $corePlurals)); |
865 |
$this->assertTrue(in_array('6 everything else (from core translated)', $corePlurals)); |
866 |
$this->assertTrue(in_array('7 everything else (from core translated)', $corePlurals)); |
867 |
$this->assertTrue(in_array('8 everything else (from core translated)', $corePlurals)); |
868 |
$this->assertTrue(in_array('9 everything else (from core translated)', $corePlurals)); |
869 |
$this->assertTrue(in_array('10 everything else (from core translated)', $corePlurals)); |
870 |
$this->assertTrue(in_array('11 everything else (from core translated)', $corePlurals)); |
871 |
$this->assertTrue(in_array('12 everything else (from core translated)', $corePlurals)); |
872 |
$this->assertTrue(in_array('13 everything else (from core translated)', $corePlurals)); |
873 |
$this->assertTrue(in_array('14 everything else (from core translated)', $corePlurals)); |
874 |
$this->assertTrue(in_array('15 everything else (from core translated)', $corePlurals)); |
875 |
$this->assertTrue(in_array('16 everything else (from core translated)', $corePlurals)); |
876 |
$this->assertTrue(in_array('17 everything else (from core translated)', $corePlurals)); |
877 |
$this->assertTrue(in_array('18 everything else (from core translated)', $corePlurals)); |
878 |
$this->assertTrue(in_array('19 everything else (from core translated)', $corePlurals)); |
879 |
$this->assertTrue(in_array('20 everything else (from core translated)', $corePlurals)); |
880 |
$this->assertTrue(in_array('21 ends in 1, not 11 (from core translated)', $corePlurals)); |
881 |
$this->assertTrue(in_array('22 ends in 2-4, not 12-14 (from core translated)', $corePlurals)); |
882 |
$this->assertTrue(in_array('23 ends in 2-4, not 12-14 (from core translated)', $corePlurals)); |
883 |
$this->assertTrue(in_array('24 ends in 2-4, not 12-14 (from core translated)', $corePlurals)); |
884 |
$this->assertTrue(in_array('25 everything else (from core translated)', $corePlurals)); |
885 |
} |
886 |
|
887 |
/**
|
888 |
* testPoRulesEight method
|
889 |
*
|
890 |
* @return void
|
891 |
*/
|
892 |
public function testPoRulesEight() { |
893 |
Configure::write('Config.language', 'rule_8_po'); |
894 |
$this->assertRulesEight();
|
895 |
} |
896 |
|
897 |
/**
|
898 |
* testMoRulesEight method
|
899 |
*
|
900 |
* @return void
|
901 |
*/
|
902 |
public function testMoRulesEight() { |
903 |
Configure::write('Config.language', 'rule_8_mo'); |
904 |
$this->assertRulesEight();
|
905 |
} |
906 |
|
907 |
/**
|
908 |
* Run assertions for the eighth plural rule.
|
909 |
*
|
910 |
* @return void
|
911 |
*/
|
912 |
public function assertRulesEight() { |
913 |
$singular = $this->_singular(); |
914 |
$this->assertEquals('Plural Rule 8 (translated)', $singular); |
915 |
|
916 |
$plurals = $this->_plural(); |
917 |
$this->assertTrue(in_array('0 everything else (translated)', $plurals)); |
918 |
$this->assertTrue(in_array('1 is 1 (translated)', $plurals)); |
919 |
$this->assertTrue(in_array('2 is 2-4 (translated)', $plurals)); |
920 |
$this->assertTrue(in_array('3 is 2-4 (translated)', $plurals)); |
921 |
$this->assertTrue(in_array('4 is 2-4 (translated)', $plurals)); |
922 |
$this->assertTrue(in_array('5 everything else (translated)', $plurals)); |
923 |
$this->assertTrue(in_array('6 everything else (translated)', $plurals)); |
924 |
$this->assertTrue(in_array('7 everything else (translated)', $plurals)); |
925 |
$this->assertTrue(in_array('8 everything else (translated)', $plurals)); |
926 |
$this->assertTrue(in_array('9 everything else (translated)', $plurals)); |
927 |
$this->assertTrue(in_array('10 everything else (translated)', $plurals)); |
928 |
$this->assertTrue(in_array('11 everything else (translated)', $plurals)); |
929 |
$this->assertTrue(in_array('12 everything else (translated)', $plurals)); |
930 |
$this->assertTrue(in_array('13 everything else (translated)', $plurals)); |
931 |
$this->assertTrue(in_array('14 everything else (translated)', $plurals)); |
932 |
$this->assertTrue(in_array('15 everything else (translated)', $plurals)); |
933 |
$this->assertTrue(in_array('16 everything else (translated)', $plurals)); |
934 |
$this->assertTrue(in_array('17 everything else (translated)', $plurals)); |
935 |
$this->assertTrue(in_array('18 everything else (translated)', $plurals)); |
936 |
$this->assertTrue(in_array('19 everything else (translated)', $plurals)); |
937 |
$this->assertTrue(in_array('20 everything else (translated)', $plurals)); |
938 |
$this->assertTrue(in_array('21 everything else (translated)', $plurals)); |
939 |
$this->assertTrue(in_array('22 everything else (translated)', $plurals)); |
940 |
$this->assertTrue(in_array('23 everything else (translated)', $plurals)); |
941 |
$this->assertTrue(in_array('24 everything else (translated)', $plurals)); |
942 |
$this->assertTrue(in_array('25 everything else (translated)', $plurals)); |
943 |
|
944 |
$coreSingular = $this->_singularFromCore(); |
945 |
$this->assertEquals('Plural Rule 8 (from core translated)', $coreSingular); |
946 |
|
947 |
$corePlurals = $this->_pluralFromCore(); |
948 |
$this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals)); |
949 |
$this->assertTrue(in_array('1 is 1 (from core translated)', $corePlurals)); |
950 |
$this->assertTrue(in_array('2 is 2-4 (from core translated)', $corePlurals)); |
951 |
$this->assertTrue(in_array('3 is 2-4 (from core translated)', $corePlurals)); |
952 |
$this->assertTrue(in_array('4 is 2-4 (from core translated)', $corePlurals)); |
953 |
$this->assertTrue(in_array('5 everything else (from core translated)', $corePlurals)); |
954 |
$this->assertTrue(in_array('6 everything else (from core translated)', $corePlurals)); |
955 |
$this->assertTrue(in_array('7 everything else (from core translated)', $corePlurals)); |
956 |
$this->assertTrue(in_array('8 everything else (from core translated)', $corePlurals)); |
957 |
$this->assertTrue(in_array('9 everything else (from core translated)', $corePlurals)); |
958 |
$this->assertTrue(in_array('10 everything else (from core translated)', $corePlurals)); |
959 |
$this->assertTrue(in_array('11 everything else (from core translated)', $corePlurals)); |
960 |
$this->assertTrue(in_array('12 everything else (from core translated)', $corePlurals)); |
961 |
$this->assertTrue(in_array('13 everything else (from core translated)', $corePlurals)); |
962 |
$this->assertTrue(in_array('14 everything else (from core translated)', $corePlurals)); |
963 |
$this->assertTrue(in_array('15 everything else (from core translated)', $corePlurals)); |
964 |
$this->assertTrue(in_array('16 everything else (from core translated)', $corePlurals)); |
965 |
$this->assertTrue(in_array('17 everything else (from core translated)', $corePlurals)); |
966 |
$this->assertTrue(in_array('18 everything else (from core translated)', $corePlurals)); |
967 |
$this->assertTrue(in_array('19 everything else (from core translated)', $corePlurals)); |
968 |
$this->assertTrue(in_array('20 everything else (from core translated)', $corePlurals)); |
969 |
$this->assertTrue(in_array('21 everything else (from core translated)', $corePlurals)); |
970 |
$this->assertTrue(in_array('22 everything else (from core translated)', $corePlurals)); |
971 |
$this->assertTrue(in_array('23 everything else (from core translated)', $corePlurals)); |
972 |
$this->assertTrue(in_array('24 everything else (from core translated)', $corePlurals)); |
973 |
$this->assertTrue(in_array('25 everything else (from core translated)', $corePlurals)); |
974 |
} |
975 |
|
976 |
/**
|
977 |
* testPoRulesNine method
|
978 |
*
|
979 |
* @return void
|
980 |
*/
|
981 |
public function testPoRulesNine() { |
982 |
Configure::write('Config.language', 'rule_9_po'); |
983 |
$this->assertRulesNine();
|
984 |
} |
985 |
|
986 |
/**
|
987 |
* testMoRulesNine method
|
988 |
*
|
989 |
* @return void
|
990 |
*/
|
991 |
public function testMoRulesNine() { |
992 |
Configure::write('Config.language', 'rule_9_mo'); |
993 |
$this->assertRulesNine();
|
994 |
} |
995 |
|
996 |
/**
|
997 |
* Assert plural rules nine
|
998 |
*
|
999 |
* @return void
|
1000 |
*/
|
1001 |
public function assertRulesNine() { |
1002 |
$singular = $this->_singular(); |
1003 |
$this->assertEquals('Plural Rule 9 (translated)', $singular); |
1004 |
|
1005 |
$plurals = $this->_plural(); |
1006 |
$this->assertTrue(in_array('0 everything else (translated)', $plurals)); |
1007 |
$this->assertTrue(in_array('0 everything else (translated)', $plurals)); |
1008 |
$this->assertTrue(in_array('1 is 1 (translated)', $plurals)); |
1009 |
$this->assertTrue(in_array('2 ends in 2-4, not 12-14 (translated)', $plurals)); |
1010 |
$this->assertTrue(in_array('3 ends in 2-4, not 12-14 (translated)', $plurals)); |
1011 |
$this->assertTrue(in_array('4 ends in 2-4, not 12-14 (translated)', $plurals)); |
1012 |
$this->assertTrue(in_array('5 everything else (translated)', $plurals)); |
1013 |
$this->assertTrue(in_array('6 everything else (translated)', $plurals)); |
1014 |
$this->assertTrue(in_array('7 everything else (translated)', $plurals)); |
1015 |
$this->assertTrue(in_array('8 everything else (translated)', $plurals)); |
1016 |
$this->assertTrue(in_array('9 everything else (translated)', $plurals)); |
1017 |
$this->assertTrue(in_array('10 everything else (translated)', $plurals)); |
1018 |
$this->assertTrue(in_array('11 everything else (translated)', $plurals)); |
1019 |
$this->assertTrue(in_array('12 everything else (translated)', $plurals)); |
1020 |
$this->assertTrue(in_array('13 everything else (translated)', $plurals)); |
1021 |
$this->assertTrue(in_array('14 everything else (translated)', $plurals)); |
1022 |
$this->assertTrue(in_array('15 everything else (translated)', $plurals)); |
1023 |
$this->assertTrue(in_array('16 everything else (translated)', $plurals)); |
1024 |
$this->assertTrue(in_array('17 everything else (translated)', $plurals)); |
1025 |
$this->assertTrue(in_array('18 everything else (translated)', $plurals)); |
1026 |
$this->assertTrue(in_array('19 everything else (translated)', $plurals)); |
1027 |
$this->assertTrue(in_array('20 everything else (translated)', $plurals)); |
1028 |
$this->assertTrue(in_array('21 everything else (translated)', $plurals)); |
1029 |
$this->assertTrue(in_array('22 ends in 2-4, not 12-14 (translated)', $plurals)); |
1030 |
$this->assertTrue(in_array('23 ends in 2-4, not 12-14 (translated)', $plurals)); |
1031 |
$this->assertTrue(in_array('24 ends in 2-4, not 12-14 (translated)', $plurals)); |
1032 |
$this->assertTrue(in_array('25 everything else (translated)', $plurals)); |
1033 |
|
1034 |
$coreSingular = $this->_singularFromCore(); |
1035 |
$this->assertEquals('Plural Rule 9 (from core translated)', $coreSingular); |
1036 |
|
1037 |
$corePlurals = $this->_pluralFromCore(); |
1038 |
$this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals)); |
1039 |
$this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals)); |
1040 |
$this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals)); |
1041 |
$this->assertTrue(in_array('1 is 1 (from core translated)', $corePlurals)); |
1042 |
$this->assertTrue(in_array('2 ends in 2-4, not 12-14 (from core translated)', $corePlurals)); |
1043 |
$this->assertTrue(in_array('3 ends in 2-4, not 12-14 (from core translated)', $corePlurals)); |
1044 |
$this->assertTrue(in_array('4 ends in 2-4, not 12-14 (from core translated)', $corePlurals)); |
1045 |
$this->assertTrue(in_array('5 everything else (from core translated)', $corePlurals)); |
1046 |
$this->assertTrue(in_array('6 everything else (from core translated)', $corePlurals)); |
1047 |
$this->assertTrue(in_array('7 everything else (from core translated)', $corePlurals)); |
1048 |
$this->assertTrue(in_array('8 everything else (from core translated)', $corePlurals)); |
1049 |
$this->assertTrue(in_array('9 everything else (from core translated)', $corePlurals)); |
1050 |
$this->assertTrue(in_array('10 everything else (from core translated)', $corePlurals)); |
1051 |
$this->assertTrue(in_array('11 everything else (from core translated)', $corePlurals)); |
1052 |
$this->assertTrue(in_array('12 everything else (from core translated)', $corePlurals)); |
1053 |
$this->assertTrue(in_array('13 everything else (from core translated)', $corePlurals)); |
1054 |
$this->assertTrue(in_array('14 everything else (from core translated)', $corePlurals)); |
1055 |
$this->assertTrue(in_array('15 everything else (from core translated)', $corePlurals)); |
1056 |
$this->assertTrue(in_array('16 everything else (from core translated)', $corePlurals)); |
1057 |
$this->assertTrue(in_array('17 everything else (from core translated)', $corePlurals)); |
1058 |
$this->assertTrue(in_array('18 everything else (from core translated)', $corePlurals)); |
1059 |
$this->assertTrue(in_array('19 everything else (from core translated)', $corePlurals)); |
1060 |
$this->assertTrue(in_array('20 everything else (from core translated)', $corePlurals)); |
1061 |
$this->assertTrue(in_array('21 everything else (from core translated)', $corePlurals)); |
1062 |
$this->assertTrue(in_array('22 ends in 2-4, not 12-14 (from core translated)', $corePlurals)); |
1063 |
$this->assertTrue(in_array('23 ends in 2-4, not 12-14 (from core translated)', $corePlurals)); |
1064 |
$this->assertTrue(in_array('24 ends in 2-4, not 12-14 (from core translated)', $corePlurals)); |
1065 |
$this->assertTrue(in_array('25 everything else (from core translated)', $corePlurals)); |
1066 |
} |
1067 |
|
1068 |
/**
|
1069 |
* testPoRulesTen method
|
1070 |
*
|
1071 |
* @return void
|
1072 |
*/
|
1073 |
public function testPoRulesTen() { |
1074 |
Configure::write('Config.language', 'rule_10_po'); |
1075 |
$this->assertRulesTen();
|
1076 |
} |
1077 |
|
1078 |
/**
|
1079 |
* testMoRulesTen method
|
1080 |
*
|
1081 |
* @return void
|
1082 |
*/
|
1083 |
public function testMoRulesTen() { |
1084 |
Configure::write('Config.language', 'rule_10_mo'); |
1085 |
$this->assertRulesTen();
|
1086 |
} |
1087 |
|
1088 |
/**
|
1089 |
* Assertions for plural rules 10
|
1090 |
*
|
1091 |
* @return void
|
1092 |
*/
|
1093 |
public function assertRulesTen() { |
1094 |
$singular = $this->_singular(); |
1095 |
$this->assertEquals('Plural Rule 10 (translated)', $singular); |
1096 |
|
1097 |
$plurals = $this->_plural(); |
1098 |
$this->assertTrue(in_array('0 everything else (translated)', $plurals)); |
1099 |
$this->assertTrue(in_array('0 everything else (translated)', $plurals)); |
1100 |
$this->assertTrue(in_array('1 ends in 1 (translated)', $plurals)); |
1101 |
$this->assertTrue(in_array('2 ends in 2 (translated)', $plurals)); |
1102 |
$this->assertTrue(in_array('3 ends in 03-04 (translated)', $plurals)); |
1103 |
$this->assertTrue(in_array('4 ends in 03-04 (translated)', $plurals)); |
1104 |
$this->assertTrue(in_array('5 everything else (translated)', $plurals)); |
1105 |
$this->assertTrue(in_array('6 everything else (translated)', $plurals)); |
1106 |
$this->assertTrue(in_array('7 everything else (translated)', $plurals)); |
1107 |
$this->assertTrue(in_array('8 everything else (translated)', $plurals)); |
1108 |
$this->assertTrue(in_array('9 everything else (translated)', $plurals)); |
1109 |
$this->assertTrue(in_array('10 everything else (translated)', $plurals)); |
1110 |
$this->assertTrue(in_array('11 everything else (translated)', $plurals)); |
1111 |
$this->assertTrue(in_array('12 everything else (translated)', $plurals)); |
1112 |
$this->assertTrue(in_array('13 everything else (translated)', $plurals)); |
1113 |
$this->assertTrue(in_array('14 everything else (translated)', $plurals)); |
1114 |
$this->assertTrue(in_array('15 everything else (translated)', $plurals)); |
1115 |
$this->assertTrue(in_array('16 everything else (translated)', $plurals)); |
1116 |
$this->assertTrue(in_array('17 everything else (translated)', $plurals)); |
1117 |
$this->assertTrue(in_array('18 everything else (translated)', $plurals)); |
1118 |
$this->assertTrue(in_array('19 everything else (translated)', $plurals)); |
1119 |
$this->assertTrue(in_array('20 everything else (translated)', $plurals)); |
1120 |
$this->assertTrue(in_array('21 everything else (translated)', $plurals)); |
1121 |
$this->assertTrue(in_array('22 everything else (translated)', $plurals)); |
1122 |
$this->assertTrue(in_array('23 everything else (translated)', $plurals)); |
1123 |
$this->assertTrue(in_array('24 everything else (translated)', $plurals)); |
1124 |
$this->assertTrue(in_array('25 everything else (translated)', $plurals)); |
1125 |
|
1126 |
$coreSingular = $this->_singularFromCore(); |
1127 |
$this->assertEquals('Plural Rule 10 (from core translated)', $coreSingular); |
1128 |
|
1129 |
$corePlurals = $this->_pluralFromCore(); |
1130 |
$this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals)); |
1131 |
$this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals)); |
1132 |
$this->assertTrue(in_array('1 ends in 1 (from core translated)', $corePlurals)); |
1133 |
$this->assertTrue(in_array('2 ends in 2 (from core translated)', $corePlurals)); |
1134 |
$this->assertTrue(in_array('3 ends in 03-04 (from core translated)', $corePlurals)); |
1135 |
$this->assertTrue(in_array('4 ends in 03-04 (from core translated)', $corePlurals)); |
1136 |
$this->assertTrue(in_array('5 everything else (from core translated)', $corePlurals)); |
1137 |
$this->assertTrue(in_array('6 everything else (from core translated)', $corePlurals)); |
1138 |
$this->assertTrue(in_array('7 everything else (from core translated)', $corePlurals)); |
1139 |
$this->assertTrue(in_array('8 everything else (from core translated)', $corePlurals)); |
1140 |
$this->assertTrue(in_array('9 everything else (from core translated)', $corePlurals)); |
1141 |
$this->assertTrue(in_array('10 everything else (from core translated)', $corePlurals)); |
1142 |
$this->assertTrue(in_array('11 everything else (from core translated)', $corePlurals)); |
1143 |
$this->assertTrue(in_array('12 everything else (from core translated)', $corePlurals)); |
1144 |
$this->assertTrue(in_array('13 everything else (from core translated)', $corePlurals)); |
1145 |
$this->assertTrue(in_array('14 everything else (from core translated)', $corePlurals)); |
1146 |
$this->assertTrue(in_array('15 everything else (from core translated)', $corePlurals)); |
1147 |
$this->assertTrue(in_array('16 everything else (from core translated)', $corePlurals)); |
1148 |
$this->assertTrue(in_array('17 everything else (from core translated)', $corePlurals)); |
1149 |
$this->assertTrue(in_array('18 everything else (from core translated)', $corePlurals)); |
1150 |
$this->assertTrue(in_array('19 everything else (from core translated)', $corePlurals)); |
1151 |
$this->assertTrue(in_array('20 everything else (from core translated)', $corePlurals)); |
1152 |
$this->assertTrue(in_array('21 everything else (from core translated)', $corePlurals)); |
1153 |
$this->assertTrue(in_array('22 everything else (from core translated)', $corePlurals)); |
1154 |
$this->assertTrue(in_array('23 everything else (from core translated)', $corePlurals)); |
1155 |
$this->assertTrue(in_array('24 everything else (from core translated)', $corePlurals)); |
1156 |
$this->assertTrue(in_array('25 everything else (from core translated)', $corePlurals)); |
1157 |
} |
1158 |
|
1159 |
/**
|
1160 |
* testPoRulesEleven method
|
1161 |
*
|
1162 |
* @return void
|
1163 |
*/
|
1164 |
public function testPoRulesEleven() { |
1165 |
Configure::write('Config.language', 'rule_11_po'); |
1166 |
$this->assertRulesEleven();
|
1167 |
} |
1168 |
|
1169 |
/**
|
1170 |
* testMoRulesEleven method
|
1171 |
*
|
1172 |
* @return void
|
1173 |
*/
|
1174 |
public function testMoRulesEleven() { |
1175 |
Configure::write('Config.language', 'rule_11_mo'); |
1176 |
$this->assertRulesEleven();
|
1177 |
} |
1178 |
|
1179 |
/**
|
1180 |
* Assertions for plural rules eleven
|
1181 |
*
|
1182 |
* @return void
|
1183 |
*/
|
1184 |
public function assertRulesEleven() { |
1185 |
$singular = $this->_singular(); |
1186 |
$this->assertEquals('Plural Rule 11 (translated)', $singular); |
1187 |
|
1188 |
$plurals = $this->_plural(); |
1189 |
$this->assertTrue(in_array('0 everything else (translated)', $plurals)); |
1190 |
$this->assertTrue(in_array('1 is 1 (translated)', $plurals)); |
1191 |
$this->assertTrue(in_array('2 is 2 (translated)', $plurals)); |
1192 |
$this->assertTrue(in_array('3 is 3-6 (translated)', $plurals)); |
1193 |
$this->assertTrue(in_array('4 is 3-6 (translated)', $plurals)); |
1194 |
$this->assertTrue(in_array('5 is 3-6 (translated)', $plurals)); |
1195 |
$this->assertTrue(in_array('6 is 3-6 (translated)', $plurals)); |
1196 |
$this->assertTrue(in_array('7 is 7-10 (translated)', $plurals)); |
1197 |
$this->assertTrue(in_array('8 is 7-10 (translated)', $plurals)); |
1198 |
$this->assertTrue(in_array('9 is 7-10 (translated)', $plurals)); |
1199 |
$this->assertTrue(in_array('10 is 7-10 (translated)', $plurals)); |
1200 |
$this->assertTrue(in_array('11 everything else (translated)', $plurals)); |
1201 |
$this->assertTrue(in_array('12 everything else (translated)', $plurals)); |
1202 |
$this->assertTrue(in_array('13 everything else (translated)', $plurals)); |
1203 |
$this->assertTrue(in_array('14 everything else (translated)', $plurals)); |
1204 |
$this->assertTrue(in_array('15 everything else (translated)', $plurals)); |
1205 |
$this->assertTrue(in_array('16 everything else (translated)', $plurals)); |
1206 |
$this->assertTrue(in_array('17 everything else (translated)', $plurals)); |
1207 |
$this->assertTrue(in_array('18 everything else (translated)', $plurals)); |
1208 |
$this->assertTrue(in_array('19 everything else (translated)', $plurals)); |
1209 |
$this->assertTrue(in_array('20 everything else (translated)', $plurals)); |
1210 |
$this->assertTrue(in_array('21 everything else (translated)', $plurals)); |
1211 |
$this->assertTrue(in_array('22 everything else (translated)', $plurals)); |
1212 |
$this->assertTrue(in_array('23 everything else (translated)', $plurals)); |
1213 |
$this->assertTrue(in_array('24 everything else (translated)', $plurals)); |
1214 |
$this->assertTrue(in_array('25 everything else (translated)', $plurals)); |
1215 |
|
1216 |
$coreSingular = $this->_singularFromCore(); |
1217 |
$this->assertEquals('Plural Rule 11 (from core translated)', $coreSingular); |
1218 |
|
1219 |
$corePlurals = $this->_pluralFromCore(); |
1220 |
$this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals)); |
1221 |
$this->assertTrue(in_array('1 is 1 (from core translated)', $corePlurals)); |
1222 |
$this->assertTrue(in_array('2 is 2 (from core translated)', $corePlurals)); |
1223 |
$this->assertTrue(in_array('3 is 3-6 (from core translated)', $corePlurals)); |
1224 |
$this->assertTrue(in_array('4 is 3-6 (from core translated)', $corePlurals)); |
1225 |
$this->assertTrue(in_array('5 is 3-6 (from core translated)', $corePlurals)); |
1226 |
$this->assertTrue(in_array('6 is 3-6 (from core translated)', $corePlurals)); |
1227 |
$this->assertTrue(in_array('7 is 7-10 (from core translated)', $corePlurals)); |
1228 |
$this->assertTrue(in_array('8 is 7-10 (from core translated)', $corePlurals)); |
1229 |
$this->assertTrue(in_array('9 is 7-10 (from core translated)', $corePlurals)); |
1230 |
$this->assertTrue(in_array('10 is 7-10 (from core translated)', $corePlurals)); |
1231 |
$this->assertTrue(in_array('11 everything else (from core translated)', $corePlurals)); |
1232 |
$this->assertTrue(in_array('12 everything else (from core translated)', $corePlurals)); |
1233 |
$this->assertTrue(in_array('13 everything else (from core translated)', $corePlurals)); |
1234 |
$this->assertTrue(in_array('14 everything else (from core translated)', $corePlurals)); |
1235 |
$this->assertTrue(in_array('15 everything else (from core translated)', $corePlurals)); |
1236 |
$this->assertTrue(in_array('16 everything else (from core translated)', $corePlurals)); |
1237 |
$this->assertTrue(in_array('17 everything else (from core translated)', $corePlurals)); |
1238 |
$this->assertTrue(in_array('18 everything else (from core translated)', $corePlurals)); |
1239 |
$this->assertTrue(in_array('19 everything else (from core translated)', $corePlurals)); |
1240 |
$this->assertTrue(in_array('20 everything else (from core translated)', $corePlurals)); |
1241 |
$this->assertTrue(in_array('21 everything else (from core translated)', $corePlurals)); |
1242 |
$this->assertTrue(in_array('22 everything else (from core translated)', $corePlurals)); |
1243 |
$this->assertTrue(in_array('23 everything else (from core translated)', $corePlurals)); |
1244 |
$this->assertTrue(in_array('24 everything else (from core translated)', $corePlurals)); |
1245 |
$this->assertTrue(in_array('25 everything else (from core translated)', $corePlurals)); |
1246 |
} |
1247 |
|
1248 |
/**
|
1249 |
* testPoRulesTwelve method
|
1250 |
*
|
1251 |
* @return void
|
1252 |
*/
|
1253 |
public function testPoRulesTwelve() { |
1254 |
Configure::write('Config.language', 'rule_12_po'); |
1255 |
$this->assertRulesTwelve();
|
1256 |
} |
1257 |
|
1258 |
/**
|
1259 |
* testMoRulesTwelve method
|
1260 |
*
|
1261 |
* @return void
|
1262 |
*/
|
1263 |
public function testMoRulesTwelve() { |
1264 |
Configure::write('Config.language', 'rule_12_mo'); |
1265 |
$this->assertRulesTwelve();
|
1266 |
} |
1267 |
|
1268 |
/**
|
1269 |
* Assertions for plural rules twelve
|
1270 |
*
|
1271 |
* @return void
|
1272 |
*/
|
1273 |
public function assertRulesTwelve() { |
1274 |
$singular = $this->_singular(); |
1275 |
$this->assertEquals('Plural Rule 12 (translated)', $singular); |
1276 |
|
1277 |
$plurals = $this->_plural(); |
1278 |
$this->assertTrue(in_array('0 is 0 or 3-10 (translated)', $plurals)); |
1279 |
$this->assertTrue(in_array('1 is 1 (translated)', $plurals)); |
1280 |
$this->assertTrue(in_array('2 is 2 (translated)', $plurals)); |
1281 |
$this->assertTrue(in_array('3 is 0 or 3-10 (translated)', $plurals)); |
1282 |
$this->assertTrue(in_array('4 is 0 or 3-10 (translated)', $plurals)); |
1283 |
$this->assertTrue(in_array('5 is 0 or 3-10 (translated)', $plurals)); |
1284 |
$this->assertTrue(in_array('6 is 0 or 3-10 (translated)', $plurals)); |
1285 |
$this->assertTrue(in_array('7 is 0 or 3-10 (translated)', $plurals)); |
1286 |
$this->assertTrue(in_array('8 is 0 or 3-10 (translated)', $plurals)); |
1287 |
$this->assertTrue(in_array('9 is 0 or 3-10 (translated)', $plurals)); |
1288 |
$this->assertTrue(in_array('10 is 0 or 3-10 (translated)', $plurals)); |
1289 |
$this->assertTrue(in_array('11 everything else (translated)', $plurals)); |
1290 |
$this->assertTrue(in_array('12 everything else (translated)', $plurals)); |
1291 |
$this->assertTrue(in_array('13 everything else (translated)', $plurals)); |
1292 |
$this->assertTrue(in_array('14 everything else (translated)', $plurals)); |
1293 |
$this->assertTrue(in_array('15 everything else (translated)', $plurals)); |
1294 |
$this->assertTrue(in_array('16 everything else (translated)', $plurals)); |
1295 |
$this->assertTrue(in_array('17 everything else (translated)', $plurals)); |
1296 |
$this->assertTrue(in_array('18 everything else (translated)', $plurals)); |
1297 |
$this->assertTrue(in_array('19 everything else (translated)', $plurals)); |
1298 |
$this->assertTrue(in_array('20 everything else (translated)', $plurals)); |
1299 |
$this->assertTrue(in_array('21 everything else (translated)', $plurals)); |
1300 |
$this->assertTrue(in_array('22 everything else (translated)', $plurals)); |
1301 |
$this->assertTrue(in_array('23 everything else (translated)', $plurals)); |
1302 |
$this->assertTrue(in_array('24 everything else (translated)', $plurals)); |
1303 |
$this->assertTrue(in_array('25 everything else (translated)', $plurals)); |
1304 |
|
1305 |
$coreSingular = $this->_singularFromCore(); |
1306 |
$this->assertEquals('Plural Rule 12 (from core translated)', $coreSingular); |
1307 |
|
1308 |
$corePlurals = $this->_pluralFromCore(); |
1309 |
$this->assertTrue(in_array('0 is 0 or 3-10 (from core translated)', $corePlurals)); |
1310 |
$this->assertTrue(in_array('1 is 1 (from core translated)', $corePlurals)); |
1311 |
$this->assertTrue(in_array('2 is 2 (from core translated)', $corePlurals)); |
1312 |
$this->assertTrue(in_array('3 is 0 or 3-10 (from core translated)', $corePlurals)); |
1313 |
$this->assertTrue(in_array('4 is 0 or 3-10 (from core translated)', $corePlurals)); |
1314 |
$this->assertTrue(in_array('5 is 0 or 3-10 (from core translated)', $corePlurals)); |
1315 |
$this->assertTrue(in_array('6 is 0 or 3-10 (from core translated)', $corePlurals)); |
1316 |
$this->assertTrue(in_array('7 is 0 or 3-10 (from core translated)', $corePlurals)); |
1317 |
$this->assertTrue(in_array('8 is 0 or 3-10 (from core translated)', $corePlurals)); |
1318 |
$this->assertTrue(in_array('9 is 0 or 3-10 (from core translated)', $corePlurals)); |
1319 |
$this->assertTrue(in_array('10 is 0 or 3-10 (from core translated)', $corePlurals)); |
1320 |
$this->assertTrue(in_array('11 everything else (from core translated)', $corePlurals)); |
1321 |
$this->assertTrue(in_array('12 everything else (from core translated)', $corePlurals)); |
1322 |
$this->assertTrue(in_array('13 everything else (from core translated)', $corePlurals)); |
1323 |
$this->assertTrue(in_array('14 everything else (from core translated)', $corePlurals)); |
1324 |
$this->assertTrue(in_array('15 everything else (from core translated)', $corePlurals)); |
1325 |
$this->assertTrue(in_array('16 everything else (from core translated)', $corePlurals)); |
1326 |
$this->assertTrue(in_array('17 everything else (from core translated)', $corePlurals)); |
1327 |
$this->assertTrue(in_array('18 everything else (from core translated)', $corePlurals)); |
1328 |
$this->assertTrue(in_array('19 everything else (from core translated)', $corePlurals)); |
1329 |
$this->assertTrue(in_array('20 everything else (from core translated)', $corePlurals)); |
1330 |
$this->assertTrue(in_array('21 everything else (from core translated)', $corePlurals)); |
1331 |
$this->assertTrue(in_array('22 everything else (from core translated)', $corePlurals)); |
1332 |
$this->assertTrue(in_array('23 everything else (from core translated)', $corePlurals)); |
1333 |
$this->assertTrue(in_array('24 everything else (from core translated)', $corePlurals)); |
1334 |
$this->assertTrue(in_array('25 everything else (from core translated)', $corePlurals)); |
1335 |
} |
1336 |
|
1337 |
/**
|
1338 |
* testMoRulesThirteen method
|
1339 |
*
|
1340 |
* @return void
|
1341 |
*/
|
1342 |
public function testmoRulesThirteen() { |
1343 |
Configure::write('Config.language', 'rule_13_mo'); |
1344 |
$this->assertRulesThirteen();
|
1345 |
} |
1346 |
|
1347 |
/**
|
1348 |
* testPoRulesThirteen method
|
1349 |
*
|
1350 |
* @return void
|
1351 |
*/
|
1352 |
public function testPoRulesThirteen() { |
1353 |
Configure::write('Config.language', 'rule_13_po'); |
1354 |
$this->assertRulesThirteen();
|
1355 |
} |
1356 |
|
1357 |
/**
|
1358 |
* Assertions for plural rules thirteen
|
1359 |
*
|
1360 |
* @return void
|
1361 |
*/
|
1362 |
public function assertRulesThirteen() { |
1363 |
$singular = $this->_singular(); |
1364 |
$this->assertEquals('Plural Rule 13 (translated)', $singular); |
1365 |
|
1366 |
$plurals = $this->_plural(); |
1367 |
$this->assertTrue(in_array('0 is 0 or ends in 01-10 (translated)', $plurals)); |
1368 |
$this->assertTrue(in_array('1 is 1 (translated)', $plurals)); |
1369 |
$this->assertTrue(in_array('2 is 0 or ends in 01-10 (translated)', $plurals)); |
1370 |
$this->assertTrue(in_array('3 is 0 or ends in 01-10 (translated)', $plurals)); |
1371 |
$this->assertTrue(in_array('4 is 0 or ends in 01-10 (translated)', $plurals)); |
1372 |
$this->assertTrue(in_array('5 is 0 or ends in 01-10 (translated)', $plurals)); |
1373 |
$this->assertTrue(in_array('6 is 0 or ends in 01-10 (translated)', $plurals)); |
1374 |
$this->assertTrue(in_array('7 is 0 or ends in 01-10 (translated)', $plurals)); |
1375 |
$this->assertTrue(in_array('8 is 0 or ends in 01-10 (translated)', $plurals)); |
1376 |
$this->assertTrue(in_array('9 is 0 or ends in 01-10 (translated)', $plurals)); |
1377 |
$this->assertTrue(in_array('10 is 0 or ends in 01-10 (translated)', $plurals)); |
1378 |
$this->assertTrue(in_array('11 ends in 11-20 (translated)', $plurals)); |
1379 |
$this->assertTrue(in_array('12 ends in 11-20 (translated)', $plurals)); |
1380 |
$this->assertTrue(in_array('13 ends in 11-20 (translated)', $plurals)); |
1381 |
$this->assertTrue(in_array('14 ends in 11-20 (translated)', $plurals)); |
1382 |
$this->assertTrue(in_array('15 ends in 11-20 (translated)', $plurals)); |
1383 |
$this->assertTrue(in_array('16 ends in 11-20 (translated)', $plurals)); |
1384 |
$this->assertTrue(in_array('17 ends in 11-20 (translated)', $plurals)); |
1385 |
$this->assertTrue(in_array('18 ends in 11-20 (translated)', $plurals)); |
1386 |
$this->assertTrue(in_array('19 ends in 11-20 (translated)', $plurals)); |
1387 |
$this->assertTrue(in_array('20 ends in 11-20 (translated)', $plurals)); |
1388 |
$this->assertTrue(in_array('21 everything else (translated)', $plurals)); |
1389 |
$this->assertTrue(in_array('22 everything else (translated)', $plurals)); |
1390 |
$this->assertTrue(in_array('23 everything else (translated)', $plurals)); |
1391 |
$this->assertTrue(in_array('24 everything else (translated)', $plurals)); |
1392 |
$this->assertTrue(in_array('25 everything else (translated)', $plurals)); |
1393 |
|
1394 |
$coreSingular = $this->_singularFromCore(); |
1395 |
$this->assertEquals('Plural Rule 13 (from core translated)', $coreSingular); |
1396 |
|
1397 |
$corePlurals = $this->_pluralFromCore(); |
1398 |
$this->assertTrue(in_array('0 is 0 or ends in 01-10 (from core translated)', $corePlurals)); |
1399 |
$this->assertTrue(in_array('1 is 1 (from core translated)', $corePlurals)); |
1400 |
$this->assertTrue(in_array('2 is 0 or ends in 01-10 (from core translated)', $corePlurals)); |
1401 |
$this->assertTrue(in_array('3 is 0 or ends in 01-10 (from core translated)', $corePlurals)); |
1402 |
$this->assertTrue(in_array('4 is 0 or ends in 01-10 (from core translated)', $corePlurals)); |
1403 |
$this->assertTrue(in_array('5 is 0 or ends in 01-10 (from core translated)', $corePlurals)); |
1404 |
$this->assertTrue(in_array('6 is 0 or ends in 01-10 (from core translated)', $corePlurals)); |
1405 |
$this->assertTrue(in_array('7 is 0 or ends in 01-10 (from core translated)', $corePlurals)); |
1406 |
$this->assertTrue(in_array('8 is 0 or ends in 01-10 (from core translated)', $corePlurals)); |
1407 |
$this->assertTrue(in_array('9 is 0 or ends in 01-10 (from core translated)', $corePlurals)); |
1408 |
$this->assertTrue(in_array('10 is 0 or ends in 01-10 (from core translated)', $corePlurals)); |
1409 |
$this->assertTrue(in_array('11 ends in 11-20 (from core translated)', $corePlurals)); |
1410 |
$this->assertTrue(in_array('12 ends in 11-20 (from core translated)', $corePlurals)); |
1411 |
$this->assertTrue(in_array('13 ends in 11-20 (from core translated)', $corePlurals)); |
1412 |
$this->assertTrue(in_array('14 ends in 11-20 (from core translated)', $corePlurals)); |
1413 |
$this->assertTrue(in_array('15 ends in 11-20 (from core translated)', $corePlurals)); |
1414 |
$this->assertTrue(in_array('16 ends in 11-20 (from core translated)', $corePlurals)); |
1415 |
$this->assertTrue(in_array('17 ends in 11-20 (from core translated)', $corePlurals)); |
1416 |
$this->assertTrue(in_array('18 ends in 11-20 (from core translated)', $corePlurals)); |
1417 |
$this->assertTrue(in_array('19 ends in 11-20 (from core translated)', $corePlurals)); |
1418 |
$this->assertTrue(in_array('20 ends in 11-20 (from core translated)', $corePlurals)); |
1419 |
$this->assertTrue(in_array('21 everything else (from core translated)', $corePlurals)); |
1420 |
$this->assertTrue(in_array('22 everything else (from core translated)', $corePlurals)); |
1421 |
$this->assertTrue(in_array('23 everything else (from core translated)', $corePlurals)); |
1422 |
$this->assertTrue(in_array('24 everything else (from core translated)', $corePlurals)); |
1423 |
$this->assertTrue(in_array('25 everything else (from core translated)', $corePlurals)); |
1424 |
} |
1425 |
|
1426 |
/**
|
1427 |
* testMoRulesFourteen method
|
1428 |
*
|
1429 |
* @return void
|
1430 |
*/
|
1431 |
public function testMoRulesFourteen() { |
1432 |
Configure::write('Config.language', 'rule_14_mo'); |
1433 |
$this->assertRulesFourteen();
|
1434 |
} |
1435 |
|
1436 |
/**
|
1437 |
* testPoRulesFourteen method
|
1438 |
*
|
1439 |
* @return void
|
1440 |
*/
|
1441 |
public function testPoRulesFourteen() { |
1442 |
Configure::write('Config.language', 'rule_14_po'); |
1443 |
$this->assertRulesFourteen();
|
1444 |
} |
1445 |
|
1446 |
/**
|
1447 |
* Assertions for plural rules fourteen
|
1448 |
*
|
1449 |
* @return void
|
1450 |
*/
|
1451 |
public function assertRulesFourteen() { |
1452 |
$singular = $this->_singular(); |
1453 |
$this->assertEquals('Plural Rule 14 (translated)', $singular); |
1454 |
|
1455 |
$plurals = $this->_plural(); |
1456 |
$this->assertTrue(in_array('0 everything else (translated)', $plurals)); |
1457 |
$this->assertTrue(in_array('1 ends in 1 (translated)', $plurals)); |
1458 |
$this->assertTrue(in_array('2 ends in 2 (translated)', $plurals)); |
1459 |
$this->assertTrue(in_array('3 everything else (translated)', $plurals)); |
1460 |
$this->assertTrue(in_array('4 everything else (translated)', $plurals)); |
1461 |
$this->assertTrue(in_array('5 everything else (translated)', $plurals)); |
1462 |
$this->assertTrue(in_array('6 everything else (translated)', $plurals)); |
1463 |
$this->assertTrue(in_array('7 everything else (translated)', $plurals)); |
1464 |
$this->assertTrue(in_array('8 everything else (translated)', $plurals)); |
1465 |
$this->assertTrue(in_array('9 everything else (translated)', $plurals)); |
1466 |
$this->assertTrue(in_array('10 everything else (translated)', $plurals)); |
1467 |
$this->assertTrue(in_array('11 ends in 1 (translated)', $plurals)); |
1468 |
$this->assertTrue(in_array('12 ends in 2 (translated)', $plurals)); |
1469 |
$this->assertTrue(in_array('13 everything else (translated)', $plurals)); |
1470 |
$this->assertTrue(in_array('14 everything else (translated)', $plurals)); |
1471 |
$this->assertTrue(in_array('15 everything else (translated)', $plurals)); |
1472 |
$this->assertTrue(in_array('16 everything else (translated)', $plurals)); |
1473 |
$this->assertTrue(in_array('17 everything else (translated)', $plurals)); |
1474 |
$this->assertTrue(in_array('18 everything else (translated)', $plurals)); |
1475 |
$this->assertTrue(in_array('19 everything else (translated)', $plurals)); |
1476 |
$this->assertTrue(in_array('20 everything else (translated)', $plurals)); |
1477 |
$this->assertTrue(in_array('21 ends in 1 (translated)', $plurals)); |
1478 |
$this->assertTrue(in_array('22 ends in 2 (translated)', $plurals)); |
1479 |
$this->assertTrue(in_array('23 everything else (translated)', $plurals)); |
1480 |
$this->assertTrue(in_array('24 everything else (translated)', $plurals)); |
1481 |
$this->assertTrue(in_array('25 everything else (translated)', $plurals)); |
1482 |
|
1483 |
$coreSingular = $this->_singularFromCore(); |
1484 |
$this->assertEquals('Plural Rule 14 (from core translated)', $coreSingular); |
1485 |
|
1486 |
$corePlurals = $this->_pluralFromCore(); |
1487 |
$this->assertTrue(in_array('0 everything else (from core translated)', $corePlurals)); |
1488 |
$this->assertTrue(in_array('1 ends in 1 (from core translated)', $corePlurals)); |
1489 |
$this->assertTrue(in_array('2 ends in 2 (from core translated)', $corePlurals)); |
1490 |
$this->assertTrue(in_array('3 everything else (from core translated)', $corePlurals)); |
1491 |
$this->assertTrue(in_array('4 everything else (from core translated)', $corePlurals)); |
1492 |
$this->assertTrue(in_array('5 everything else (from core translated)', $corePlurals)); |
1493 |
$this->assertTrue(in_array('6 everything else (from core translated)', $corePlurals)); |
1494 |
$this->assertTrue(in_array('7 everything else (from core translated)', $corePlurals)); |
1495 |
$this->assertTrue(in_array('8 everything else (from core translated)', $corePlurals)); |
1496 |
$this->assertTrue(in_array('9 everything else (from core translated)', $corePlurals)); |
1497 |
$this->assertTrue(in_array('10 everything else (from core translated)', $corePlurals)); |
1498 |
$this->assertTrue(in_array('11 ends in 1 (from core translated)', $corePlurals)); |
1499 |
$this->assertTrue(in_array('12 ends in 2 (from core translated)', $corePlurals)); |
1500 |
$this->assertTrue(in_array('13 everything else (from core translated)', $corePlurals)); |
1501 |
$this->assertTrue(in_array('14 everything else (from core translated)', $corePlurals)); |
1502 |
$this->assertTrue(in_array('15 everything else (from core translated)', $corePlurals)); |
1503 |
$this->assertTrue(in_array('16 everything else (from core translated)', $corePlurals)); |
1504 |
$this->assertTrue(in_array('17 everything else (from core translated)', $corePlurals)); |
1505 |
$this->assertTrue(in_array('18 everything else (from core translated)', $corePlurals)); |
1506 |
$this->assertTrue(in_array('19 everything else (from core translated)', $corePlurals)); |
1507 |
$this->assertTrue(in_array('20 everything else (from core translated)', $corePlurals)); |
1508 |
$this->assertTrue(in_array('21 ends in 1 (from core translated)', $corePlurals)); |
1509 |
$this->assertTrue(in_array('22 ends in 2 (from core translated)', $corePlurals)); |
1510 |
$this->assertTrue(in_array('23 everything else (from core translated)', $corePlurals)); |
1511 |
$this->assertTrue(in_array('24 everything else (from core translated)', $corePlurals)); |
1512 |
$this->assertTrue(in_array('25 everything else (from core translated)', $corePlurals)); |
1513 |
} |
1514 |
|
1515 |
/**
|
1516 |
* testMoRulesFifteen method
|
1517 |
*
|
1518 |
* @return void
|
1519 |
*/
|
1520 |
public function testMoRulesFifteen() { |
1521 |
Configure::write('Config.language', 'rule_15_mo'); |
1522 |
$this->assertRulesFifteen();
|
1523 |
} |
1524 |
|
1525 |
/**
|
1526 |
* testPoRulesFifteen method
|
1527 |
*
|
1528 |
* @return void
|
1529 |
*/
|
1530 |
public function testPoRulesFifteen() { |
1531 |
Configure::write('Config.language', 'rule_15_po'); |
1532 |
$this->assertRulesFifteen();
|
1533 |
} |
1534 |
|
1535 |
/**
|
1536 |
* Assertions for plural rules fifteen
|
1537 |
*
|
1538 |
* @return void
|
1539 |
*/
|
1540 |
public function assertRulesFifteen() { |
1541 |
$singular = $this->_singular(); |
1542 |
$this->assertEquals('Plural Rule 15 (translated)', $singular); |
1543 |
|
1544 |
$plurals = $this->_plural(111); |
1545 |
$this->assertTrue(in_array('0 is 0 (translated)', $plurals)); |
1546 |
$this->assertTrue(in_array('1 is 1 (translated)', $plurals)); |
1547 |
$this->assertTrue(in_array('2 is 2 (translated)', $plurals)); |
1548 |
$this->assertTrue(in_array('3 ends with 03-10 (translated)', $plurals)); |
1549 |
$this->assertTrue(in_array('4 ends with 03-10 (translated)', $plurals)); |
1550 |
$this->assertTrue(in_array('5 ends with 03-10 (translated)', $plurals)); |
1551 |
$this->assertTrue(in_array('6 ends with 03-10 (translated)', $plurals)); |
1552 |
$this->assertTrue(in_array('7 ends with 03-10 (translated)', $plurals)); |
1553 |
$this->assertTrue(in_array('8 ends with 03-10 (translated)', $plurals)); |
1554 |
$this->assertTrue(in_array('9 ends with 03-10 (translated)', $plurals)); |
1555 |
$this->assertTrue(in_array('10 ends with 03-10 (translated)', $plurals)); |
1556 |
$this->assertTrue(in_array('11 ends with 11-99 (translated)', $plurals)); |
1557 |
$this->assertTrue(in_array('12 ends with 11-99 (translated)', $plurals)); |
1558 |
$this->assertTrue(in_array('13 ends with 11-99 (translated)', $plurals)); |
1559 |
$this->assertTrue(in_array('14 ends with 11-99 (translated)', $plurals)); |
1560 |
$this->assertTrue(in_array('15 ends with 11-99 (translated)', $plurals)); |
1561 |
$this->assertTrue(in_array('16 ends with 11-99 (translated)', $plurals)); |
1562 |
$this->assertTrue(in_array('17 ends with 11-99 (translated)', $plurals)); |
1563 |
$this->assertTrue(in_array('18 ends with 11-99 (translated)', $plurals)); |
1564 |
$this->assertTrue(in_array('19 ends with 11-99 (translated)', $plurals)); |
1565 |
$this->assertTrue(in_array('20 ends with 11-99 (translated)', $plurals)); |
1566 |
$this->assertTrue(in_array('31 ends with 11-99 (translated)', $plurals)); |
1567 |
$this->assertTrue(in_array('42 ends with 11-99 (translated)', $plurals)); |
1568 |
$this->assertTrue(in_array('53 ends with 11-99 (translated)', $plurals)); |
1569 |
$this->assertTrue(in_array('64 ends with 11-99 (translated)', $plurals)); |
1570 |
$this->assertTrue(in_array('75 ends with 11-99 (translated)', $plurals)); |
1571 |
$this->assertTrue(in_array('86 ends with 11-99 (translated)', $plurals)); |
1572 |
$this->assertTrue(in_array('97 ends with 11-99 (translated)', $plurals)); |
1573 |
$this->assertTrue(in_array('98 ends with 11-99 (translated)', $plurals)); |
1574 |
$this->assertTrue(in_array('99 ends with 11-99 (translated)', $plurals)); |
1575 |
$this->assertTrue(in_array('100 everything else (translated)', $plurals)); |
1576 |
$this->assertTrue(in_array('101 everything else (translated)', $plurals)); |
1577 |
$this->assertTrue(in_array('102 everything else (translated)', $plurals)); |
1578 |
$this->assertTrue(in_array('103 ends with 03-10 (translated)', $plurals)); |
1579 |
$this->assertTrue(in_array('104 ends with 03-10 (translated)', $plurals)); |
1580 |
$this->assertTrue(in_array('105 ends with 03-10 (translated)', $plurals)); |
1581 |
$this->assertTrue(in_array('106 ends with 03-10 (translated)', $plurals)); |
1582 |
$this->assertTrue(in_array('107 ends with 03-10 (translated)', $plurals)); |
1583 |
$this->assertTrue(in_array('108 ends with 03-10 (translated)', $plurals)); |
1584 |
$this->assertTrue(in_array('109 ends with 03-10 (translated)', $plurals)); |
1585 |
$this->assertTrue(in_array('110 ends with 03-10 (translated)', $plurals)); |
1586 |
$this->assertTrue(in_array('111 ends with 11-99 (translated)', $plurals)); |
1587 |
|
1588 |
$coreSingular = $this->_singularFromCore(); |
1589 |
$this->assertEquals('Plural Rule 15 (from core translated)', $coreSingular); |
1590 |
|
1591 |
$corePlurals = $this->_pluralFromCore(111); |
1592 |
$this->assertTrue(in_array('0 is 0 (from core translated)', $corePlurals)); |
1593 |
$this->assertTrue(in_array('1 is 1 (from core translated)', $corePlurals)); |
1594 |
$this->assertTrue(in_array('2 is 2 (from core translated)', $corePlurals)); |
1595 |
$this->assertTrue(in_array('3 ends with 03-10 (from core translated)', $corePlurals)); |
1596 |
$this->assertTrue(in_array('4 ends with 03-10 (from core translated)', $corePlurals)); |
1597 |
$this->assertTrue(in_array('5 ends with 03-10 (from core translated)', $corePlurals)); |
1598 |
$this->assertTrue(in_array('6 ends with 03-10 (from core translated)', $corePlurals)); |
1599 |
$this->assertTrue(in_array('7 ends with 03-10 (from core translated)', $corePlurals)); |
1600 |
$this->assertTrue(in_array('8 ends with 03-10 (from core translated)', $corePlurals)); |
1601 |
$this->assertTrue(in_array('9 ends with 03-10 (from core translated)', $corePlurals)); |
1602 |
$this->assertTrue(in_array('10 ends with 03-10 (from core translated)', $corePlurals)); |
1603 |
$this->assertTrue(in_array('11 ends with 11-99 (from core translated)', $corePlurals)); |
1604 |
$this->assertTrue(in_array('12 ends with 11-99 (from core translated)', $corePlurals)); |
1605 |
$this->assertTrue(in_array('13 ends with 11-99 (from core translated)', $corePlurals)); |
1606 |
$this->assertTrue(in_array('14 ends with 11-99 (from core translated)', $corePlurals)); |
1607 |
$this->assertTrue(in_array('15 ends with 11-99 (from core translated)', $corePlurals)); |
1608 |
$this->assertTrue(in_array('16 ends with 11-99 (from core translated)', $corePlurals)); |
1609 |
$this->assertTrue(in_array('17 ends with 11-99 (from core translated)', $corePlurals)); |
1610 |
$this->assertTrue(in_array('18 ends with 11-99 (from core translated)', $corePlurals)); |
1611 |
$this->assertTrue(in_array('19 ends with 11-99 (from core translated)', $corePlurals)); |
1612 |
$this->assertTrue(in_array('20 ends with 11-99 (from core translated)', $corePlurals)); |
1613 |
$this->assertTrue(in_array('31 ends with 11-99 (from core translated)', $corePlurals)); |
1614 |
$this->assertTrue(in_array('42 ends with 11-99 (from core translated)', $corePlurals)); |
1615 |
$this->assertTrue(in_array('53 ends with 11-99 (from core translated)', $corePlurals)); |
1616 |
$this->assertTrue(in_array('64 ends with 11-99 (from core translated)', $corePlurals)); |
1617 |
$this->assertTrue(in_array('75 ends with 11-99 (from core translated)', $corePlurals)); |
1618 |
$this->assertTrue(in_array('86 ends with 11-99 (from core translated)', $corePlurals)); |
1619 |
$this->assertTrue(in_array('97 ends with 11-99 (from core translated)', $corePlurals)); |
1620 |
$this->assertTrue(in_array('98 ends with 11-99 (from core translated)', $corePlurals)); |
1621 |
$this->assertTrue(in_array('99 ends with 11-99 (from core translated)', $corePlurals)); |
1622 |
$this->assertTrue(in_array('100 everything else (from core translated)', $corePlurals)); |
1623 |
$this->assertTrue(in_array('101 everything else (from core translated)', $corePlurals)); |
1624 |
$this->assertTrue(in_array('102 everything else (from core translated)', $corePlurals)); |
1625 |
$this->assertTrue(in_array('103 ends with 03-10 (from core translated)', $corePlurals)); |
1626 |
$this->assertTrue(in_array('104 ends with 03-10 (from core translated)', $corePlurals)); |
1627 |
$this->assertTrue(in_array('105 ends with 03-10 (from core translated)', $corePlurals)); |
1628 |
$this->assertTrue(in_array('106 ends with 03-10 (from core translated)', $corePlurals)); |
1629 |
$this->assertTrue(in_array('107 ends with 03-10 (from core translated)', $corePlurals)); |
1630 |
$this->assertTrue(in_array('108 ends with 03-10 (from core translated)', $corePlurals)); |
1631 |
$this->assertTrue(in_array('109 ends with 03-10 (from core translated)', $corePlurals)); |
1632 |
$this->assertTrue(in_array('110 ends with 03-10 (from core translated)', $corePlurals)); |
1633 |
$this->assertTrue(in_array('111 ends with 11-99 (from core translated)', $corePlurals)); |
1634 |
} |
1635 |
|
1636 |
/**
|
1637 |
* testSetLanguageWithSession method
|
1638 |
*
|
1639 |
* @return void
|
1640 |
*/
|
1641 |
public function testSetLanguageWithSession() { |
1642 |
CakeSession::write('Config.language', 'po'); |
1643 |
$singular = $this->_singular(); |
1644 |
$this->assertEquals('Po (translated)', $singular); |
1645 |
|
1646 |
$plurals = $this->_plural(); |
1647 |
$this->assertTrue(in_array('0 everything else (po translated)', $plurals)); |
1648 |
$this->assertTrue(in_array('1 is 1 (po translated)', $plurals)); |
1649 |
$this->assertTrue(in_array('2 is 2-4 (po translated)', $plurals)); |
1650 |
$this->assertTrue(in_array('3 is 2-4 (po translated)', $plurals)); |
1651 |
$this->assertTrue(in_array('4 is 2-4 (po translated)', $plurals)); |
1652 |
$this->assertTrue(in_array('5 everything else (po translated)', $plurals)); |
1653 |
$this->assertTrue(in_array('6 everything else (po translated)', $plurals)); |
1654 |
$this->assertTrue(in_array('7 everything else (po translated)', $plurals)); |
1655 |
$this->assertTrue(in_array('8 everything else (po translated)', $plurals)); |
1656 |
$this->assertTrue(in_array('9 everything else (po translated)', $plurals)); |
1657 |
$this->assertTrue(in_array('10 everything else (po translated)', $plurals)); |
1658 |
$this->assertTrue(in_array('11 everything else (po translated)', $plurals)); |
1659 |
$this->assertTrue(in_array('12 everything else (po translated)', $plurals)); |
1660 |
$this->assertTrue(in_array('13 everything else (po translated)', $plurals)); |
1661 |
$this->assertTrue(in_array('14 everything else (po translated)', $plurals)); |
1662 |
$this->assertTrue(in_array('15 everything else (po translated)', $plurals)); |
1663 |
$this->assertTrue(in_array('16 everything else (po translated)', $plurals)); |
1664 |
$this->assertTrue(in_array('17 everything else (po translated)', $plurals)); |
1665 |
$this->assertTrue(in_array('18 everything else (po translated)', $plurals)); |
1666 |
$this->assertTrue(in_array('19 everything else (po translated)', $plurals)); |
1667 |
$this->assertTrue(in_array('20 everything else (po translated)', $plurals)); |
1668 |
$this->assertTrue(in_array('21 everything else (po translated)', $plurals)); |
1669 |
$this->assertTrue(in_array('22 everything else (po translated)', $plurals)); |
1670 |
$this->assertTrue(in_array('23 everything else (po translated)', $plurals)); |
1671 |
$this->assertTrue(in_array('24 everything else (po translated)', $plurals)); |
1672 |
$this->assertTrue(in_array('25 everything else (po translated)', $plurals)); |
1673 |
CakeSession::delete('Config.language'); |
1674 |
} |
1675 |
|
1676 |
/**
|
1677 |
* testNoCoreTranslation method
|
1678 |
*
|
1679 |
* @return void
|
1680 |
*/
|
1681 |
public function testNoCoreTranslation() { |
1682 |
Configure::write('Config.language', 'po'); |
1683 |
$singular = $this->_singular(); |
1684 |
$this->assertEquals('Po (translated)', $singular); |
1685 |
|
1686 |
$coreSingular = $this->_singularFromCore(); |
1687 |
$this->assertNotEquals('Po (from core translated)', $coreSingular); |
1688 |
|
1689 |
$corePlurals = $this->_pluralFromCore(); |
1690 |
$this->assertFalse(in_array('0 everything else (from core translated)', $corePlurals)); |
1691 |
$this->assertFalse(in_array('1 is 1 (from core translated)', $corePlurals)); |
1692 |
$this->assertFalse(in_array('2 is 2-4 (from core translated)', $corePlurals)); |
1693 |
$this->assertFalse(in_array('3 is 2-4 (from core translated)', $corePlurals)); |
1694 |
$this->assertFalse(in_array('4 is 2-4 (from core translated)', $corePlurals)); |
1695 |
$this->assertFalse(in_array('5 everything else (from core translated)', $corePlurals)); |
1696 |
$this->assertFalse(in_array('6 everything else (from core translated)', $corePlurals)); |
1697 |
$this->assertFalse(in_array('7 everything else (from core translated)', $corePlurals)); |
1698 |
$this->assertFalse(in_array('8 everything else (from core translated)', $corePlurals)); |
1699 |
$this->assertFalse(in_array('9 everything else (from core translated)', $corePlurals)); |
1700 |
$this->assertFalse(in_array('10 everything else (from core translated)', $corePlurals)); |
1701 |
$this->assertFalse(in_array('11 everything else (from core translated)', $corePlurals)); |
1702 |
$this->assertFalse(in_array('12 everything else (from core translated)', $corePlurals)); |
1703 |
$this->assertFalse(in_array('13 everything else (from core translated)', $corePlurals)); |
1704 |
$this->assertFalse(in_array('14 everything else (from core translated)', $corePlurals)); |
1705 |
$this->assertFalse(in_array('15 everything else (from core translated)', $corePlurals)); |
1706 |
$this->assertFalse(in_array('16 everything else (from core translated)', $corePlurals)); |
1707 |
$this->assertFalse(in_array('17 everything else (from core translated)', $corePlurals)); |
1708 |
$this->assertFalse(in_array('18 everything else (from core translated)', $corePlurals)); |
1709 |
$this->assertFalse(in_array('19 everything else (from core translated)', $corePlurals)); |
1710 |
$this->assertFalse(in_array('20 everything else (from core translated)', $corePlurals)); |
1711 |
$this->assertFalse(in_array('21 everything else (from core translated)', $corePlurals)); |
1712 |
$this->assertFalse(in_array('22 everything else (from core translated)', $corePlurals)); |
1713 |
$this->assertFalse(in_array('23 everything else (from core translated)', $corePlurals)); |
1714 |
$this->assertFalse(in_array('24 everything else (from core translated)', $corePlurals)); |
1715 |
$this->assertFalse(in_array('25 everything else (from core translated)', $corePlurals)); |
1716 |
} |
1717 |
|
1718 |
/**
|
1719 |
* testPluginTranslation method
|
1720 |
*
|
1721 |
* @return void
|
1722 |
*/
|
1723 |
public function testPluginTranslation() { |
1724 |
App::build(array( |
1725 |
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS) |
1726 |
)); |
1727 |
|
1728 |
Configure::write('Config.language', 'po'); |
1729 |
$singular = $this->_domainSingular(); |
1730 |
$this->assertEquals('Plural Rule 1 (from plugin)', $singular); |
1731 |
|
1732 |
$plurals = $this->_domainPlural(); |
1733 |
$this->assertTrue(in_array('0 = 0 or > 1 (from plugin)', $plurals)); |
1734 |
$this->assertTrue(in_array('1 = 1 (from plugin)', $plurals)); |
1735 |
$this->assertTrue(in_array('2 = 0 or > 1 (from plugin)', $plurals)); |
1736 |
$this->assertTrue(in_array('3 = 0 or > 1 (from plugin)', $plurals)); |
1737 |
$this->assertTrue(in_array('4 = 0 or > 1 (from plugin)', $plurals)); |
1738 |
$this->assertTrue(in_array('5 = 0 or > 1 (from plugin)', $plurals)); |
1739 |
$this->assertTrue(in_array('6 = 0 or > 1 (from plugin)', $plurals)); |
1740 |
$this->assertTrue(in_array('7 = 0 or > 1 (from plugin)', $plurals)); |
1741 |
$this->assertTrue(in_array('8 = 0 or > 1 (from plugin)', $plurals)); |
1742 |
$this->assertTrue(in_array('9 = 0 or > 1 (from plugin)', $plurals)); |
1743 |
$this->assertTrue(in_array('10 = 0 or > 1 (from plugin)', $plurals)); |
1744 |
$this->assertTrue(in_array('11 = 0 or > 1 (from plugin)', $plurals)); |
1745 |
$this->assertTrue(in_array('12 = 0 or > 1 (from plugin)', $plurals)); |
1746 |
$this->assertTrue(in_array('13 = 0 or > 1 (from plugin)', $plurals)); |
1747 |
$this->assertTrue(in_array('14 = 0 or > 1 (from plugin)', $plurals)); |
1748 |
$this->assertTrue(in_array('15 = 0 or > 1 (from plugin)', $plurals)); |
1749 |
$this->assertTrue(in_array('16 = 0 or > 1 (from plugin)', $plurals)); |
1750 |
$this->assertTrue(in_array('17 = 0 or > 1 (from plugin)', $plurals)); |
1751 |
$this->assertTrue(in_array('18 = 0 or > 1 (from plugin)', $plurals)); |
1752 |
$this->assertTrue(in_array('19 = 0 or > 1 (from plugin)', $plurals)); |
1753 |
$this->assertTrue(in_array('20 = 0 or > 1 (from plugin)', $plurals)); |
1754 |
$this->assertTrue(in_array('21 = 0 or > 1 (from plugin)', $plurals)); |
1755 |
$this->assertTrue(in_array('22 = 0 or > 1 (from plugin)', $plurals)); |
1756 |
$this->assertTrue(in_array('23 = 0 or > 1 (from plugin)', $plurals)); |
1757 |
$this->assertTrue(in_array('24 = 0 or > 1 (from plugin)', $plurals)); |
1758 |
$this->assertTrue(in_array('25 = 0 or > 1 (from plugin)', $plurals)); |
1759 |
} |
1760 |
|
1761 |
/**
|
1762 |
* Test that Configure::read('I18n.preferApp') will prefer app.
|
1763 |
*
|
1764 |
* @return void
|
1765 |
*/
|
1766 |
public function testPluginTranslationPreferApp() { |
1767 |
// Reset internally stored entries
|
1768 |
I18n::clear();
|
1769 |
Cache::clear(false, '_cake_core_'); |
1770 |
|
1771 |
Configure::write('I18n.preferApp', true); |
1772 |
|
1773 |
App::build(array( |
1774 |
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS) |
1775 |
)); |
1776 |
|
1777 |
Configure::write('Config.language', 'po'); |
1778 |
$singular = $this->_domainSingular(); |
1779 |
$this->assertEquals('Plural Rule 1', $singular); |
1780 |
|
1781 |
$plurals = $this->_domainPlural(); |
1782 |
$this->assertTrue(in_array('0 = 0 or > 1', $plurals)); |
1783 |
} |
1784 |
|
1785 |
/**
|
1786 |
* testPoMultipleLineTranslation method
|
1787 |
*
|
1788 |
* @return void
|
1789 |
*/
|
1790 |
public function testPoMultipleLineTranslation() { |
1791 |
Configure::write('Config.language', 'po'); |
1792 |
|
1793 |
$string = "This is a multiline translation\n"; |
1794 |
$string .= "broken up over multiple lines.\n"; |
1795 |
$string .= "This is the third line.\n"; |
1796 |
$string .= "This is the forth line."; |
1797 |
$result = __($string); |
1798 |
|
1799 |
$expected = "This is a multiline translation\n"; |
1800 |
$expected .= "broken up over multiple lines.\n"; |
1801 |
$expected .= "This is the third line.\n"; |
1802 |
$expected .= "This is the forth line. (translated)"; |
1803 |
$this->assertEquals($expected, $result); |
1804 |
|
1805 |
// Windows Newline is \r\n
|
1806 |
$string = "This is a multiline translation\r\n"; |
1807 |
$string .= "broken up over multiple lines.\r\n"; |
1808 |
$string .= "This is the third line.\r\n"; |
1809 |
$string .= "This is the forth line."; |
1810 |
$result = __($string); |
1811 |
$this->assertEquals($expected, $result); |
1812 |
|
1813 |
$singular = "valid\nsecond line"; |
1814 |
$plural = "valids\nsecond line"; |
1815 |
|
1816 |
$result = __n($singular, $plural, 1); |
1817 |
$expected = "v\nsecond line"; |
1818 |
$this->assertEquals($expected, $result); |
1819 |
|
1820 |
$result = __n($singular, $plural, 2); |
1821 |
$expected = "vs\nsecond line"; |
1822 |
$this->assertEquals($expected, $result); |
1823 |
|
1824 |
$string = "This is a multiline translation\n"; |
1825 |
$string .= "broken up over multiple lines.\n"; |
1826 |
$string .= "This is the third line.\n"; |
1827 |
$string .= "This is the forth line."; |
1828 |
|
1829 |
$singular = "%d = 1\n" . $string; |
1830 |
$plural = "%d = 0 or > 1\n" . $string; |
1831 |
|
1832 |
$result = __n($singular, $plural, 1); |
1833 |
$expected = "%d is 1\n" . $string; |
1834 |
$this->assertEquals($expected, $result); |
1835 |
|
1836 |
$result = __n($singular, $plural, 2); |
1837 |
$expected = "%d is 2-4\n" . $string; |
1838 |
$this->assertEquals($expected, $result); |
1839 |
|
1840 |
// Windows Newline is \r\n
|
1841 |
$string = "This is a multiline translation\r\n"; |
1842 |
$string .= "broken up over multiple lines.\r\n"; |
1843 |
$string .= "This is the third line.\r\n"; |
1844 |
$string .= "This is the forth line."; |
1845 |
|
1846 |
$singular = "%d = 1\r\n" . $string; |
1847 |
$plural = "%d = 0 or > 1\r\n" . $string; |
1848 |
|
1849 |
$result = __n($singular, $plural, 1); |
1850 |
$expected = "%d is 1\n" . str_replace("\r\n", "\n", $string); |
1851 |
$this->assertEquals($expected, $result); |
1852 |
|
1853 |
$result = __n($singular, $plural, 2); |
1854 |
$expected = "%d is 2-4\n" . str_replace("\r\n", "\n", $string); |
1855 |
$this->assertEquals($expected, $result); |
1856 |
} |
1857 |
|
1858 |
/**
|
1859 |
* testPoNoTranslationNeeded method
|
1860 |
*
|
1861 |
* @return void
|
1862 |
*/
|
1863 |
public function testPoNoTranslationNeeded() { |
1864 |
Configure::write('Config.language', 'po'); |
1865 |
$result = __('No Translation needed'); |
1866 |
$this->assertEquals('No Translation needed', $result); |
1867 |
} |
1868 |
|
1869 |
/**
|
1870 |
* testPoQuotedString method
|
1871 |
*
|
1872 |
* @return void
|
1873 |
*/
|
1874 |
public function testPoQuotedString() { |
1875 |
Configure::write('Config.language', 'po'); |
1876 |
$expected = 'this is a "quoted string" (translated)'; |
1877 |
$this->assertEquals($expected, __('this is a "quoted string"')); |
1878 |
} |
1879 |
|
1880 |
/**
|
1881 |
* testFloatValue method
|
1882 |
*
|
1883 |
* @return void
|
1884 |
*/
|
1885 |
public function testFloatValue() { |
1886 |
Configure::write('Config.language', 'rule_9_po'); |
1887 |
|
1888 |
$result = __n('%d = 1', '%d = 0 or > 1', (float)1); |
1889 |
$expected = '%d is 1 (translated)'; |
1890 |
$this->assertEquals($expected, $result); |
1891 |
|
1892 |
$result = __n('%d = 1', '%d = 0 or > 1', (float)2); |
1893 |
$expected = "%d ends in 2-4, not 12-14 (translated)"; |
1894 |
$this->assertEquals($expected, $result); |
1895 |
|
1896 |
$result = __n('%d = 1', '%d = 0 or > 1', (float)5); |
1897 |
$expected = "%d everything else (translated)"; |
1898 |
$this->assertEquals($expected, $result); |
1899 |
} |
1900 |
|
1901 |
/**
|
1902 |
* testCategory method
|
1903 |
*
|
1904 |
* @return void
|
1905 |
*/
|
1906 |
public function testCategory() { |
1907 |
Configure::write('Config.language', 'po'); |
1908 |
// Test with default (I18n constant) category.
|
1909 |
$category = $this->_category(); |
1910 |
$this->assertEquals('Monetary Po (translated)', $category); |
1911 |
// Test with category number represenation.
|
1912 |
$category = $this->_category(3); |
1913 |
$this->assertEquals('Monetary Po (translated)', $category); |
1914 |
} |
1915 |
|
1916 |
/**
|
1917 |
* testPluginCategory method
|
1918 |
*
|
1919 |
* @return void
|
1920 |
*/
|
1921 |
public function testPluginCategory() { |
1922 |
Configure::write('Config.language', 'po'); |
1923 |
|
1924 |
$singular = $this->_domainCategorySingular(); |
1925 |
$this->assertEquals('Monetary Plural Rule 1 (from plugin)', $singular); |
1926 |
|
1927 |
$plurals = $this->_domainCategoryPlural(); |
1928 |
$this->assertTrue(in_array('Monetary 0 = 0 or > 1 (from plugin)', $plurals)); |
1929 |
$this->assertTrue(in_array('Monetary 1 = 1 (from plugin)', $plurals)); |
1930 |
} |
1931 |
|
1932 |
/**
|
1933 |
* testCategoryThenSingular method
|
1934 |
*
|
1935 |
* @return void
|
1936 |
*/
|
1937 |
public function testCategoryThenSingular() { |
1938 |
Configure::write('Config.language', 'po'); |
1939 |
$category = $this->_category(); |
1940 |
$this->assertEquals('Monetary Po (translated)', $category); |
1941 |
|
1942 |
$singular = $this->_singular(); |
1943 |
$this->assertEquals('Po (translated)', $singular); |
1944 |
} |
1945 |
|
1946 |
/**
|
1947 |
* testTimeDefinition method
|
1948 |
*
|
1949 |
* @return void
|
1950 |
*/
|
1951 |
public function testTimeDefinition() { |
1952 |
Configure::write('Config.language', 'po'); |
1953 |
$result = __c('d_fmt', 5); |
1954 |
$expected = '%m/%d/%Y'; |
1955 |
$this->assertEquals($expected, $result); |
1956 |
|
1957 |
$result = __c('am_pm', 5); |
1958 |
$expected = array('AM', 'PM'); |
1959 |
$this->assertEquals($expected, $result); |
1960 |
|
1961 |
$result = __c('abmon', 5); |
1962 |
$expected = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); |
1963 |
$this->assertEquals($expected, $result); |
1964 |
} |
1965 |
|
1966 |
/**
|
1967 |
* testTimeDefinitionJapanese method
|
1968 |
*
|
1969 |
* @return void
|
1970 |
*/
|
1971 |
public function testTimeDefinitionJapanese() { |
1972 |
Configure::write('Config.language', 'ja_jp'); |
1973 |
$result = __c('d_fmt', 5); |
1974 |
|
1975 |
$expected = "%Y年%m月%d日"; |
1976 |
|
1977 |
$this->assertEquals($expected, $result); |
1978 |
|
1979 |
$result = __c('am_pm', 5); |
1980 |
$expected = array("午前", "午後"); |
1981 |
$this->assertEquals($expected, $result); |
1982 |
|
1983 |
$result = __c('abmon', 5); |
1984 |
$expected = array(" 1月", " 2月", " 3月", " 4月", " 5月", " 6月", " 7月", " 8月", " 9月", "10月", "11月", "12月"); |
1985 |
$this->assertEquals($expected, $result); |
1986 |
} |
1987 |
|
1988 |
/**
|
1989 |
* testTranslateLanguageParam method
|
1990 |
*
|
1991 |
* @return void
|
1992 |
*/
|
1993 |
public function testTranslateLanguageParam() { |
1994 |
Configure::write('Config.language', 'rule_0_po'); |
1995 |
|
1996 |
$result = I18n::translate('Plural Rule 1', null, null, I18n::LC_MESSAGES); |
1997 |
$expected = 'Plural Rule 0 (translated)'; |
1998 |
$this->assertEquals($expected, $result); |
1999 |
|
2000 |
$result = I18n::translate('Plural Rule 1', null, null, I18n::LC_MESSAGES, null, 'rule_1_po'); |
2001 |
$expected = 'Plural Rule 1 (translated)'; |
2002 |
$this->assertEquals($expected, $result); |
2003 |
} |
2004 |
|
2005 |
/**
|
2006 |
* Test that the '' domain causes exceptions.
|
2007 |
*
|
2008 |
* @expectedException CakeException
|
2009 |
* @return void
|
2010 |
*/
|
2011 |
public function testTranslateEmptyDomain() { |
2012 |
I18n::translate('Plural Rule 1', null, ''); |
2013 |
} |
2014 |
|
2015 |
/**
|
2016 |
* testLoadLocaleDefinition method
|
2017 |
*
|
2018 |
* @return void
|
2019 |
*/
|
2020 |
public function testLoadLocaleDefinition() { |
2021 |
$path = current(App::path('locales')); |
2022 |
$result = I18n::loadLocaleDefinition($path . 'nld' . DS . 'LC_TIME'); |
2023 |
$expected = array('zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'); |
2024 |
$this->assertSame($expected, $result['day']); |
2025 |
} |
2026 |
|
2027 |
/**
|
2028 |
* Test basic context support
|
2029 |
*
|
2030 |
* @return void
|
2031 |
*/
|
2032 |
public function testContext() { |
2033 |
Configure::write('Config.language', 'nld'); |
2034 |
|
2035 |
$this->assertSame("brief", __x('mail', 'letter')); |
2036 |
$this->assertSame("letter", __x('character', 'letter')); |
2037 |
$this->assertSame("bal", __x('spherical object', 'ball')); |
2038 |
$this->assertSame("danspartij", __x('social gathering', 'ball')); |
2039 |
$this->assertSame("balans", __('balance')); |
2040 |
$this->assertSame("saldo", __x('money', 'balance')); |
2041 |
} |
2042 |
|
2043 |
/**
|
2044 |
* Test basic context support using mo files.
|
2045 |
*
|
2046 |
* @return void
|
2047 |
*/
|
2048 |
public function testContextMoFile() { |
2049 |
Configure::write('Config.language', 'nld_mo'); |
2050 |
|
2051 |
$this->assertSame("brief", __x('mail', 'letter')); |
2052 |
$this->assertSame("letter", __x('character', 'letter')); |
2053 |
$this->assertSame("bal", __x('spherical object', 'ball')); |
2054 |
$this->assertSame("danspartij", __x('social gathering', 'ball')); |
2055 |
$this->assertSame("balans", __('balance')); |
2056 |
$this->assertSame("saldo", __x('money', 'balance')); |
2057 |
|
2058 |
// MO file is sorted by msgid, 'zoo' should be last
|
2059 |
$this->assertSame("dierentuin", __('zoo')); |
2060 |
} |
2061 |
|
2062 |
/**
|
2063 |
* Singular method
|
2064 |
*
|
2065 |
* @return void
|
2066 |
*/
|
2067 |
protected function _domainCategorySingular($domain = 'test_plugin', $category = 3) { |
2068 |
$singular = __dc($domain, 'Plural Rule 1', $category); |
2069 |
return $singular; |
2070 |
} |
2071 |
|
2072 |
/**
|
2073 |
* Plural method
|
2074 |
*
|
2075 |
* @return void
|
2076 |
*/
|
2077 |
protected function _domainCategoryPlural($domain = 'test_plugin', $category = 3) { |
2078 |
$plurals = array(); |
2079 |
for ($number = 0; $number <= 25; $number++) { |
2080 |
$plurals[] = sprintf(__dcn($domain, '%d = 1', '%d = 0 or > 1', (float)$number, $category), (float)$number); |
2081 |
} |
2082 |
return $plurals; |
2083 |
} |
2084 |
|
2085 |
/**
|
2086 |
* Singular method
|
2087 |
*
|
2088 |
* @return void
|
2089 |
*/
|
2090 |
protected function _domainSingular($domain = 'test_plugin') { |
2091 |
$singular = __d($domain, 'Plural Rule 1'); |
2092 |
return $singular; |
2093 |
} |
2094 |
|
2095 |
/**
|
2096 |
* Plural method
|
2097 |
*
|
2098 |
* @return void
|
2099 |
*/
|
2100 |
protected function _domainPlural($domain = 'test_plugin') { |
2101 |
$plurals = array(); |
2102 |
for ($number = 0; $number <= 25; $number++) { |
2103 |
$plurals[] = sprintf(__dn($domain, '%d = 1', '%d = 0 or > 1', (float)$number), (float)$number); |
2104 |
} |
2105 |
return $plurals; |
2106 |
} |
2107 |
|
2108 |
/**
|
2109 |
* category method
|
2110 |
*
|
2111 |
* @return void
|
2112 |
*/
|
2113 |
protected function _category($category = I18n::LC_MONETARY) { |
2114 |
$singular = __c('Plural Rule 1', $category); |
2115 |
return $singular; |
2116 |
} |
2117 |
|
2118 |
/**
|
2119 |
* Singular method
|
2120 |
*
|
2121 |
* @return void
|
2122 |
*/
|
2123 |
protected function _singular() { |
2124 |
$singular = __('Plural Rule 1'); |
2125 |
return $singular; |
2126 |
} |
2127 |
|
2128 |
/**
|
2129 |
* Plural method
|
2130 |
*
|
2131 |
* @param int $upTo For numbers upto (default to 25)
|
2132 |
* @return void
|
2133 |
*/
|
2134 |
protected function _plural($upTo = 25) { |
2135 |
$plurals = array(); |
2136 |
for ($number = 0; $number <= $upTo; $number++) { |
2137 |
$plurals[] = sprintf(__n('%d = 1', '%d = 0 or > 1', (float)$number), (float)$number); |
2138 |
} |
2139 |
return $plurals; |
2140 |
} |
2141 |
|
2142 |
/**
|
2143 |
* singularFromCore method
|
2144 |
*
|
2145 |
* @return void
|
2146 |
*/
|
2147 |
protected function _singularFromCore() { |
2148 |
$singular = __('Plural Rule 1 (from core)'); |
2149 |
return $singular; |
2150 |
} |
2151 |
|
2152 |
/**
|
2153 |
* pluralFromCore method
|
2154 |
*
|
2155 |
* @param int $upTo For numbers upto (default to 25)
|
2156 |
* @return void
|
2157 |
*/
|
2158 |
protected function _pluralFromCore($upTo = 25) { |
2159 |
$plurals = array(); |
2160 |
for ($number = 0; $number <= $upTo; $number++) { |
2161 |
$plurals[] = sprintf(__n('%d = 1 (from core)', '%d = 0 or > 1 (from core)', (float)$number), (float)$number); |
2162 |
} |
2163 |
return $plurals; |
2164 |
} |
2165 |
} |