-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Translation] Make name
attribute optional in xliff2
#40283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
44318f6
to
f3bda9d
Compare
This feature was added in #26149, I am very sparse on details why this was added. But it is added according to the XLIFF specification. I assume it was to be compatible with parsers and external systems. @Taluu updated the loader in #35373. He is equally short on details why. Maybe you could elaborate? To fix this issue, we should either revert parts of #35373 or merge this PR in its current state. For future reference: The name is optional on the unit. |
f3bda9d
to
ff38b18
Compare
Hi @nicolas-grekas! No problem, I can move it to branch 4.4, just let me know. |
From what I can remember, translation tools such as memsource, phrase app and probably others are not technical, but aimed for translation teams. As such, From what I saw in the xliff1 loader and bits from the spec, it seems this is the role of the
That is why I set the priority on the name then the source. We could probably change this so there's a key duality (element accessible on both name and source value) ? But this could be heavy imo... I think this is mergeable as is. Or another way to look at it would be to not try to write a |
ff38b18
to
5c919e2
Compare
So, We don't know if the end users is using translation keys or original stings in their source code. So what we say is: Loader: If As pointed out before For the record: The Im happy with this PR. 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you.
I like that you added tests. Well done.
I consider this a bug fix, could you edit the PR to change the base to 4.4?
Do not set a fake `name` attribute on `unit` element from xliff2 to allow using `source` attribute and avoid missing translation error
5c919e2
to
9705855
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I rebased on 4.4)
Thanks @Nyholm for the review!
Thank you @MarieMinasyan. |
Do not set a fake
name
attribute onunit
element from xliff2 to allow usingsource
attribute and avoid missing translation errorWhen
xlf
translations are loaded, if a name exists onunit
element, the segment's source is ignored:At the same time, when dumping translations, the segment's source is copied into the unit's name attribute, unless it's longer than 80 characters. In that case,
substr(md5($source), -7)
is set into the name attribute.This results in a missing translation error, because the source is ignored and the name is a random string.
Suggested solution: only set the name attribute if the string is less than 80 characters.