Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Translation] Fix translator overlapse#46190
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
xavren commentedApr 27, 2022
| Q | A |
|---|---|
| Branch? | 4.4 |
| Bug fix? | yes |
| New feature? | no |
| Deprecations? | no |
| Tickets | Fix#46189 |
| License | MIT |
| Doc PR | symfony/symfony-docs#... |
Uh oh!
There was an error while loading.Please reload this page.
0fcdc41 to5925013Compare
nicolas-grekas left a comment
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.
I'm sorry but this does not make sense to me as MessageCatalog::get() starts with:
if (isset($this->messages[$domain.self::INTL_DOMAIN_SUFFIX][$id])) {return$this->messages[$domain.self::INTL_DOMAIN_SUFFIX][$id]; }
To confirm, I checked out the PR and reverted the patch: tests still pass.
Can you figure out a tests that fails without the patch?
nicolas-grekas commentedJun 19, 2022
@xavren still up to finish this one? Can you figure out a failing test case? |
xavren commentedJun 20, 2022
@nicolas-grekas sorry for the delay, we had some new priorities and forgot to follow this issue. You are right, this is not the issue, but the bug exists as demonstrated by thishttps://github.com/xavren/symfony-translator-bug/blob/master/src/Command/TestCommand.php Code $output->writeln($this->translator->trans('test', ['name' =>'World']));$output->writeln($this->translator->trans('test', ['name' =>'World'],'messages+intl-icu'));$output->writeln($this->translator->trans('test', ['name' =>'World'],'messages')); Result is php bin/console app:testHello %name%Hello %World%Hello %name% It seems that MessageCatalogue loading messages has an issue but cannot spot it and did not find any tests :/ For the debug, here is the cache file var/cache/dev/translations/catalogue.en.bBuRKVV.php <?phpuseSymfony\Component\Translation\MessageCatalogue;$catalogue =newMessageCatalogue('en',array ('messages+intl-icu' =>array ('test' =>'Hello %name%', ),));return$catalogue; |
stof commentedJun 20, 2022
Well, using |
xavren commentedJun 20, 2022
stof commentedJun 20, 2022
@xavren The legacy format replaces whatever you pass as key. so to replace |
xavren commentedJun 20, 2022
@stof, the idea was to show mixup catalogue data, we have legacy data in intl-icu domain, that override intl-icu data, formatted by intlFormatter. |
361394e to44fd6d0Comparestof commentedJun 21, 2022
you should not have legacy data in your intl-icu catalogue. That should go in the non-suffixed catalogue for that domain. Putting legacy data in the catalogue that is meant to contain ICU format will indeed not work, and that's totally expected. |
xavren commentedJun 21, 2022
Hi@stof and@nicolas-grekas, i modified my PR adding tests that demonstrate the issue (hopefully) public function testIntlDomainOverlapseWithIntlResourceBefore() does not pass, because MessageCatalogue is mixing up legacy / intl domains |
44fd6d0 to99ca5f9Compare
nicolas-grekas left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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 issue was likely introduced in#35430
I fixed it, all green. Thanks for the test case.
nicolas-grekas commentedAug 2, 2022
Thank you@xavren. |
