Skip to content
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

[Intl] Fix root fallback locale #31411

Merged
merged 1 commit into from May 8, 2019
Merged

[Intl] Fix root fallback locale #31411

merged 1 commit into from May 8, 2019

Conversation

ro0NL
Copy link
Contributor

@ro0NL ro0NL commented May 7, 2019

Q A
Branch? 3.4
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes (including intl-data group)
Fixed tickets #...
License MIT
Doc PR symfony/symfony-docs#...

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) ro0NL@b9fc8b7
4.3) ro0NL@922a1eb

} catch (MissingResourceException $e) {
$displayFormat = $reader->readEntry($tempDir.'/lang', 'root', ['localeDisplayPattern']);
}
$displayFormat = $reader->readEntry($tempDir.'/lang', $displayLocale, ['localeDisplayPattern']);
Copy link
Contributor Author

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)]));
Copy link
Contributor Author

@ro0NL ro0NL May 7, 2019

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);
Copy link
Contributor Author

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

@fabpot
Copy link
Member

fabpot commented May 8, 2019

Thank you @ro0NL.

@fabpot fabpot merged commit 11ff24a into symfony:3.4 May 8, 2019
fabpot added a commit that referenced this pull request May 8, 2019
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) ro0NL@b9fc8b7
4.3) ro0NL@922a1eb

Commits
-------

11ff24a [Intl] Fix root fallback locale
@ro0NL ro0NL deleted the intl-locale branch May 8, 2019 06:33
This was referenced May 28, 2019
nicolas-grekas added a commit that referenced this pull request May 29, 2019
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants