Skip to content
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

[Translation] Add XLIFF 1 source to metadata to differentiate from attr #30472

Merged
merged 1 commit into from Mar 9, 2019

Conversation

Projects
None yet
4 participants
@ostrolucky
Copy link
Contributor

commented Mar 7, 2019

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:

<trans-unit id="source_is_different" resname="source_is_different">
    <source>Welcome to Calida</source>
</trans-unit>

real.xlf:

<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.

@fabpot

fabpot approved these changes Mar 9, 2019

@fabpot

This comment has been minimized.

Copy link
Member

commented Mar 9, 2019

Thank you @ostrolucky.

@fabpot fabpot merged commit ab04f25 into symfony:master Mar 9, 2019

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
fabbot.io Your code looks good.
Details

fabpot added a commit that referenced this pull request Mar 9, 2019

feature #30472 [Translation] Add XLIFF 1 source to metadata to differ…
…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

@nicolas-grekas nicolas-grekas modified the milestones: next, 4.3 Apr 30, 2019

@fabpot fabpot referenced this pull request May 9, 2019

Merged

Release v4.3.0-BETA1 #31435

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.