bug-gettext
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #58643] ITS - Double escapes when merging translations back to XML


From: Samy Mahmoudi
Subject: [bug #58643] ITS - Double escapes when merging translations back to XML
Date: Wed, 24 Jun 2020 09:11:31 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; FreeBSD amd64; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36

Follow-up Comment #5, bug #58643 (project gettext):

> I reproduce the issue even with the default AppData XML rules, with the
attached files and these steps:
It seems you considered a different scenario because in my original XML files,
& are used instead of & as is. I had that idea of replacing occurences of
& with & in my original *.xml.in documents, which I tried to justify by
the fact that my templates do not have to be valid XML documents. But using &
as is obviously results in an error message 'xmlParseEntityRef: no name'
whether it be at extraction or when merging. Why don't you have such an error
in your example? Anyway, this workaround now looks a bad idea to me, because
even if gettext/msgfmt's underlying XML parser let me do this, I would still
have to reverse the replacements when internationalization is disabled:
*.xml.in (invalid-XML XML template) ---> *.xml (valid-XML XML file).

> xgettext should map character entities to plain Unicode characters, and
leave other entities unchanged.
> msgfmt should not escape the msgstr when storing it in the merged XML file.
Do you mean we would e.g. store a plain & in the merged XML file? Does not
this make it invalid?

>> xgettext should map character entities to plain Unicode characters, and
leave other entities unchanged.
>
> This might be already covered by `gt:escapeRule`, as the attached patch.
I had escape set to yes. If I set escape to no and update my *.po files, then
all the strings containing & in my original XML become strings containing
& in msgid lines, and I just need to update the msgstr lines: in a sense, this
is how I thought my problem would be solved when filing this bug report.

But now the translations are not merged back, which makes me realize that may
not be the way to solve the problem. So the question is now:

When you meet the following conditions,

• escape set to no
• <short>&amp;</short>; in your original XML file
• *.po files updated to msgid "&" and msgstr "&" 

what is the intended behavior of a merge: merging several translations
containing "&" into "&amp;" (just below the original "&amp;" in the XML), or
not merging at all because the msgid "&" does not match the "&amp;" of the
original document?

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58643>

_______________________________________________
  Message posté via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]