File tree Expand file tree Collapse file tree 4 files changed +40
-2
lines changed Expand file tree Collapse file tree 4 files changed +40
-2
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,20 @@ public function getCatalogue($locale = null)
88
88
return $ this ->translator ->getCatalogue ($ locale );
89
89
}
90
90
91
+ /**
92
+ * Gets the fallback locales.
93
+ *
94
+ * @return array $locales The fallback locales
95
+ */
96
+ public function getFallbackLocales ()
97
+ {
98
+ if ($ this ->translator instanceof Translator) {
99
+ return $ this ->translator ->getFallbackLocales ();
100
+ }
101
+
102
+ return array ();
103
+ }
104
+
91
105
/**
92
106
* Passes through all unknown calls onto the translator object.
93
107
*/
Original file line number Diff line number Diff line change @@ -88,6 +88,20 @@ public function getCatalogue($locale = null)
88
88
return $ this ->translator ->getCatalogue ($ locale );
89
89
}
90
90
91
+ /**
92
+ * Gets the fallback locales.
93
+ *
94
+ * @return array $locales The fallback locales
95
+ */
96
+ public function getFallbackLocales ()
97
+ {
98
+ if ($ this ->translator instanceof Translator) {
99
+ return $ this ->translator ->getFallbackLocales ();
100
+ }
101
+
102
+ return array ();
103
+ }
104
+
91
105
/**
92
106
* Passes through all unknown calls onto the translator object.
93
107
*/
Original file line number Diff line number Diff line change @@ -273,6 +273,16 @@ public function testWhenAResourceHasNoRegisteredLoader()
273
273
$ translator ->trans ('foo ' );
274
274
}
275
275
276
+ public function testNestedFallbackCatalogueWhenUsingMultipleLocales ()
277
+ {
278
+ $ translator = new Translator ('fr ' );
279
+ $ translator ->setFallbackLocales (array ('ru ' , 'en ' ));
280
+
281
+ $ translator ->getCatalogue ('fr ' );
282
+
283
+ $ this ->assertNotNull ($ translator ->getCatalogue ('ru ' )->getFallbackCatalogue ());
284
+ }
285
+
276
286
public function testFallbackCatalogueResources ()
277
287
{
278
288
$ translator = new Translator ('en_GB ' , new MessageSelector ());
Original file line number Diff line number Diff line change @@ -159,7 +159,7 @@ public function getLocale()
159
159
*
160
160
* @throws \InvalidArgumentException If a locale contains invalid characters
161
161
*
162
- * @deprecated since version 2.3, to be removed in 3.0. Use setFallbackLocales() instead.
162
+ * @deprecated since version 2.3, to be removed in 3.0. Use setFallbackLocales() instead
163
163
*/
164
164
public function setFallbackLocale ($ locales )
165
165
{
@@ -424,7 +424,7 @@ private function loadFallbackCatalogues($locale)
424
424
425
425
foreach ($ this ->computeFallbackLocales ($ locale ) as $ fallback ) {
426
426
if (!isset ($ this ->catalogues [$ fallback ])) {
427
- $ this ->doLoadCatalogue ($ fallback );
427
+ $ this ->loadCatalogue ($ fallback );
428
428
}
429
429
430
430
$ fallbackCatalogue = new MessageCatalogue ($ fallback , $ this ->catalogues [$ fallback ]->all ());
You can’t perform that action at this time.
0 commit comments