-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Unable to dump multi format translations for same domain #35264
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
Comments
/cc @yceruto |
Hi @deguif, the previous behavior to #34797 is faulty because new translations are dumped into AFAIK, dumping new translations content into both files (at the same time) were never supported. A manual copy/paste/rename actions were required anyway, isn't it? |
$catalogue = new MessageCatalogue($locale);
$dumper = new XliffFileDumper();
foreach ($translations as $key => $value) {
$catalogue->set($key, $value, $domain.$domainSuffix);
}
$dumper->dump($catalogue, [
'path' => $directory,
'xliff_version' => '2.0',
]); Here our simplified code which was dumping the two files (no manual copy/paste/rename) just by varying domains with For more precisions This code was dumping two files (one for |
@yceruto to solve this issue shouldn't the computation (\MessageFormatter class existence and files existence) for the translation domain be moved to the update command in order to add in the catalog the right domain (with icu or no icu suffix) instead of doing the logic in the That would keep the old behaviour working and allows to write multiple formats for same domain with the file dumper as before. |
We're experiencing a similar issue. We have |
@ruudk which would only happen if you also have I don't see the need to keep both files for one project if |
@yceruto That's not the case. I'm converting YAML to PHP, I guess that the PHP dumper only looks for it's own type. I created a POC that demonstrates the bug. This is my code: ruudk/symfony-translation-bug-poc@86c05a6 And this is what happens when I run the command: ruudk/symfony-translation-bug-poc@84290da Hope this helps. |
@ruudk that is expected if don't have the |
What I still don't understand in this issue is why you want to generate the |
Because today we broke production because |
I didn't know about that issue with |
I thought the issue was with the dumper but maybe it’s with the loader not replacing percent placeholders? But on the other hand, it makes sense, because icu has message formatter and that uses So maybe this is a weird circumstance that causes this bug to happen? |
@ruudk thanks for your input, I think you found a bug that has not been reported yet. Could you please create a reproducer for that? It would be better create also a separate issue. Thanks again :) |
If I understand it correctly, the original issue here is a modern project that generates translation files for modern and legacy projects by using the standalone Translation component. So the dumper is unable to generate the legacy ones when the icu is enabled. We should re-think this implementations... |
I will create a separate issue. |
see also #35328 (comment) |
…fix #34713 (yceruto) This PR was squashed before being merged into the 4.4 branch. Discussion ---------- Revert #34797 "Fixed translations file dumper behavior" and fix #34713 | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #35264 | License | MIT | Doc PR | - Revert #34797 See also #35328 It's very likely that the new way will be completely different from this one that is being reverted. That's why I'm reverting rather than fixing it. Commits ------- 9ca8720 Fixed #34713 Move new messages to intl domain when possible 56e79fe Revert "Fixed translations file dumper behavior"
Symfony version(s) affected: 4.4.2
Description
We have a translation process where translations are downloaded from an external service then dumped to translation files.
We have two translation formats (Symfony format and icu) for thousands of translations (legacy were using Symfony format, and new ones are using icu).
These translations once retrieved were dumped with
XliffFileDumper
to two filesmessages.en.xlf
andmessages+intl-icu.en.xlf
(each one supporting a different format).Since #34797 was merged, it is not possible anymore to dump two files for same translation domain but with two different formats (icu and Symfony format). All translations are dumped to the same file
messages+intl-icu.en.xlf
as class\MessageFormatter
exists.The text was updated successfully, but these errors were encountered: