Skip to content

Commit eca5a01

Browse files
clydinalan-agius4
authored andcommitted
fix(@angular-devkit/build-angular): remove deprecated i18nLocale and 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.
1 parent 1473c60 commit eca5a01

File tree

3 files changed

+10
-43
lines changed

3 files changed

+10
-43
lines changed

packages/angular_devkit/build_angular/src/extract-i18n/index.ts

+5-21
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,8 @@ async function getSerializer(format: Format, sourceLocale: string, basePath: str
9696
}
9797
}
9898

99-
function normalizeFormatOption(options: ExtractI18nBuilderOptions) {
100-
let format;
101-
if (options.i18nFormat !== Format.Xlf) {
102-
format = options.i18nFormat;
103-
} else {
104-
format = options.format;
105-
}
99+
function normalizeFormatOption(options: ExtractI18nBuilderOptions): Format {
100+
let format = options.format;
106101

107102
switch (format) {
108103
case Format.Xlf:
@@ -114,21 +109,10 @@ function normalizeFormatOption(options: ExtractI18nBuilderOptions) {
114109
case Format.Xliff2:
115110
format = Format.Xlf2;
116111
break;
117-
case Format.Json:
118-
format = Format.Json;
119-
break;
120-
case Format.Arb:
121-
format = Format.Arb;
122-
break;
123-
case Format.LegacyMigrate:
124-
format = Format.LegacyMigrate;
125-
break;
126-
case undefined:
127-
format = Format.Xlf;
128-
break;
129112
}
130113

131-
return format;
114+
// Default format is xliff1
115+
return format ?? Format.Xlf;
132116
}
133117

134118
class NoEmitPlugin {
@@ -183,7 +167,7 @@ export async function execute(
183167
vendor: true,
184168
},
185169
buildOptimizer: false,
186-
i18nLocale: options.i18nLocale || i18n.sourceLocale,
170+
i18nLocale: i18n.sourceLocale,
187171
i18nFormat: format,
188172
i18nFile: outFile,
189173
aot: true,

packages/angular_devkit/build_angular/src/extract-i18n/schema.json

-22
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,6 @@
2525
"legacy-migrate"
2626
]
2727
},
28-
"i18nFormat": {
29-
"type": "string",
30-
"description": "Output format for the generated file.",
31-
"default": "xlf",
32-
"x-deprecated": "Use 'format' option instead.",
33-
"enum": [
34-
"xmb",
35-
"xlf",
36-
"xlif",
37-
"xliff",
38-
"xlf2",
39-
"xliff2",
40-
"json",
41-
"arb",
42-
"legacy-migrate"
43-
]
44-
},
45-
"i18nLocale": {
46-
"type": "string",
47-
"description": "Specifies the source language of the application.",
48-
"x-deprecated": "Use 'i18n' project level sub-option 'sourceLocale' instead."
49-
},
5028
"progress": {
5129
"type": "boolean",
5230
"description": "Log progress to the console.",

packages/schematics/angular/migrations/migration-collection.json

+5
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@
145145
"factory": "./update-8/#updateLazyModulePaths",
146146
"description": "Lazy loading syntax migration. Update lazy loading string syntax to use dynamic imports."
147147
},
148+
"remove-deprecated-i18n-options": {
149+
"version": "12.0.0-next.7",
150+
"factory": "./update-9/update-i18n#updateI18nConfig",
151+
"description": "Remove deprecated ViewEngine-based i18n build and extract options. Options present in the configuration will be converted to use non-deprecated options."
152+
},
148153
"production-by-default": {
149154
"version": "9999.0.0",
150155
"factory": "./update-12/production-default-config",

0 commit comments

Comments
 (0)