[Translation] Add XLIFF 1 source to metadata to differentiate from attr#30472
Merged
fabpot merged 1 commit intosymfony:masterfrom Mar 9, 2019
Merged
[Translation] Add XLIFF 1 source to metadata to differentiate from attr#30472fabpot merged 1 commit intosymfony:masterfrom
fabpot merged 1 commit intosymfony:masterfrom
Conversation
nicolas-grekas
approved these changes
Mar 7, 2019
fabpot
approved these changes
Mar 9, 2019
Member
|
Thank you @ostrolucky. |
fabpot
added a commit
that referenced
this pull request
Mar 9, 2019
…entiate from attr (ostrolucky)
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Translation] Add XLIFF 1 source to metadata to differentiate from attr
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Here's our use case this patch solves:
We have 2 translation files. One is created by developer and has empty `<target>`. Second one is created by translator and has non-empty `<target>`, but same `<source>`.
Now, unlike Symfony fixtures, we also use `resname=` XLIFF1 attribute. This allows us to detect when translation is out of date, which happens when `<source>` in dev translation is changed, but `resname=` is not. As visualization which better illustrates problem:
dev.xlf:
```xml
<trans-unit id="source_is_different" resname="source_is_different">
<source>Welcome to Calida</source>
</trans-unit>
```
real.xlf:
```xml
<trans-unit id="source_is_different" resname="source_is_different">
<source>Welcome to Jacqueline</source>
<target>Willkommen bei Jacqueline</target>
</trans-unit>
```
We need to be able to tell `<source>` for this pair is different (so we prepend alert glyph to translation message, to alert developer something is wrong). In current XliffFileLoader there is no way for consumer to figure out if translation key came from `resname` or `<source>`, so we had to copy whole loader.
Commits
-------
ab04f25 [Translation] Add XLIFF 1 source to metadata to differentiate from attr
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Here's our use case this patch solves:
We have 2 translation files. One is created by developer and has empty
<target>. Second one is created by translator and has non-empty<target>, but same<source>.Now, unlike Symfony fixtures, we also use
resname=XLIFF1 attribute. This allows us to detect when translation is out of date, which happens when<source>in dev translation is changed, butresname=is not. As visualization which better illustrates problem:dev.xlf:
real.xlf:
We need to be able to tell
<source>for this pair is different (so we prepend alert glyph to translation message, to alert developer something is wrong). In current XliffFileLoader there is no way for consumer to figure out if translation key came fromresnameor<source>, so we had to copy whole loader.