Skip to content

Attributes are removed from HTML tags in translations #54

Open
@theRobinator

Description

@theRobinator

Minimal reproduction in a test case:

import {I18n} from '@ngx-translate/i18n-polyfill';
import {MissingTranslationStrategy} from '@angular/core';

describe('i18n-polyfill', () => {
    it('keeps attributes around', () => {
        const translate = new I18n('xlf', '', 'en-US', MissingTranslationStrategy.Ignore);
        const str = `It's <span class="blue">you</span> versus <span class="red">them</span>!`;
        const result = translate(str);
        expect(result).toBe(str);
    });
});

This test fails with:

Expected 'It's <span>you</span> versus <span>them</span>!' to be 'It's <span class="blue">you</span> versus <span class="red">them</span>!'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions