diff --git a/README.md b/README.md
index e062446..d4ad935 100644
--- a/README.md
+++ b/README.md
@@ -38,22 +38,22 @@ ng extract-i18n # yes, same as before - this replaces the original builder
In your `angular.json` the target `extract-i18n` that can be configured with the following options:
-| Name | Default | Description |
-|------------------------------|-------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| `browserTarget` | Inferred from current setup by `ng add` | A browser builder target to extract i18n messages in the format of `project:target[:configuration]`. See https://angular.io/cli/extract-i18n#options |
-| `format` | Inferred from current setup by `ng add` | Any of `xlf`, `xlif`, `xliff`, `xlf2`, `xliff2` |
-| `outputPath` | Inferred from current setup by `ng add` | Path to folder containing all (source and target) translation files. |
-| `targetFiles` | Inferred from current setup by `ng add` | Filenames (relative to `outputPath` of all target translation files (e.g. `["messages.fr.xlf", "messages.de.xlf"]`). |
-| `sourceLanguageTargetFile` | Unused | If this is set (to one of the `targetFiles`), new translations in that target file will be set to `state="final"` (instead of default `state="new"`). |
-| `sourceFile` | `messages.xlf`. `ng add` tries to infer non default setups. | Filename (relative to `outputPath` of source translation file (e.g. `"translations-source.xlf"`). |
-| `removeIdsWithPrefix` | `[]` | List of prefix strings. All translation units with matching `id` attribute are removed. Useful for excluding duplicate library translations. |
-| `fuzzyMatch` | `true` | Whether translation units without matching IDs are fuzzy matched by source text. |
-| `resetTranslationState` | `true` | Reset the translation state to new/initial for new/changed units. |
-| `collapseWhitespace` | `true` | Collapsing of multiple whitespaces/line breaks in translation sources and targets. |
-| `trim` | `false` | Trim translation sources and targets. |
-| `includeContext` | `false` | Whether to include the context information (like notes) in the translation files. This is useful for sending the target translation files to translation agencies/services. |
-| `newTranslationTargetsBlank` | `false` | When `false` (default) the "target" of new translation units is set to the "source" value. When `true`, an empty string is used. When `'omit'`, no target element is created. |
-| `sort` | `"stableAppendNew"` | Sorting of all translation units in source and target translation files. Supported: `"idAsc"` (sort by translation IDs), `"stableAppendNew"` (keep existing sorting, append new translations at the end) |
+| Name | Default | Description |
+|------------------------------|-------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `browserTarget` | Inferred from current setup by `ng add` | A browser builder target to extract i18n messages in the format of `project:target[:configuration]`. See https://angular.io/cli/extract-i18n#options |
+| `format` | Inferred from current setup by `ng add` | Any of `xlf`, `xlif`, `xliff`, `xlf2`, `xliff2` |
+| `outputPath` | Inferred from current setup by `ng add` | Path to folder containing all (source and target) translation files. |
+| `targetFiles` | Inferred from current setup by `ng add` | Filenames (relative to `outputPath` of all target translation files (e.g. `["messages.fr.xlf", "messages.de.xlf"]`). |
+| `sourceLanguageTargetFile` | Unused | If this is set (to one of the `targetFiles`), new translations in that target file will be set to `state="final"` (instead of default `state="new"`). |
+| `sourceFile` | `messages.xlf`. `ng add` tries to infer non default setups. | Filename (relative to `outputPath` of source translation file (e.g. `"translations-source.xlf"`). |
+| `removeIdsWithPrefix` | `[]` | List of prefix strings. All translation units with matching `id` attribute are removed. Useful for excluding duplicate library translations. |
+| `fuzzyMatch` | `true` | Whether translation units without matching IDs are fuzzy matched by source text. |
+| `resetTranslationState` | `true` | Reset the translation state to new/initial for new/changed units. |
+| `collapseWhitespace` | `true` | Collapsing of multiple whitespaces/line breaks in translation sources and targets. |
+| `trim` | `false` | Trim translation sources and targets. |
+| `includeContext` | `false` | Whether to include the context information (like notes) in the translation files. This is useful for sending the target translation files to translation agencies/services. When `sourceFileOnly` the context is retained only in the `sourceFile`. |
+| `newTranslationTargetsBlank` | `false` | When `false` (default) the "target" of new translation units is set to the "source" value. When `true`, an empty string is used. When `'omit'`, no target element is created. |
+| `sort` | `"stableAppendNew"` | Sorting of all translation units in source and target translation files. Supported: `"idAsc"` (sort by translation IDs), `"stableAppendNew"` (keep existing sorting, append new translations at the end) |
## Contribute
diff --git a/src/builder.spec.ts b/src/builder.spec.ts
index 70f6641..e780160 100644
--- a/src/builder.spec.ts
+++ b/src/builder.spec.ts
@@ -675,6 +675,55 @@ describe('Builder', () => {
});
});
+ test('extract-and-merge xlf 1.2 with newTranslationTargetsBlank=omit', async () => {
+ await runTest(
+ {
+ messagesBefore: '\n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ '',
+ messagesFrBefore: '\n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' target val\n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ '',
+ options: {
+ format: 'xlf',
+ targetFiles: ['messages.fr.xlf'],
+ sourceLanguageTargetFile: "messages.fr.xlf",
+ outputPath: 'builder-test',
+ removeIdsWithPrefix: ['removeMe'],
+ newTranslationTargetsBlank: 'omit'
+ },
+ messagesFrExpected: '\n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' target val\n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ''
+ });
+ });
+
test('extract-and-merge with xml definition without newline', async () => {
await runTest(
{
@@ -1102,7 +1151,7 @@ describe('Builder', () => {
' \n' +
'