Fix inconsistent RTL currency formatting for Arabic locales (MAD, EGP, he_IL) and normalize unit tests across ICU versions #40311
+78
−84
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description (*)
This PR fixes inconsistent currency formatting for several RTL locales such as
ar_MA,ar_EG, andhe_IL.Historically, ICU versions behaved differently when rendering RTL currency formats, especially around:
\u00A0)\u200F)Older Magento tests included conditional expectations to support multiple ICU versions.
However, recent ICU releases have stabilized currency symbol data for Arabic locales, meaning:
%s <symbol>)This PR aligns unit tests with the actual stable behavior of Symfony Intl + Magento’s custom logic.
The fixes ensure consistent results across all PHP/ICU combinations used in CI and customer environments.
Why this change is needed
This PR provides stable, deterministic, cross-environment expectations.
What has been changed
\u00A0) and RTL mark (\u200F) where appropriate.NumberFormatter+ Magento logic.Manual testing scenarios (*)
ar_MA, loadMAD, format value3Expected:
3,00 د.م.(orد.م. 3,00depending on formatter direction, but stable symbol)ar_EG, loadEGP, format value3Expected:
3,00 ج.م.he_IL, loadUSD, format value9999Expected: RTL-correct
$position with NBSP.All tests must pass consistently.
Additional context for reviewers
Arabic currency symbols are stable in ICU:
MAD→ د.م.EGP→ ج.م.Magento uses its own pattern, not ICU’s RTL rules:
So changes in ICU bidi algorithms do NOT affect the expected test results.
The updated tests reflect what Magento actually does, not historical ICU side effects.
Contribution checklist (*)