You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Being new to Angular, I was testing I18n functionalities following the official guide and was comparing XLIFF 1.2 and XLIFF 2.0.
I'm submitting a...
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:
Current behavior
Expected behavior
The app home page requires two translations.
Using XLIFF 1.2 file with ng serve --configuration=fr-1.2 runs without error as showned in the official guide. However running using XLIFF 2.0 file with ng serve --configuration=fr-2.0 triggered warning:
Missing translation for message "homepage.title"
Missing translation for message "homepage.sentence"
Obviously, changing the i18nMissingTranslation from warning to error triggers a similar error:
ERROR in Missing translation for message "homepage_title" ("
</div>
<h2 i18n="@@homepage_title">[ERROR ->]Title</h2>
<p i18n="@@homepage_sentence">This is a sentence</p>
"): [...]/angular-i18n/src/app/app.component.html@8:28
Minimal reproduction of the problem with instructions
Short version
Stackblitz does not support .xlf file but source code is available at https://github.com/Xsylum/angular-i18n. Use ng serve --configuration=fr-2.0 to trigger the warning.
Description
The two required translations are:
app.component.html
<h2i18n="@@homepage.title">Title</h2><pi18n="@@homepage.sentence">This is a sentence</p>
I wanted to compare XLIFF 1.2 and XLIFF 2.0 format. To do so, three .xlf messages were generated.
messages.xlf generated by ng xi18n --i18n-format=xlf --out-file messages.xlf --i18n-locale=en
<?xml version="1.0" encoding="UTF-8" ?>
<xliffversion="1.2"xmlns="urn:oasis:names:tc:xliff:document:1.2">
<filesource-language="en"target-language="fr"datatype="plaintext"original="ng2.template">
<body>
<trans-unitid="homepage.title"datatype="html">
<source>Title</source>
<target>Titre</target>
<context-grouppurpose="location">
<contextcontext-type="sourcefile">app/app.component.ts</context>
<contextcontext-type="linenumber">9</context>
</context-group>
</trans-unit>
<trans-unitid="homepage.sentence"datatype="html">
<source>This is a sentence</source>
<target>Ceci est une phrase</target>
<context-grouppurpose="location">
<contextcontext-type="sourcefile">app/app.component.ts</context>
<contextcontext-type="linenumber">11</context>
</context-group>
</trans-unit>
</body>
</file>
</xliff>
messages.xlf2.fr.xlf generated by ng xi18n --i18n-format=xlf2 --out-file messages.xlf2.fr.xlf --i18n-locale=fr <target> also manually added. srcLang and trgLang manually edited.
<?xml version="1.0" encoding="UTF-8" ?>
<xliffversion="2.0"xmlns="urn:oasis:names:tc:xliff:document:2.0"srcLang="en"trgLang="fr">
<fileoriginal="ng.template"id="ngi18n">
<unitid="homepage.title">
<notes>
<notecategory="location">app/app.component.ts:9</note>
</notes>
<segment>
<source>Title</source>
<target>Titre</target>
</segment>
</unit>
<unitid="homepage.sentence">
<notes>
<notecategory="location">app/app.component.ts:11</note>
</notes>
<segment>
<source>This is a sentence</source>
<target>Ceci est une phrase</target>
</segment>
</unit>
</file>
</xliff>
What is the motivation / use case for changing the behavior?
Starting a new Angular project, I was hesitating between using Angular I18n or ngx-translate. Reading ngx-translate/core#495 led me to try Angular I18n. While checking XLIFF format, it appears that XLIFF 1.2 is pretty old, almost 10 years old and that XLIFF 2+ is not retrocompatible with XLIFF 1.2 (Source: slide#6).
However, I did not find so many free tools supporting XLIFF 2+ so I might start my project under XLIFF 1.2 hoping that if we need to migrate to XLIFF 2+, it won't be too hurtful.
I report this as a bug as I assumed that the I18n tooling can generate files that Angular can use 😄
Environment
Angular CLI : 6.0.7
Node : 8.11.2
OS : win32 x64 => Windows 10 (version 1803 build 17134.48)
Angular : 6.0.3
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.6.8
@angular-devkit/build-angular 0.6.8
@angular-devkit/build-optimizer 0.6.8
@angular-devkit/core 0.6.8
@angular-devkit/schematics 0.6.7
@angular/cli 6.0.7
@ngtools/webpack 6.0.8
@schematics/angular 0.6.7
@schematics/update 0.6.7
typescript 2.7.2
webpack 4.8.3
Browser:
- [x] Chrome (desktop) version 66.0.3359.181 x64
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [x] Firefox version 60.0.1 x64
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
Others:
The text was updated successfully, but these errors were encountered:
Okay... sometimes it's good to write issue as it gives another way of thinking about the problem. Angular does indeed support XLIFF 2.0: the i18nFormat must be xlf2 instead of xlf.
Being new to Angular, I was testing I18n functionalities following the official guide and was comparing XLIFF 1.2 and XLIFF 2.0.
I'm submitting a...
Current behavior
Expected behavior
The app home page requires two translations.
Using XLIFF 1.2 file with
ng serve --configuration=fr-1.2
runs without error as showned in the official guide. However running using XLIFF 2.0 file withng serve --configuration=fr-2.0
triggered warning:Obviously, changing the
i18nMissingTranslation
fromwarning
toerror
triggers a similar error:Minimal reproduction of the problem with instructions
Short version
Stackblitz does not support
.xlf
file but source code is available at https://github.com/Xsylum/angular-i18n. Useng serve --configuration=fr-2.0
to trigger the warning.Description
The two required translations are:
app.component.html
I wanted to compare XLIFF 1.2 and XLIFF 2.0 format. To do so, three
.xlf
messages were generated.ng xi18n --i18n-format=xlf --out-file messages.xlf --i18n-locale=en
ng xi18n --i18n-format=xlf --out-file messages.xlf12.fr.xlf --i18n-locale=fr
Due to ng xi18n Xliff no longer produces empty <target/> translations causing the Xliff parser to fail #21690,
<target>
was manually added:ng xi18n --i18n-format=xlf2 --out-file messages.xlf2.fr.xlf --i18n-locale=fr
<target>
also manually added.srcLang
andtrgLang
manually edited.Configurations have been adjusted accordingly:
serve
is adjusted with the same names.What is the motivation / use case for changing the behavior?
Starting a new Angular project, I was hesitating between using Angular I18n or ngx-translate. Reading ngx-translate/core#495 led me to try Angular I18n. While checking XLIFF format, it appears that XLIFF 1.2 is pretty old, almost 10 years old and that XLIFF 2+ is not retrocompatible with XLIFF 1.2 (Source: slide#6).
However, I did not find so many free tools supporting XLIFF 2+ so I might start my project under XLIFF 1.2 hoping that if we need to migrate to XLIFF 2+, it won't be too hurtful.
I report this as a bug as I assumed that the I18n tooling can generate files that Angular can use 😄
Environment
The text was updated successfully, but these errors were encountered: