feat(ivy): i18n - render legacy message ids in $localize
if requested (#32937)
The `$localize` library uses a new message digest function for computing message ids. This means that translations in legacy translation files will no longer match the message ids in the code and so will not be translated. This commit adds the ability to specify the format of your legacy translation files, so that the appropriate message id can be rendered in the `$localize` tagged strings. This results in larger code size and requires that all translations are in the legacy format. Going forward the developer should migrate their translation files to use the new message id format. PR Close #32937
This commit is contained in:

committed by
atscott

parent
fc28b266cd
commit
bcbf3e4123
@ -32,6 +32,7 @@ export function main(
|
||||
if (configErrors.length) {
|
||||
return reportErrorsAndExit(configErrors, /*options*/ undefined, consoleError);
|
||||
}
|
||||
warnForDeprecatedOptions(options);
|
||||
if (watch) {
|
||||
const result = watchMode(project, options, consoleError);
|
||||
return reportErrorsAndExit(result.firstCompileResult, options, consoleError);
|
||||
@ -226,6 +227,14 @@ export function watchMode(
|
||||
}, options, options => createEmitCallback(options)));
|
||||
}
|
||||
|
||||
function warnForDeprecatedOptions(options: api.CompilerOptions) {
|
||||
if (options.i18nLegacyMessageIdFormat !== undefined) {
|
||||
console.warn(
|
||||
'The `i18nLegacyMessageIdFormat` option is deprecated.\n' +
|
||||
'Migrate your legacy translation files to the new `$localize` message id format and remove this option.');
|
||||
}
|
||||
}
|
||||
|
||||
// CLI entry point
|
||||
if (require.main === module) {
|
||||
const args = process.argv.slice(2);
|
||||
|
Reference in New Issue
Block a user