angular i18n build code example
Example 1: i18n angular
content_copy
ng xi18n --out-file source.xlf
Example 2: multilanguage site angular
$ npm install --save-dev angular-translate
<script src="path/to/angular-translate.js"></script>
var app = angular.module('myApp', ['pascalprecht.translate']);
app.config(['$translateProvider', function ($translateProvider) {
$translateProvider.translations('en', {
'TITLE': 'Hello',
'FOO': 'This is a paragraph'
});
$translateProvider.translations('de', {
'TITLE': 'Hallo',
'FOO': 'Dies ist ein Absatz'
});
$translateProvider.preferredLanguage('en');
}]);
<h1>{{ 'TITLE' | translate }}</h1>
<p>{{ 'FOO' | translate }}</p>