Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Xliff1TranslationParser does not handle multiple <file> elementsΒ #35839

Closed
@kamilchlebek

Description

@kamilchlebek

🐞 bug report

Affected Package

The issue is caused by package @angular/localize

Is this a regression?

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

Description

this.bundle = {
locale: getAttribute(element, 'target-language'),
translations: XliffTranslationVisitor.extractTranslations(element)
};

Xliff1TranslationParser assumes there's only one <file> element in .xlf file. When there's more of them, the this.bundle is overridden.

Usually it's true for extracted files, but somehow in our app we managed to generate file with few <file> attributes (it may be related to xliffmerge, but happened only for one language so far).

However while using angular 8 it used to work without any issues. While building the app using angular 9 we get warnings: No translation found for "<<id>>" ("<<msg>>"). Resulting in missing translations.

Would be good if Angular 9 either support multiple <files> or throw an exception so we can see the cause easily.

πŸ”¬ Minimal Reproduction

https://github.com/kamilchlebek/angular-xliff-issue

Steps:

  1. ng build --localize

πŸ”₯ Exception or Error

No translation found for "5085648050787544850" ("child works!").
...

🌍 Your Environment

Angular Version:

Angular CLI: 9.0.4
Node: 10.16.0
OS: linux x64

Angular: 9.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.900.4
@angular-devkit/build-angular     0.900.4
@angular-devkit/build-optimizer   0.900.4
@angular-devkit/build-webpack     0.900.4
@angular-devkit/core              9.0.4
@angular-devkit/schematics        9.0.4
@ngtools/webpack                  9.0.4
@schematics/angular               9.0.4
@schematics/update                0.900.4
rxjs                              6.5.4
typescript                        3.7.5
webpack                           4.41.2

Metadata

Metadata

Labels

area: i18nIssues related to localization and internationalization

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions