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

includeContext removes multiple context-group #21

Closed
brokolja opened this issue Apr 5, 2022 · 3 comments
Closed

includeContext removes multiple context-group #21

brokolja opened this issue Apr 5, 2022 · 3 comments
Assignees
Labels
bug Something isn't working question Further information is requested

Comments

@brokolja
Copy link

brokolja commented Apr 5, 2022

First. Thank you for this plugin!!!

I think I found a lil bug. I had the same text to translate in multiple components and noticed that it was only translated in one of the components. It seems angular uses context-groups to translate multiple components. I used "includeContext": true to fix this but found the following even without it.

For example this is the original messages.xlf:

<trans-unit id="1547876271716599756" datatype="html">
        <source>Impressum</source>
        <context-group purpose="location">
          <context context-type="sourcefile">src/app/app-routing.module.ts</context>
          <context context-type="linenumber">12</context>
        </context-group>
        <context-group purpose="location">
          <context context-type="sourcefile">src/app/app.component.html</context>
          <context context-type="linenumber">4</context>
        </context-group>
      </trans-unit>

and this is what the plugin generates:

<trans-unit id="1547876271716599756" datatype="html">
        <context-group purpose="location">
          <context context-type="sourcefile">src/app/app-routing.module.ts</context>
          <context context-type="linenumber">12</context>
        </context-group>
        <source>Impressum</source>
        <target state="translated">Imprint</target>
      </trans-unit>

I would also recommend to set "includeContext": true as default in the plugin if I did not miss anything here.

Thank you!

@daniel-sc daniel-sc self-assigned this Apr 7, 2022
@daniel-sc daniel-sc added the bug Something isn't working label Apr 7, 2022
@daniel-sc
Copy link
Owner

Hi @brokolja

sorry for the late response! I tried to reproduce this and found the following:

  1. The context-groups are not used to "manage" translations in multiple files/occurrences but are purely informational for the translator. So when you apply the i18n attribute correctly to each occurrence, in every place the translation will be used. This is independent of the "includeContext" configuration. (If I'm missing something here, please provide a minimal reproduction - e.g. a git repository with a new angular project where the problem can be reproduced.)
  2. When using "includeContext": true it is actually a bug, that all but one context is missing - I'll provide a fix for this!

Hope that helps!

@daniel-sc daniel-sc added the question Further information is requested label Apr 11, 2022
@daniel-sc
Copy link
Owner

@brokolja can you please check if this (referring to point 2.) is resolved with version 1.2.3?

@brokolja
Copy link
Author

Can't recreate 2. with 1.2.3. 1. is also gone so I guess it was my fault or some magic. Awesome - Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants