Reputation: 17397
I've pretty much followed the official i18n angular guide for translation in angular. However when serving the app with
g serve --aot --i18nFile=src/locale/messages.fr.xlf --i18nFormat=xlf --locale=fr
I still get the english text.
I have a messages.xlf and messages.fr.xlf :
src/messages.xlf
<?xml version="1.0" encoding="UTF-8" ?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="ng2.template">
<body>
<trans-unit id="welcome" datatype="html">
<source>Hello!</source>
<context-group purpose="location">
<context context-type="sourcefile">app/app.component.ts</context>
<context context-type="linenumber">2</context>
</context-group>
<note priority="1" from="description">user welcome</note>
</trans-unit>
</body>
</file>
</xliff>
src/locale/messages.fr.xlf
<?xml version="1.0" encoding="UTF-8" ?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="ng2.template">
<body>
<trans-unit id="welcome" datatype="html">
<source>Hello!</source>
<target>Bonjour!</target>
<context-group purpose="location">
<context context-type="sourcefile">app/app.component.ts</context>
<context context-type="linenumber">2</context>
</context-group>
<note priority="1" from="description">user welcome</note>
</trans-unit>
</body>
</file>
</xliff>
and my template of my test app:
<div i18n="user welcome@@welcome">Hello!</div>
Upvotes: 1
Views: 177
Reputation:
Simply replace
<div i18n="user welcome@@welcome">Hello!</div>
By
<div i18n="user welcome@@welcome"></div>
Upvotes: 1