-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Intl] Fix root fallback locale #31411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
} catch (MissingResourceException $e) { | ||
$displayFormat = $reader->readEntry($tempDir.'/lang', 'root', ['localeDisplayPattern']); | ||
} | ||
$displayFormat = $reader->readEntry($tempDir.'/lang', $displayLocale, ['localeDisplayPattern']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defaulting to root during compile makes things like this more straightforward (the timezone generator in master also benefits)
i've verified it causes no side-effects in 4.2 / master 👍
{ | ||
// Apply generic notation using square brackets as described per http://cldr.unicode.org/translation/language-names | ||
$name = str_replace(['(', ')'], ['[', ']'], $this->languageDataProvider->getName(\Locale::getPrimaryLanguage($locale), $displayLocale)); | ||
$name = str_replace(['(', ')'], ['[', ']'], $reader->readEntry($tempDir.'/lang', $displayLocale, ['Languages', \Locale::getPrimaryLanguage($locale)])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now uses IntlBundleReader
instead of JsonBundleReader
... total compilation time;
3.4
real 1m40.170s
PR
real 0m22.073s
moreover, this allows to keep the generators decoupled
|
||
$config->addBundleWriter($jsonDir, new JsonBundleWriter()); | ||
|
||
echo "Starting resource bundle compilation. This may take a while...\n"; | ||
|
||
$filesystem->remove($workingDirs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is done in each generator already
Thank you @ro0NL. |
This PR was merged into the 3.4 branch. Discussion ---------- [Intl] Fix root fallback locale | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no | Tests pass? | yes (including intl-data group) | Fixed tickets | #... <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> We should never return "root" as a fallback locale for the "root" locale itself. While at it, i realized the alias meta files are pointless :) 4.2) https://github.com/ro0NL/symfony/commit/b9fc8b785773cc38cef86dd0136046234fd77331 4.3) https://github.com/ro0NL/symfony/commit/922a1eb Commits ------- 11ff24a [Intl] Fix root fallback locale
This PR was merged into the 4.3 branch. Discussion ---------- [Intl][4.3] Cleanup internal api | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | #... <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> Forgotten in #31411 (comment) Commits ------- 6eab5d2 [Intl][4.3] Cleanup internal api
We should never return "root" as a fallback locale for the "root" locale itself.
While at it, i realized the alias meta files are pointless :)
4.2) https://github.com/ro0NL/symfony/commit/b9fc8b785773cc38cef86dd0136046234fd77331
4.3) https://github.com/ro0NL/symfony/commit/922a1eb