Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit78e6fc4

Browse files
bug#37449 [Translation] Fix caching of parent locales file in translator (jvasseur)
This PR was merged into the 4.4 branch.Discussion----------[Translation] Fix caching of parent locales file in translator| Q | A| ------------- | ---| Branch? | 4.4 (this is the lowest maintained branch with this code)| Bug fix? | yes| New feature? | no <!-- please update src/**/CHANGELOG.md files -->| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tickets || License | MIT| Doc PR |The `parentLocales` property was probably meant as a cache for the content of the `parents.json` file but instead the content is stored in a local variable and the property stays `null`. This means the file is read on each call to `computeFallbackLocales`.This PR update the code to what was probably meant to be.(Ref#28070)Commits-------02c9ac6 Fix caching of parent locales file in translator
2 parentsf194602 +02c9ac6 commit78e6fc4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎src/Symfony/Component/Translation/Translator.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ private function loadFallbackCatalogues(string $locale): void
460460
protectedfunctioncomputeFallbackLocales($locale)
461461
{
462462
if (null ===$this->parentLocales) {
463-
$parentLocales =json_decode(file_get_contents(__DIR__.'/Resources/data/parents.json'),true);
463+
$this->parentLocales =json_decode(file_get_contents(__DIR__.'/Resources/data/parents.json'),true);
464464
}
465465

466466
$locales = [];
@@ -473,7 +473,7 @@ protected function computeFallbackLocales($locale)
473473
}
474474

475475
while ($locale) {
476-
$parent =$parentLocales[$locale] ??null;
476+
$parent =$this->parentLocales[$locale] ??null;
477477

478478
if ($parent) {
479479
$locale ='root' !==$parent ?$parent :null;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp