enable whitespace preservation marker in XLIFF files by default #40177
Labels
area: i18n
breaking changes
P3
An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Milestone
馃悶 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 wherepreserveWhitespace
is usedangular/packages/localize/src/tools/src/extract/translation_files/xliff2_translation_serializer.ts
Line 78 in 47d9b6d
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:
cc: @petebacondarwin continuing from #39654 (comment)
The text was updated successfully, but these errors were encountered: