Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): remove deprecated i18nLocale and …
Browse files Browse the repository at this point in the history
…i18nFormat options from i18n-extract

BREAKING CHANGE: Removal of deprecated `extract-i18n` command options
The deprecated `i18nLocale` option has been removed and the `i18n.sourceLocale` within a project's configuration should be used instead.
The deprecated `i18nFormat` option has been removed and the `format` option should be used instead.
  • Loading branch information
clydin authored and alan-agius4 committed Apr 2, 2021
1 parent 1473c60 commit eca5a01
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 43 deletions.
26 changes: 5 additions & 21 deletions packages/angular_devkit/build_angular/src/extract-i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,8 @@ async function getSerializer(format: Format, sourceLocale: string, basePath: str
}
}

function normalizeFormatOption(options: ExtractI18nBuilderOptions) {
let format;
if (options.i18nFormat !== Format.Xlf) {
format = options.i18nFormat;
} else {
format = options.format;
}
function normalizeFormatOption(options: ExtractI18nBuilderOptions): Format {
let format = options.format;

switch (format) {
case Format.Xlf:
Expand All @@ -114,21 +109,10 @@ function normalizeFormatOption(options: ExtractI18nBuilderOptions) {
case Format.Xliff2:
format = Format.Xlf2;
break;
case Format.Json:
format = Format.Json;
break;
case Format.Arb:
format = Format.Arb;
break;
case Format.LegacyMigrate:
format = Format.LegacyMigrate;
break;
case undefined:
format = Format.Xlf;
break;
}

return format;
// Default format is xliff1
return format ?? Format.Xlf;
}

class NoEmitPlugin {
Expand Down Expand Up @@ -183,7 +167,7 @@ export async function execute(
vendor: true,
},
buildOptimizer: false,
i18nLocale: options.i18nLocale || i18n.sourceLocale,
i18nLocale: i18n.sourceLocale,
i18nFormat: format,
i18nFile: outFile,
aot: true,
Expand Down
22 changes: 0 additions & 22 deletions packages/angular_devkit/build_angular/src/extract-i18n/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,6 @@
"legacy-migrate"
]
},
"i18nFormat": {
"type": "string",
"description": "Output format for the generated file.",
"default": "xlf",
"x-deprecated": "Use 'format' option instead.",
"enum": [
"xmb",
"xlf",
"xlif",
"xliff",
"xlf2",
"xliff2",
"json",
"arb",
"legacy-migrate"
]
},
"i18nLocale": {
"type": "string",
"description": "Specifies the source language of the application.",
"x-deprecated": "Use 'i18n' project level sub-option 'sourceLocale' instead."
},
"progress": {
"type": "boolean",
"description": "Log progress to the console.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@
"factory": "./update-8/#updateLazyModulePaths",
"description": "Lazy loading syntax migration. Update lazy loading string syntax to use dynamic imports."
},
"remove-deprecated-i18n-options": {
"version": "12.0.0-next.7",
"factory": "./update-9/update-i18n#updateI18nConfig",
"description": "Remove deprecated ViewEngine-based i18n build and extract options. Options present in the configuration will be converted to use non-deprecated options."
},
"production-by-default": {
"version": "9999.0.0",
"factory": "./update-12/production-default-config",
Expand Down

0 comments on commit eca5a01

Please sign in to comment.