Skip to content

[Translation] Support name attribute in XLIFF 2.0 loader #32048

Closed
@pontus-mp

Description

@pontus-mp

XliffFileLoader supports using the XLIFF 1.2 resname attribute (see #5940) as the identifier for translation strings. Unfortunately, it doesn't support an equivalent for XLIFF 2.0.

If I read the standard correctly, the name attribute seems to be appropriate and apparently XliffFileDumper already supports writing to it (#25758).

My suggestion is to support the name attribute during loading of XLIFF 2.0 as well. Basically, these two should be equivalent:

XLIFF 1.2

<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
    <file source-language="en" datatype="plaintext" original="file.ext">
        <body>
            <trans-unit id="1" resname="i_am_used_as_translation_key_in_xliff_1_2">
                <source>I am used as the translation key in XLIFF 2.0</source>
                <target>translated-content</target>
            </trans-unit>
        </body>
    </file>
</xliff>

XLIFF 2.0

<?xml version="1.0" encoding="UTF-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.0"
    srcLang="en_US">
    <file id="messages.en_US">
        <unit id="1" name="i_am_used_as_translation_key_in_xliff_1_2">
            <segment>
                <source>I am used as the translation key in XLIFF 2.0</source>
                <target>translated-content</target>
            </segment>
        </unit>
    </file>
</xliff>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions