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

Extractor no longer extracts the location if i18n is without parameters #38705

Closed
jaska45 opened this issue Sep 4, 2020 · 2 comments
Closed

Extractor no longer extracts the location if i18n is without parameters #38705

jaska45 opened this issue Sep 4, 2020 · 2 comments

Comments

@jaska45
Copy link

@jaska45 jaska45 commented Sep 4, 2020

🐞 bug report

First of all, congratuliations for Angular 10.1, It finally complated the I18N features and you now can localize templates and the source code. I wrote an API that enables loading the translations on runtime that you can use to create a single deployment that can serve any number of languages.

Then for the bug I found in 10.1.0.

Is this a regression?

Yes. This used to work in Angular 10.

Description

If you use i18n attribute without any parameter (i.e. meaning or comment) the extractor tool does not extract location.

🔬 Minimal Reproduction

You can find a repo here.

Use this template

<p i18n>This is a sample</p>
<p i18n="Comment">This is a sample with a comment</p>

Run XLIFF 2,0 extraction.

ng xi18n --format=xlf2 --output-path src/locale --ivy

You will get the following XLIFF

<?xml version="1.0" encoding="UTF-8" ?>
<xliff version="2.0" xmlns="urn:oasis:names:tc:xliff:document:2.0" srcLang="en-US">
  <file id="ngi18n" original="ng.template">
    <unit id="3067469718492071419">
      <segment>
        <source>This is a sample</source>
      </segment>
    </unit>
    <unit id="5855772298569654559">
      <notes>
        <note category="location">src/app/app.component.js:23</note>
        <note category="description">Comment</note>
      </notes>
      <segment>
        <source>This is a sample with a comment</source>
      </segment>
    </unit>
  </file>
</xliff>

The first unit is without location note!

🌍 Your Environment

Angular Version:

Angular CLI: 10.1.0
Node: 12.9.1
OS: win32 x64

Angular: 10.1.0
... animations, cli, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.1001.0
@angular-devkit/build-angular     0.1001.0
@angular-devkit/build-optimizer   0.1001.0
@angular-devkit/build-webpack     0.1001.0
@angular-devkit/core              10.1.0
@angular-devkit/schematics        10.1.0
@ngtools/webpack                  10.1.0
@schematics/angular               10.1.0
@schematics/update                0.1001.0
rxjs                              6.6.2
typescript                        4.0.2
webpack                           4.44.1
@jaska45 jaska45 changed the title Extractor no longer extract location if i18n is without parameters Extractor no longer extracts the location if i18n is without parameters Sep 4, 2020
@ngbot ngbot bot added this to the needsTriage milestone Sep 4, 2020
@petebacondarwin
Copy link
Member

@petebacondarwin petebacondarwin commented Sep 4, 2020

I'll investigate this today.

petebacondarwin added a commit to petebacondarwin/angular that referenced this issue Sep 4, 2020
Previously, the location of a translation message, in XLIFF 2, was only
rendered if there were also notes for meaning or description. Now the
location will be rendered even if the other metadata is not provided.

Fixes angular#38705
petebacondarwin added a commit to petebacondarwin/angular that referenced this issue Sep 4, 2020
Previously, the location of a translation message, in XLIFF 2, was only
rendered if there were also notes for meaning or description. Now the
location will be rendered even if the other metadata is not provided.

Fixes angular#38705
atscott added a commit that referenced this issue Sep 8, 2020
#38713)

Previously, the location of a translation message, in XLIFF 2, was only
rendered if there were also notes for meaning or description. Now the
location will be rendered even if the other metadata is not provided.

Fixes #38705

PR Close #38713
@angular-automatic-lock-bot
Copy link

@angular-automatic-lock-bot angular-automatic-lock-bot bot commented Oct 9, 2020

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Oct 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants