expect-digital / translate

Translation for distributed systems
0 stars 0 forks source link

Incorrect value extracted from PO #46

Open janishorsts opened 7 months ago

janishorsts commented 7 months ago

New line escaping in values is not correctly converted from the PO syntax into the Message Format 2 syntax.

actual := "\n\\n\n                This filter was inherited from the dashboard's context.\\n\n                It won't be saved when saving the chart.\\n              "

expected := "\n                This filter was inherited from the dashboard's context.\n                It won't be saved when saving the chart.\n              "

Message in PO

#: superset-frontend/src/explore/components/controls/DndColumnSelectControl/Option.tsx:71
#: superset-frontend/src/explore/components/controls/OptionControls/index.tsx:326
msgid ""
"\n"
"                This filter was inherited from the dashboard's context.\n"
"                It won't be saved when saving the chart.\n"
"              "
msgstr ""

The message was extracted from the following source code (react) https://github.com/apache/superset/blob/4a1f66a6c74501dfc1f23b46a0c3e071251909bf/superset-frontend/src/explore/components/controls/OptionControls/index.tsx#L326

            t(`
                This filter was inherited from the dashboard's context.
                It won't be saved when saving the chart.
              `)

Currently incorrectly converted to Message Format 2


\\n
                This filter was inherited from the dashboard's context.\\n
                It won't be saved when saving the chart.\\n

Expected text in Message Format 2


                This filter was inherited from the dashboard's context.
                It won't be saved when saving the chart.

PO description

One should carefully distinguish between end of lines marked as ‘\n’ inside quotes, which are part of the represented string, and end of lines in the PO file itself, outside string quotes, which have no incidence on the represented string.

...external quotes are removed, multi-line strings are concatenated, and backslash escaped sequences are turned into their corresponding characters...

https://www.gnu.org/software/gettext/manual/gettext.html