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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

whitespace is included in trans-unit id #34147

Closed
jakob-bebop opened this issue Nov 29, 2019 · 3 comments
Closed

whitespace is included in trans-unit id #34147

jakob-bebop opened this issue Nov 29, 2019 · 3 comments

Comments

@jakob-bebop
Copy link

@jakob-bebop jakob-bebop commented Nov 29, 2019

馃悶 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • xi18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes, the previous version in which this bug was not present was: ....

This has never been a problem before; I think it has surfaced because Prettier has started intruducing whitespace into i18n attribute values

see
prettier/prettier@4e46f92

Description

A clear and concise description of the problem...

In a template, the

i18n="description  | name@@id" 

syntax can be used to fix the id of the translation unit. If for some reason (e.g. using Prettier) the template code is changed to

i18n="
    description  | name@@id
" 

the id in the resulting messages.xlf file now includes the trailing whitespace. This
messes up the subsequent xliffmerge run. Also sometimes we get duplicate trans-units
(whose id's differ by whitespace only)

馃敩 Minimal Reproduction

  • generate a project with

      ng new i18n-app
    
  • add a whitespace-id'ed tag to the app template, and look at the resulting messages file (two instances of sillyId!)

      cd i18n-app
      echo '<p i18n="name| @@sillyId ">silly test</p>' >> src/app/app.component.html
      echo '<p i18n="name| @@sillyId">silly test</p>' >> src/app/app.component.html
      ng xi18n
      grep sillyId messages.xlf
    

馃敟 Exception or Error





馃實 Your Environment




Angular CLI: 8.3.20
Node: 10.13.0
OS: linux x64
Angular: 8.2.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.20
@angular-devkit/build-angular     0.803.20
@angular-devkit/build-optimizer   0.803.20
@angular-devkit/build-webpack     0.803.20
@angular-devkit/core              8.3.20
@angular-devkit/schematics        8.3.20
@angular/cli                      8.3.20
@ngtools/webpack                  8.3.20
@schematics/angular               8.3.20
@schematics/update                0.803.20
rxjs                              6.4.0
typescript                        3.5.3
webpack                           4.39.2

Anything else relevant?

@petebacondarwin petebacondarwin transferred this issue from angular/angular-cli Nov 29, 2019
@petebacondarwin

This comment has been minimized.

Copy link
Member

@petebacondarwin petebacondarwin commented Nov 29, 2019

I transferred this issue here because the i18n extraction code is here.

@petebacondarwin

This comment has been minimized.

Copy link
Member

@petebacondarwin petebacondarwin commented Nov 29, 2019

Should be a fairly simple fix.

petebacondarwin added a commit to petebacondarwin/angular that referenced this issue Nov 29, 2019
petebacondarwin added a commit to petebacondarwin/angular that referenced this issue Dec 2, 2019
petebacondarwin added a commit to petebacondarwin/angular that referenced this issue Dec 2, 2019
petebacondarwin added a commit to petebacondarwin/angular that referenced this issue Dec 2, 2019
petebacondarwin added a commit to petebacondarwin/angular that referenced this issue Dec 3, 2019
@mhevery mhevery closed this in f6a6f26 Dec 3, 2019
@angular-automatic-lock-bot

This comment has been minimized.

Copy link

@angular-automatic-lock-bot angular-automatic-lock-bot bot commented Jan 3, 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 Jan 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can鈥檛 perform that action at this time.