Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-40444

lconvert and lupdate mangling context and comment in PO files

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Incomplete
    • Affects Version/s: 5.3.1
    • Fix Version/s: None
    • Component/s: Tools: Linguist
    • Labels:
      None

      Description

      The Linguist tools (lupdate, lconvert) produce faulty PO files, they mangle the context and source comments into one string, making it impossible to translate the current KDE Qt-based frameworks (examples taken from the kcompletion framework below).

      Example 1:
      d->clearButton->setToolTip(tr("Clear text", "@action:button Clear current text in the line edit"));

      produces:

      #: /home/ltinkl/git/plasma-next-setup-script/kcompletion/src/klineedit.cpp:224
      msgctxt "KLineEdit|@action:button Clear current text in the line edit"
      msgid "Clear text"
      msgstr ""

      Example 2:
      KHistoryComboBox::tr("Clear &History")

      produces:

      #: /home/ltinkl/git/plasma-next-setup-script/kcompletion/src/khistorycombobox.cpp:203
      msgctxt "KHistoryComboBox|"
      msgid "Clear &History"
      msgstr ""

      One problem is the trailing "|" character when no comment (disambiguation) is given, another problem is putting that comment behind the context. The msgctxt has to match the source code context exactly and the comment has to be put before the entry as a plain comment. When converting such PO file back to TS with lconvert, the context is lost.

      Attachments:
      kcompletion.ts : well formed TS files, with correct contexts preserved
      kcompletion.po : wrongly mangled context and comment when extracting the strings using "lupdate *.cpp -ts kcompletion.po"
      kcompletion_converted.po: wrongly mangled context and comment when converting the file using "lconvert-qt5 -i kcompletion.ts -o kcompletion_converted.po"

        Attachments

        1. kcompletion_converted.po
          1 kB
        2. kcompletion.pot
          2 kB
        3. kcompletion.ts
          3 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            buddenha Oswald Buddenhagen
            Reporter:
            ltinkl Lukáš Tinkl
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes