-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Incorrect XLIFF documents #20076
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
How would you know which string to put into the source element if the translation functions have been called with an identifier, but not with a sentence to be translated? |
A workflow we use:
So there are two distinct steps in the process:
Copywriting is very dependent on the project workflow. If that step needs to be compliant with CAT tools the
What happens here is actually not important at all. The original text for an element is almost never sent to external vendors to be copywrited. @xabbuh Whatever you use in Symfony to handle step to get key -> text doesn't matter. Translating contents it's what core to this issue. Translation vendors need a standard compliant XLIFF files to properly handle the translation. So when handling different locales it's key that the Handling XLIFF files from Symfony has always been an issue for us due to the non-standard use of the The minimal change we would love to have is that the generator/update tasks for translations can have an output where the Even if not the default, we can always ask clients to provide us with "proper" XLIFF files if Symfo 8000 ny has mechanisms to generate and use them. |
I suppose you would call the translation function for the source/default language to get the original string. |
Looking at the code XliffFileDumper.php#L85, it looks like this is the current behavior:
As others have said, this is an unusual XLIFF construction that won't be supported well by many tools, which expect to be able to use the
The other issue I noticed is that currently the message value data is enclosed in a CDATA section if it includes any of I can put together a pull request along these lines if there's interest. |
AFAIR, If you set the target to blank, this will be the translation used by symfony. So It should be set to source. |
Good point, thank you @mvrhov. |
IMO when you want to have some original text in this place you need to pass text and not IDs to the @symfony/deciders What do you think? |
…ere's no target (thewilkybarkid) This PR was merged into the 2.8 branch. Discussion ---------- [Translation] Use XLIFF source rather than resname when there's no target | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Relates to #20076 (comment). If there's no `<target>` in an 8179 XLIFF but there is a `@resname` then that's used rather than the `<source>`. If I'm using translation keys and my source locale is `en`, then it's a bit redundant to duplicate the `<source>` in the `<target>` in the `en` file (since there is no translation). This isn't changing the behaviour when `<target>` is present but empty. (Caveat: I'm definitely not an expert on XLIFF.) Commits ------- 8633ebb Use XLIFF source rather than resname when there's no target
I agree with the latest comment from @xabbuh. This is also one of the "best practices" recommended by Symfony about i18n: https://symfony.com/doc/current/best_practices/i18n.html#translation-keys Including the original content in all translation files may look convenient at first ... but if you have several translation files, it's cumbersome ... because whenever you want to tweak the original translation content, you need to change both the templates and all the translation files. Using translation keys means that you only have to change 1 file, the one corresponding to the "translation" of the main language. So, let's close this one. Thanks. |
It seems the XLIFF documents generated by Symfony, whether 1.2 or the new 2.0 are not using the
<source>
element correctly. It is meant to hold the original text to translate, But in the Symfony files it is used to place some ID (andresname
can be used to store the ID).For example:
Should be:
It's OK to have the original text in
<target>
when creating the file, but not putting it in<source>
makes those XLIFF documents pretty much not usable with most translation tools.The text was updated successfully, but these errors were encountered: