-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(i18n): add i18n command line options (#3098)
Also available on the webpack plugin.
- Loading branch information
Showing
10 changed files
with
85 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import {ng} from '../../utils/process'; | ||
import {expectFileToMatch, writeFile, createDir, appendToFile} from '../../utils/fs'; | ||
import {expectToFail} from '../../utils/utils'; | ||
|
||
export default function() { | ||
return Promise.resolve() | ||
.then(() => createDir('src/locale')) | ||
.then(() => writeFile('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="8def8481e91291a52f9baa31cbdb313e6a6ca02b" datatype="html"> | ||
<source>Hello i18n!</source> | ||
<target>Bonjour i18n!</target> | ||
<note priority="1" from="description">An introduction header for this sample</note> | ||
</trans-unit> | ||
</body> | ||
</file> | ||
</xliff>`)) | ||
.then(() => appendToFile('src/app/app.component.html', | ||
'<h1 i18n="An introduction header for this sample">Hello i18n!</h1>')) | ||
.then(() => ng('build', '--aot', '--i18n-file', 'src/locale/messages.fr.xlf', '--i18n-format', | ||
'xlf', '--locale', 'fr')) | ||
.then(() => expectFileToMatch('dist/main.bundle.js', /Bonjour i18n!/)) | ||
.then(() => ng('build', '--aot')) | ||
.then(() => expectToFail(() => expectFileToMatch('dist/main.bundle.js', /Bonjour i18n!/))) | ||
.then(() => expectFileToMatch('dist/main.bundle.js', /Hello i18n!/)); | ||
} |