Skip to content

Instantly share code, notes, and snippets.

Last active October 20, 2016 08:20
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
ng-xi18n: Extracts texts and creates a XLIFF file in Angular 2, ready for translation
import { Component } from '@angular/core';
selector: 'my-app',
template: `
<h1 i18n>Hello world</h1>
<p i18n="example description">This is an {{details}} paragraph</p>
<p>should not be translated</p>
<p i18n>I ❤ LingoHub</p>
export class AppComponent {
details = 'example';
<?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">
<trans-unit id="c8793269a943c10686b41f4f4f890875016783fc" datatype="html">
<source>Hello world</source>
<trans-unit id="1ecda48b29cdbe90ec39cf2fc0e93c87819a563d" datatype="html">
<source>This is an <x id="INTERPOLATION"/> paragraph</source>
<note priority="1" from="description">example description</note>
<trans-unit id="dfac9682a27fa25dcb19affd925d2b341798bf12" datatype="html">
<source>I ❤ LingoHub</source>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment