简体   繁体   中英

An unhandled exception occurred: Missing required <target> element

I am getting an error with my i18n file in Angular 9:

An unhandled exception occurred: Missing required <target> element

Here is the start of my messages.xlf file:

<?xml version="1.0" encoding="UTF-8" ?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
  <file source-language="en-US" datatype="plaintext" original="ng2.template">
    <body>
      <trans-unit id="63a327955e558b8eb3bf5dc27b5d04920eb9f58d" datatype="html">
        <source>Crop Watch</source>
        <context-group purpose="location">
          <context context-type="sourcefile">src/app/core/app.component.html</context>
          <context context-type="linenumber">3</context>
        </context-group>
      </trans-unit>
      <trans-unit id="2df64767cd895a8fabe3e18b94b5b6b6f9e2e3f0" datatype="html">
        <source>TODAY</source>
        <context-group purpose="location">
          <context context-type="sourcefile">node_modules/@progress/kendo-angular-dateinputs/dist/es2015/calendar/calendar.component.d.ts</context>
          <context context-type="linenumber">4</context>
        </context-group>
        <note priority="1" from="description">The label for the today button in the calendar header</note>
        <note priority="1" from="meaning">kendo.calendar.today</note>
      </trans-unit>
      <trans-unit id="a55944f9de69e7cc86b91200fe96f980a947d704" datatype="html">
        <source>Increase value</source>
        <context-group purpose="location">
          <context context-type="sourcefile">node_modules/@progress/kendo-angular-dateinputs/dist/es2015/dateinput/dateinput.component.d.ts</context>
          <context context-type="linenumber">4</context>
        </context-group>

What I am reading, angular 9 had the property removed from i18n. here is my angular version output:

Angular CLI: 9.0.5
Node: 12.14.1
OS: win32 x64

Angular: 9.0.5
... 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.5
@angular-devkit/build-angular     0.900.5
@angular-devkit/build-optimizer   0.900.5
@angular-devkit/build-webpack     0.900.5
@angular-devkit/core              9.0.5
@angular-devkit/schematics        9.0.5
@angular/cdk                      9.1.1
@angular/material                 9.1.1
@ngtools/webpack                  9.0.5
@schematics/angular               9.0.5
@schematics/update                0.900.5
rxjs                              6.5.4
typescript                        3.7.5
webpack                           4.41.2

Any ideas? Google currently has nothing on this.

Thanks all!

XLIFF is an XML format specifically designed to store translations. What you have at the moment is just the source string (in this case the English string). You also need the translation - but a copy of the source will also do. This is stored in the target element. The app which created the XLIFF may sometimes do this, but it's more often added during the translation process by a app designed for localization.

If you'd like to send on the file I can insert the target element correctly for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM