Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-1687

lupdate -tr-function-alias option doesn't work with custom function

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P4: Low
    • None
    • 6.2.0
    • Tooling
    • None
    • Linux/X11
    • d7606bf73ce8447fa817a7f42e76bf0dc5416a0f (qt/qttools/dev) 5b62f8a44c831e42fb45bfeaf678a7e906e563af (qt/qttools/6.2)

    Description

      If I use lupdate with native translate function(s) for this sample code:

      from PySide6.QtWidgets import QApplication, QMainWindow
      
      app = QApplication()
      win = QMainWindow()
      win.setWindowTitle(win.tr("Window Title"))
      win.show()
      app.exec()

       then everything is fine:

      $ lupdate main.py -ts it.ts
      Updating 'it.ts'...
         Found 1 source text(s) (1 new and 0 already existing)
      $ 

      But if I change my code and use custom translate function: 

      from PySide6.QtWidgets import QApplication, QMainWindow
      
      def custom_tr(text):
          return QApplication.translate("Context", text)
      
      app = QApplication()
      win = QMainWindow()
      win.setWindowTitle(custom_tr("Window Title"))
      win.show()
      app.exec()

      then it doesn't work: 

      $ lupdate main.py -ts it.ts -tr-function-alias tr=custom_tr
       Updating 'it.ts'...
       Found 0 source text(s) (0 new and 0 already existing)
       $ 

      It worked before with pylupdate5 and PySide2.

       

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kleint Friedemann Kleint
            starterkit Ivan Ivanov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes