fix(ivy): handle &ngsp; in i18n translations correctly (#31479)
Prior to this commit, the `` unicode symbol that represents `&ngsp` in translations was not handled correctly, i.e. was not replaced with a whitespace, thus appearing on a screen. This commit adds post-processing and replaces the mentioned symbol with a whitespace. PR Close #31479
This commit is contained in:

committed by
Matias Niemelä

parent
76e3b57a12
commit
6da1446afc
@ -48,6 +48,14 @@ onlyInIvy('Ivy i18n logic').describe('runtime i18n', () => {
|
||||
expect(fixture.nativeElement.innerHTML).toBe('<div>Bonjour Angular</div>');
|
||||
});
|
||||
|
||||
it('should support &ngsp; in translatable sections', () => {
|
||||
// note: the `` unicode symbol represents the `&ngsp;` in translations
|
||||
ɵi18nConfigureLocalize({translations: {'text ||': 'texte ||'}});
|
||||
const fixture = initWithTemplate(AppCompWithWhitespaces, `<div i18n>text |&ngsp;|</div>`);
|
||||
|
||||
expect(fixture.nativeElement.innerHTML).toEqual(`<div>texte | |</div>`);
|
||||
});
|
||||
|
||||
it('should support interpolations with complex expressions', () => {
|
||||
ɵi18nConfigureLocalize({
|
||||
translations:
|
||||
@ -1503,6 +1511,14 @@ class AppComp {
|
||||
count = 0;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-comp-with-whitespaces',
|
||||
template: ``,
|
||||
preserveWhitespaces: true,
|
||||
})
|
||||
class AppCompWithWhitespaces {
|
||||
}
|
||||
|
||||
@Directive({
|
||||
selector: '[tplRef]',
|
||||
})
|
||||
|
Reference in New Issue
Block a user