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

enable whitespace preservation marker in XLIFF files by default #40177

Open
terencehonles opened this issue Dec 17, 2020 · 0 comments
Open

enable whitespace preservation marker in XLIFF files by default #40177

terencehonles opened this issue Dec 17, 2020 · 0 comments
Labels
area: i18n breaking changes P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Milestone

Comments

@terencehonles
Copy link
Contributor

馃悶 bug report

Affected Package

The issue is caused by package @angular/localize / @angular-devkit/build-angular

Is this a regression?

No

Description

Localization files XLF (versions 1 & 2) are XML based and should default to using xml:space="preserve" rather than just allowing a user to specify the flag. There seems to be some concern #38679 (comment) that readers might not support a namespaced attribute, but it's highly likely that a tool is not using a hand rolled XML parser and the attribute would be not cause an error (it may be ignored). Rather than speculate that this might be an error I suggest we change the default and see what breaks. I would imagine nothing would break and I was slightly expecting this not to be the default for some Google internal tooling that possibly messes with the whitespace, but didn't break on the namespaced attribute, but I don't know if Google uses this code path internally.

The xml:space="preserve" attribute probably should also belong on the <target /> and <source /> tags where preserveWhitespace is used

xml.startTag('source', {}, {preserveWhitespace: true});
to allow a user to use an xml formatter to normalize / edit whitespace on the file where it is not relevant.

Finally, while I'm suggesting changes to existing functionality @angular-devkit/build-angular was mentioned because there is no way to specify the formatOptions to the @angular-devkit/build-angular:extract-i18n builder https://github.com/angular/angular-cli/blob/d7494c4d8dfa8f30b36412aab7e5fd1f9f08ac23/packages/angular_devkit/build_angular/src/extract-i18n/index.ts#L67 and I would argue #38737 still hasn't actually been fixed (since only users not using the builder can use the option added). I can open a PR against @angular-devkit/build-angular but I wanted to talk through the default first since if the default is changed I wouldn't need to add an option to the builder (I could add an option to disable the default if this does turn out to be something readers can't understand and users need an escape hatch)

馃實 Your Environment

Angular Version:


Angular CLI: 11.0.4
Node: 15.4.0
OS: linux x64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1100.4
@angular-devkit/build-angular   0.1100.4
@angular-devkit/core            11.0.4
@angular-devkit/schematics      11.0.4
@angular/cdk                    11.0.2
@angular/material               11.0.2
@schematics/angular             11.0.4
@schematics/update              0.1100.4
rxjs                            6.6.3
typescript                      4.0.5

cc: @petebacondarwin continuing from #39654 (comment)

@ngbot ngbot bot added this to the needsTriage milestone Dec 17, 2020
@petebacondarwin petebacondarwin added feature Issue that requests a new feature breaking changes labels Dec 21, 2020
@ngbot ngbot bot modified the milestones: needsTriage, Backlog Dec 21, 2020
@petebacondarwin petebacondarwin added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent and removed feature Issue that requests a new feature labels Dec 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: i18n breaking changes P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

No branches or pull requests

3 participants