#105647Get rid of "resname" attribute in XLF file
Description
According to https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/Localization/XliffFormat.html, a trans-unit node is supposed to have both `id` and `resname` attributes, with the same “key”.
From my point of view this is totally useless as I work with XLIFF since TYPO3 4.6 and never did it for my own extensions.
Possible argument is that it’s needed for (some) web tool showing that context for the translator.
With Pootle, back then, it was not required.
With Crowdin, it’s not required. Proof is with EXT:image_autoresize where I don’t have such definitions:
<trans-unit id="saveConfiguration">
<source>Save configuration</source>
</trans-unit>
and there’s no problem seeing that context on Crowdin (https://crowdin.com/editor/typo3-extension-imageautoresiz/7511/en-fr?view=comfortable&filter=basic&value=3):
clipboard-202411201108-xfbqa.png
Suggestion
- Core should not have to worry about tools we don’t use ourselves (such as Weblate as I was said it was required there)
- Official contribution documentation should not take care of this either
- I would suggest to get rid of all resname attributes for the sake of removing unneeded complexity and possible mismatch when working with Core XLIFF files
Reviews 2
Related issues 1
Files 1
History 1422
-
Xavier Perseguers changed description <span data-processor="relativetime" data-value="2024-11-20T10:14:24+00:00" > 11/20/24, 10:14 </span>
-
Christian Kuhn commented <span data-processor="relativetime" data-value="2024-11-20T10:51:35+00:00" > 11/20/24, 10:51 </span>
Google “weblate resname attribute”:
The resname attribute is supposed to be human friendly identifier of the unit making it more suitable for Weblate to display instead of id . The resname has to be unique in the whole XLIFF file.
Our current habit of having identical “id” and “resname” is pointless. Even in weblate, “resname” is an optional additional information, potentially useful when it contains different content than “id”.
As far as I can see, “resname” can and should be removed throughout the core. Did I miss something?
-
Peter Kraume commented <span data-processor="relativetime" data-value="2024-11-20T10:58:21+00:00" > 11/20/24, 10:58 </span>
We discussed the idea in the Localization Team and we also don’t see any issues which would block us from removing the resname attribute.
-
Xavier Perseguers commented <span data-processor="relativetime" data-value="2024-11-20T11:24:24+00:00" > 11/20/24, 11:24 </span>
Suggestion:
find . -name \*\.xlf -exec sed -I "" -E 's/<trans-unit([^>]+)id="([^"]+)"([^>]+)>/<trans-unit id="\2">/' {} \; -
Markus Klein commented <span data-processor="relativetime" data-value="2024-11-20T11:31:12+00:00" > 11/20/24, 11:31 </span>
Can we find in the history why we introduced it in the first place?
I remember we did not add them for fun, there was some good reason. -
Markus Klein changed Related to #89335 <span data-processor="relativetime" data-value="2024-11-20T11:33:28+00:00" > 11/20/24, 11:33 </span>
-
Markus Klein commented <span data-processor="relativetime" data-value="2024-11-20T11:34:12+00:00" > 11/20/24, 11:34 </span>
Markus Klein wrote in #note-6:
> Can we find in the history why we introduced it in the first place?
> I remember we did not add them for fun, there was some good reason.It was needed for crowdin back then, obviously
-
Peter Kraume commented <span data-processor="relativetime" data-value="2024-11-20T12:03:57+00:00" > 11/20/24, 12:03 </span>
When we do the change, we also need to update the documentation:
https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/Localization/XliffFormat.html -
Gerrit Code Review pushed patch set 1 for main to change 87096 status
NewUnder Review <span data-processor="relativetime" data-value="2024-11-20T12:15:20+00:00" > 11/20/24, 12:15 </span> -
Gerrit Code Review pushed patch set 2 for main to change 87096 <span data-processor="relativetime" data-value="2024-11-20T20:24:49+00:00" > 11/20/24, 20:24 </span>
-
Gerrit Code Review pushed patch set 3 for main to change 87096 <span data-processor="relativetime" data-value="2024-11-20T21:48:54+00:00" > 11/20/24, 21:48 </span>
-
Gerrit Code Review pushed patch set 4 for main to change 87096 <span data-processor="relativetime" data-value="2024-11-21T09:43:04+00:00" > 11/21/24, 09:43 </span>
-
Gerrit Code Review pushed patch set 5 for main to change 87096 <span data-processor="relativetime" data-value="2024-11-21T09:47:16+00:00" > 11/21/24, 09:47 </span>
-
Gerrit Code Review pushed patch set 6 for main to change 87096 <span data-processor="relativetime" data-value="2024-11-21T09:47:46+00:00" > 11/21/24, 09:47 </span>
-
Gerrit Code Review pushed patch set 7 for main to change 87096 <span data-processor="relativetime" data-value="2024-11-21T10:18:01+00:00" > 11/21/24, 10:18 </span>
-
Gerrit Code Review pushed patch set 1 for 13.4 to change 87139 <span data-processor="relativetime" data-value="2024-11-21T10:24:45+00:00" > 11/21/24, 10:24 </span>
-
Anonymous commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2024-11-21T10:40:09+00:00" > 11/21/24, 10:40 </span>Applied in changeset commit:c0578c702d777214ddb6f0364481a4be87c17e72.
-
Simon Schaufelberger commented <span data-processor="relativetime" data-value="2024-11-21T21:55:19+00:00" > 11/21/24, 21:55 </span>
Xavier Perseguers wrote in #note-5:
> Suggestion:
>
> […]This command doesn’t work for me in bash (ubuntu): sed: invalid Option — I
This is the working command for me:
find . -name \*\.xlf -exec sed -i -E 's/(<trans-unit[^>]*?)\sresname="[^"]*"/\1/' {} + -
Lina Wolf commented <span data-processor="relativetime" data-value="2024-11-30T10:11:18+00:00" > 11/30/24, 10:11 </span>
What about original in the file tag, is that one needed?
-
Lina Wolf commented <span data-processor="relativetime" data-value="2024-11-30T10:16:23+00:00" > 11/30/24, 10:16 </span>
https://github.com/TYPO3-Documentation/TYPO3CMS-Reference-CoreApi/pull/5107 Still needs to be reviewed
-
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2025-12-02T14:31:32+00:00" > 12/02/25, 14:31 </span>
Peter Kraume/The localization team asked for feedback:
TBH I really don’t care much for this. To avoid issues I run some regex replacements from time to time on my projects.
If anyone is interested:
With this, all XLF files always have correct trans-unit attributes. No matter to think about it and just following the documentation.
If resname gets removed, I adjust the replacement and it’s fine again.
I do not know how much Weblate (which seems to need it according to the issues description) is used, but it seems actively maintained.
As I do not see much effort to fix all XLF files with the replacement shown above I would tend to say: Let’s keep resname to stay compatible.