@@ -45,7 +45,7 @@ public function testTransWithoutCaching()
45
45
{
46
46
$ translator = $ this ->getTranslator ($ this ->getLoader ());
47
47
$ translator ->setLocale ('fr ' );
48
- $ translator ->setFallbackLocales (array ('en ' , 'es ' , 'pt-PT ' , 'pt_BR ' , 'fr.UTF-8 ' ));
48
+ $ translator ->setFallbackLocales (array ('en ' , 'es ' , 'pt-PT ' , 'pt_BR ' , 'fr.UTF-8 ' , ' sr@latin ' ));
49
49
50
50
$ this ->assertEquals ('foo (FR) ' , $ translator ->trans ('foo ' ));
51
51
$ this ->assertEquals ('bar (EN) ' , $ translator ->trans ('bar ' ));
@@ -55,14 +55,15 @@ public function testTransWithoutCaching()
55
55
$ this ->assertEquals ('foobarfoo (PT-PT) ' , $ translator ->trans ('foobarfoo ' ));
56
56
$ this ->assertEquals ('other choice 1 (PT-BR) ' , $ translator ->transChoice ('other choice ' , 1 ));
57
57
$ this ->assertEquals ('foobarbaz (fr.UTF-8) ' , $ translator ->trans ('foobarbaz ' ));
58
+ $ this ->assertEquals ('foobarbax (sr@latin) ' , $ translator ->trans ('foobarbax ' ));
58
59
}
59
60
60
61
public function testTransWithCaching ()
61
62
{
62
63
// prime the cache
63
64
$ translator = $ this ->getTranslator ($ this ->getLoader (), array ('cache_dir ' => $ this ->tmpDir ));
64
65
$ translator ->setLocale ('fr ' );
65
- $ translator ->setFallbackLocales (array ('en ' , 'es ' , 'pt-PT ' , 'pt_BR ' , 'fr.UTF-8 ' ));
66
+ $ translator ->setFallbackLocales (array ('en ' , 'es ' , 'pt-PT ' , 'pt_BR ' , 'fr.UTF-8 ' , ' sr@latin ' ));
66
67
67
68
$ this ->assertEquals ('foo (FR) ' , $ translator ->trans ('foo ' ));
68
69
$ this ->assertEquals ('bar (EN) ' , $ translator ->trans ('bar ' ));
@@ -72,12 +73,13 @@ public function testTransWithCaching()
72
73
$ this ->assertEquals ('foobarfoo (PT-PT) ' , $ translator ->trans ('foobarfoo ' ));
73
74
$ this ->assertEquals ('other choice 1 (PT-BR) ' , $ translator ->transChoice ('other choice ' , 1 ));
74
75
$ this ->assertEquals ('foobarbaz (fr.UTF-8) ' , $ translator ->trans ('foobarbaz ' ));
76
+ $ this ->assertEquals ('foobarbax (sr@latin) ' , $ translator ->trans ('foobarbax ' ));
75
77
76
78
// do it another time as the cache is primed now
77
79
$ loader = $ this ->getMock ('Symfony\Component\Translation\Loader\LoaderInterface ' );
78
80
$ translator = $ this ->getTranslator ($ loader , array ('cache_dir ' => $ this ->tmpDir ));
79
81
$ translator ->setLocale ('fr ' );
80
- $ translator ->setFallbackLocales (array ('en ' , 'es ' , 'pt-PT ' , 'pt_BR ' , 'fr.UTF-8 ' ));
82
+ $ translator ->setFallbackLocales (array ('en ' , 'es ' , 'pt-PT ' , 'pt_BR ' , 'fr.UTF-8 ' , ' sr@latin ' ));
81
83
82
84
$ this ->assertEquals ('foo (FR) ' , $ translator ->trans ('foo ' ));
83
85
$ this ->assertEquals ('bar (EN) ' , $ translator ->trans ('bar ' ));
@@ -87,6 +89,7 @@ public function testTransWithCaching()
87
89
$ this ->assertEquals ('foobarfoo (PT-PT) ' , $ translator ->trans ('foobarfoo ' ));
88
90
$ this ->assertEquals ('other choice 1 (PT-BR) ' , $ translator ->transChoice ('other choice ' , 1 ));
89
91
$ this ->assertEquals ('foobarbaz (fr.UTF-8) ' , $ translator ->trans ('foobarbaz ' ));
92
+ $ this ->assertEquals ('foobarbax (sr@latin) ' , $ translator ->trans ('foobarbax ' ));
90
93
}
91
94
92
95
public function testGetLocale ()
@@ -185,6 +188,13 @@ protected function getLoader()
185
188
'foobarbaz ' => 'foobarbaz (fr.UTF-8) ' ,
186
189
))))
187
190
;
191
+ $ loader
192
+ ->expects ($ this ->at (6 ))
193
+ ->method ('load ' )
194
+ ->will ($ this ->returnValue ($ this ->getCatalogue ('sr@latin ' , array (
195
+ 'foobarbax ' => 'foobarbax (sr@latin) ' ,
196
+ ))))
197
+ ;
188
198
189
199
return $ loader ;
190
200
}
@@ -216,6 +226,7 @@ public function getTranslator($loader, $options = array())
216
226
$ translator ->addResource ('loader ' , 'foo ' , 'pt-PT ' ); // European Portuguese
217
227
$ translator ->addResource ('loader ' , 'foo ' , 'pt_BR ' ); // Brazilian Portuguese
218
228
$ translator ->addResource ('loader ' , 'foo ' , 'fr.UTF-8 ' );
229
+ $ translator ->addResource ('loader ' , 'foo ' , 'sr@latin ' ); // Latin Serbian
219
230
220
231
return $ translator ;
221
232
}
0 commit comments