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] Add FallbackTrait for data generation #31432

Merged
merged 1 commit into from May 9, 2019

Conversation

Projects
None yet
3 participants
@ro0NL
Copy link
Contributor

commented May 8, 2019

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

This is the last architectural change for the Intl data compilation. Promised.

It fixes de-duplicating a locale from its fallback locale. The problem is it uses a while-loop, comparing the locale to each fallback locale.

Given

  • root (val=A)
    • ur (val=B)
      • ur_IN (val=A)

We have an edge case where a locale (ur_IN) override its fallback locale (ur), setting/restoring the value back to the root locale. This happens for the GMT format in the timezone bundle i know of ... in this case the ur_IN locale needs to write its own value.

The current approach is a while-loop comparing each fallback locale (ur, root) to the current locale (ur_IN). Eventually comparing ur_IN <> root, which causes a wrong diff, as such ur_IN falls back to ur providing the wrong value (val=B, where val=A is expected).

The new approach uses recursion so we only compare ur <> ur_IN, where ur_IN on itself is compared to root.

4.2) ro0NL@e24d8e6
4.3) ro0NL@31591d0

@nicolas-grekas

This comment has been minimized.

Copy link
Member

commented May 9, 2019

Thank you @ro0NL.

@nicolas-grekas nicolas-grekas merged commit 36ddfd5 into symfony:3.4 May 9, 2019

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
fabbot.io Your code looks good.
Details

nicolas-grekas added a commit that referenced this pull request May 9, 2019

minor #31432 [Intl] Add FallbackTrait for data generation (ro0NL)
This PR was merged into the 3.4 branch.

Discussion
----------

[Intl] Add FallbackTrait for data generation

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| 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 -->

This is the last architectural change for the Intl data compilation. Promised.

It fixes de-duplicating a locale from its fallback locale. The problem is it uses a while-loop, comparing the locale to each fallback locale.

Given

- `root` (val=A)
  - `ur` (val=B)
    - `ur_IN` (val=A)

We have an edge case where a locale (ur_IN) override its fallback locale (ur), setting/restoring the value back to the root locale. This happens for the GMT format in the timezone bundle i know of ... in this case the `ur_IN` locale needs to write its own value.

The current approach is a while-loop comparing each fallback locale (ur, root) to the current locale (ur_IN). Eventually comparing `ur_IN <> root`, which causes a wrong diff, as such `ur_IN` falls back to `ur` providing the wrong value (val=B, where val=A is expected).

The new approach uses recursion so we only compare `ur <> ur_IN`, where `ur_IN` on itself is compared to `root`.

4.2) ro0NL@e24d8e6
4.3) ro0NL@31591d0

Commits
-------

36ddfd5 [Intl] Add FallbackTrait for data generation

@ro0NL ro0NL deleted the ro0NL:intl-fallback branch May 9, 2019

nicolas-grekas added a commit that referenced this pull request May 9, 2019

minor #31434 [Intl] Revise timezone name generation (ro0NL)
This PR was merged into the 4.3 branch.

Discussion
----------

 [Intl] Revise timezone name generation

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass?   | yes (inlcluding intl-data group)
| Fixed tickets | #...   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

This is the final polishing needed for #31294 :)

I've realized it's much easier to de-duplicate by processing fallback locales separate, and then only keep the diff compared to a specific locale. More or less the same approach `LocaleDataGenerator` already follows. I was trying to be clever and filter based on inheritance in a single process; bad idea.

Includes ro0NL@31591d0 (ref #31432)

Commits
-------

bfdb4ed [Intl] Revise timezone name generation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.