Describe the bug
After a Pull Request where the XLIFF File was formatted, I got a strange Error message when running ng extract-i18n:
An unhandled exception occurred: Cannot read properties of undefined (reading 'val')
See "/private/var/folders/kd/__0vzmb92fd1f2_k_kxvyrmc0000gn/T/ng-gwLO3C/angular-errors.log" for further details.
and in the angular-errors.log file:
[error] TypeError: Cannot read properties of undefined (reading 'val')
at /Users/floisloading/Workspace/my-frontend/node_modules/ng-extract-i18n-merge/dist/src/model/translationFileSerialization.js:81:98
at Array.map (<anonymous>)
at /Users/floisloading/Workspace/my-frontend/node_modules/ng-extract-i18n-merge/dist/src/model/translationFileSerialization.js:79:18
at Array.map (<anonymous>)
at fromXlf1 (/Users/floisloading/Workspace/my-frontend/node_modules/ng-extract-i18n-merge/dist/src/model/translationFileSerialization.js:67:10)
at fromXlf (/Users/floisloading/Workspace/my-frontend/node_modules/ng-extract-i18n-merge/dist/src/builder.js:78:129)
at /Users/floisloading/Workspace/my-frontend/node_modules/ng-extract-i18n-merge/dist/src/builder.js:97:47
at Generator.next (<anonymous>)
at fulfilled (/Users/floisloading/Workspace/my-frontend/node_modules/ng-extract-i18n-merge/dist/src/builder.js:5:58)
After investigating I found out that both messages.xlf and messages.en.xlf were missing one <context context-type="linenumber"></context> inside one single <context-group>. It got accidentially removed while merging.
In messages.xlf, this works:
<trans-unit id="8a43db3f950c8e283488f48553c494bbac00ab80" datatype="html">
<source>Über das Programm</source>
<note priority="1" from="description">Headline of main info on program detail page</note>
<context-group purpose="location">
<context context-type="sourcefile">src/app/program/program-main-info/program-main-info.component.html</context>
<context context-type="linenumber">8</context>
</context-group>
</trans-unit>
while this doesn't:
<trans-unit id="8a43db3f950c8e283488f48553c494bbac00ab80" datatype="html">
<source>Über das Programm</source>
<note priority="1" from="description">Headline of main info on program detail page</note>
<context-group purpose="location">
<context context-type="sourcefile">src/app/program/program-main-info/program-main-info.component.html</context>
</context-group>
</trans-unit>
Describe the bug After a Pull Request where the XLIFF File was formatted, I got a strange Error message when running
ng extract-i18n
:and in the
angular-errors.log
file:After investigating I found out that both
messages.xlf
andmessages.en.xlf
were missing one<context context-type="linenumber"></context>
inside one single<context-group>
. It got accidentially removed while merging.In
messages.xlf
, this works:while this doesn't:
Setup/Configuration
Expected behavior
context
Tag should be extracted from the source codeScreenshots none
Version:
Additional information: Source language is
de