fix(ivy): i18n - add XLIFF aliases for legacy message id support (#33160)

The `legacyMessageIdFormat` is taken from the `i18nInFormat` property but we were only considering
`xmb`, `xlf` and `xlf2` values.

The CLI also supports `xliff` and `xliff2` values for the
`i18nInFormat`.

This commit adds support for those aliases.

PR Close #33160
This commit is contained in:
Pete Bacon Darwin
2019-10-15 08:23:46 +01:00
committed by Miško Hevery
parent 11e04b1892
commit ad72c90447
2 changed files with 33 additions and 2 deletions

View File

@ -52,10 +52,11 @@ export class I18nMetaVisitor implements html.Visitor {
message.id = typeof meta !== 'string' && (meta as i18n.Message).id || decimalDigest(message);
}
if (this.i18nLegacyMessageIdFormat === 'xlf') {
if (this.i18nLegacyMessageIdFormat === 'xlf' || this.i18nLegacyMessageIdFormat === 'xliff') {
message.legacyId = computeDigest(message);
} else if (
this.i18nLegacyMessageIdFormat === 'xlf2' || this.i18nLegacyMessageIdFormat === 'xmb') {
this.i18nLegacyMessageIdFormat === 'xlf2' || this.i18nLegacyMessageIdFormat === 'xliff2' ||
this.i18nLegacyMessageIdFormat === 'xmb') {
message.legacyId = computeDecimalDigest(message);
} else if (typeof meta !== 'string') {
// This occurs if we are doing the 2nd pass after whitespace removal