Skip to content

[Translator] fix handling plural for floating numbers #39887

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

Merged
merged 1 commit into from
Jan 26, 2021

Conversation

kylekatarnls
Copy link
Contributor

Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #30215
License MIT

@carsonbot
Copy link

Hey!

I did a quick review of this PR, I think most things looks good.

To help keep things organized, we don't allow "Draft" pull requests. Could you please click the "ready for review" button or close this PR and open a new one when you are done?

Note that a pull request does not have to be "perfect" or "ready for merge" when you first open it. We just want it to be ready for a first review.

Cheers!

Carsonbot

@kylekatarnls kylekatarnls changed the title Add test to show #30215 issue [Translator] Add test to show #30215 issue Jan 18, 2021
@kylekatarnls kylekatarnls changed the title [Translator] Add test to show #30215 issue [Translator] Fix #30215 handle plural for floating numbers Jan 18, 2021
@kylekatarnls kylekatarnls marked this pull request as ready for review January 18, 2021 22:55
@carsonbot carsonbot added this to the 4.4 milestone Jan 18, 2021
@carsonbot carsonbot changed the title [Translator] Fix #30215 handle plural for floating numbers [Translator] Fix #30215 handle plural for floating numbers Jan 18, 2021
@kylekatarnls
Copy link
Contributor Author

kylekatarnls commented Jan 19, 2021

If I have time this week, I'll also check negative numbers and add tests for them.

✔️ done

@nicolas-grekas nicolas-grekas changed the title [Translator] Fix #30215 handle plural for floating numbers [Translator] handle plural for floating numbers Jan 19, 2021
@nicolas-grekas nicolas-grekas changed the title [Translator] handle plural for floating numbers [Translator] fix plural for floating numbers Jan 19, 2021
@nicolas-grekas nicolas-grekas changed the title [Translator] fix plural for floating numbers [Translator] fix handling plural for floating numbers Jan 19, 2021
@nicolas-grekas nicolas-grekas dismissed their stale review January 19, 2021 13:46

(tests are failing)

@kylekatarnls
Copy link
Contributor Author

Hum, as a first sight, I can't tell how the test output could be different from PHP 7.1 and 8 while 7.4 succeed in between.

@jderusse
Copy link
Member

Hum, as a first sight, I can't tell how the test output could be different from PHP 7.1 and 8 while 7.4 succeed in between.

The Symfony test suites are very complexe and does not perform the same thing. ie. One of the tests suite tries each component with the minimal requirements version. Another tries the previous version of the component with dependencies patched with your PR.
That's why some passed and other failed. You have to make all of theme green ;-)

@kylekatarnls
Copy link
Contributor Author

Depending on the version we either fall into PluralizationRules.php or into TranslatorTrait.php, I hope we can soon get rid of this duplicated code 😸 Now both are fixed.

@kylekatarnls
Copy link
Contributor Author

AppVeyor failure is clearly unrelated:

Fatal error: Interface 'Symfony\Contracts\Service\ResetInterface' not found

@kylekatarnls
Copy link
Contributor Author

kylekatarnls commented Jan 21, 2021

👋 @nicolas-grekas would you mind to review the new changes $number = abs($number) to also handle negative numbers properly.

@nicolas-grekas
Copy link
Member

Thank you @kylekatarnls.

@nicolas-grekas nicolas-grekas merged commit 4b8983a into symfony:4.4 Jan 26, 2021
This was referenced Jan 27, 2021
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.

6 participants