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)
8888 return $ this ->translator ->getCatalogue ($ locale );
8989 }
9090
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+
91105 /**
92106 * Passes through all unknown calls onto the translator object.
93107 */
Original file line number Diff line number Diff line change @@ -88,6 +88,20 @@ public function getCatalogue($locale = null)
8888 return $ this ->translator ->getCatalogue ($ locale );
8989 }
9090
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+
91105 /**
92106 * Passes through all unknown calls onto the translator object.
93107 */
Original file line number Diff line number Diff line change @@ -273,6 +273,16 @@ public function testWhenAResourceHasNoRegisteredLoader()
273273 $ translator ->trans ('foo ' );
274274 }
275275
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+
276286 public function testFallbackCatalogueResources ()
277287 {
278288 $ translator = new Translator ('en_GB ' , new MessageSelector ());
Original file line number Diff line number Diff line change @@ -159,7 +159,7 @@ public function getLocale()
159159 *
160160 * @throws \InvalidArgumentException If a locale contains invalid characters
161161 *
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
163163 */
164164 public function setFallbackLocale ($ locales )
165165 {
@@ -424,7 +424,7 @@ private function loadFallbackCatalogues($locale)
424424
425425 foreach ($ this ->computeFallbackLocales ($ locale ) as $ fallback ) {
426426 if (!isset ($ this ->catalogues [$ fallback ])) {
427- $ this ->doLoadCatalogue ($ fallback );
427+ $ this ->loadCatalogue ($ fallback );
428428 }
429429
430430 $ fallbackCatalogue = new MessageCatalogue ($ fallback , $ this ->catalogues [$ fallback ]->all ());
You can’t perform that action at this time.
0 commit comments