Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

XLIFF export should contain default locale default texts in source tags #33041

Copy link
Copy link
Open
@Pixelshaped

Description

@Pixelshaped
Issue body actions

Description

Right now the translation tool XLIFF exports the same data for the resname attribute and the <source> tag:

<trans-unit id="0umDnnC" resname="navbar.home">
  <source>navbar.home</source>
  <target>__navbar.home</target>
</trans-unit>

But the XLIFF documentation specifies that the <source> tag should contain the default locale text to be translated, such as:

<trans-unit id="0umDnnC" resname="navbar.home">
  <source>Home</source>
  <target>__navbar.home</target>
</trans-unit>

Solution

Add a new command/option to sync the source tags of all generated files with the target tags of the default locale.

Example

Before
messages.en.xlf (default locale)

<trans-unit id="0umDnnC" resname="navbar.home">
  <source>navbar.home</source>
  <target>Home</target>
</trans-unit>

messages.fr.xlf (target locale)

<trans-unit id="0umDnnC" resname="navbar.home">
  <source>navbar.home</source>
  <target>__navbar.home</target>
</trans-unit>

Run our new command
php bin/console translation:update fr --update-source
After
messages.fr.xlf (target locale)

<trans-unit id="0umDnnC" resname="navbar.home">
  <source>Home</source>
  <target>__navbar.home</target>
</trans-unit>

Conclusion

This modification should be helpful for localization team that use software where they can see both the resname key and the original source. In most translation software you can translate the source automatically (i.e. with Deepl) and right now having the keys inside the source is unhelpful (and not compliant to the XLIFF format).

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.