pyqt/python-qt5

pylupdate5 fail to extract translated string on black formatted code

vtexier opened this issue · 1 comments

pylupdate5 v5.14.2

My code use black as the unique code formatter.

Black add a trailing comma after some strings.
Sadly, pylupdate5 do not extract those strings.

Workaround (painful):
Manually remove the trailing commas on each strings, extract strings with pylupdate5, then reformat with black.

Example:

This code is not extracted... Remove comma and it will.

    _DESCRIPTION_STR_ = QT_TRANSLATE_NOOP(
        "PercentOfAverage",
        """Percent of Average referential of the money.<br />
                                          Percent of Average value PoA is calculated by dividing the quantitative value Q by the average<br />
                                           then multiply by one hundred.<br />
                                          This referential is relative and more reliable to display prices and accounts, when UD is two low.<br />
                                          No money creation or destruction is apparent here and every account tend to<br />
                                           the average.
                                          """,
    )

Same here, formatter add that comma at the end and pylupdate doesn't pick it for translation

  translate(
      "BevelGearProperties",
      "if value is true the gears outer face will match the z=0 plane",
  ),

Edit: Sorry for necrobumping. In case someone gets this problem install qt6 tools and use pylupdate6