fix(compiler): allow single quotes into named interpolations (#15461)
Fixes #15318
This commit is contained in:
parent
c17b912eb9
commit
53b89ec312
|
@ -161,8 +161,9 @@ class _I18nVisitor implements html.Visitor {
|
|||
}
|
||||
}
|
||||
|
||||
const _CUSTOM_PH_EXP = /\/\/[\s\S]*i18n[\s\S]*\([\s\S]*ph[\s\S]*=[\s\S]*"([\s\S]*?)"[\s\S]*\)/g;
|
||||
const _CUSTOM_PH_EXP =
|
||||
/\/\/[\s\S]*i18n[\s\S]*\([\s\S]*ph[\s\S]*=[\s\S]*("|')([\s\S]*?)\1[\s\S]*\)/g;
|
||||
|
||||
function _extractPlaceholderName(input: string): string {
|
||||
return input.split(_CUSTOM_PH_EXP)[1];
|
||||
return input.split(_CUSTOM_PH_EXP)[2];
|
||||
}
|
||||
|
|
|
@ -125,6 +125,12 @@ export function main() {
|
|||
.toEqual([
|
||||
[['[before, <ph name="TEST"> exp //i18n(ph="teSt") </ph>, after]'], 'm', 'd'],
|
||||
]);
|
||||
|
||||
expect(
|
||||
_humanizeMessages('<div i18n=\'m|d\'>before{{ exp //i18n(ph=\'teSt\') }}after</div>'))
|
||||
.toEqual([
|
||||
[[`[before, <ph name="TEST"> exp //i18n(ph='teSt') </ph>, after]`], 'm', 'd'],
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue