Skip to content
Browse files

[Translation] Added search to FallbackLocale Catalogue.

When the current locale catalogue doesn't contain the id searched, the code doesn't search in the fallbacklocale catalogue (as is explained in the documentation).
Added the search to the fallbacklocale catalogue to the translation function.
  • Loading branch information...
1 parent fb00539 commit b6049beca235eece6466d6ec612b3d11cb5c788e cgonzalez committed Feb 24, 2011
Showing with 9 additions and 0 deletions.
  1. +9 −0 src/Symfony/Component/Translation/Translator.php
View
9 src/Symfony/Component/Translation/Translator.php
@@ -112,6 +112,15 @@ public function trans($id, array $parameters = array(), $domain = 'messages', $l
$this->loadCatalogue($locale);
}
+ if(!$this->catalogues[$locale]->has($id, $domain)) {
+
+ $locale = $this->fallbackLocale;
+
+ if (!isset($this->catalogues[$locale])) {
+ $this->loadCatalogue($locale);
+ }
+ }
+
return strtr($this->catalogues[$locale]->get($id, $domain), $parameters);
}

0 comments on commit b6049be

Please sign in to comment.
Something went wrong with that request. Please try again.