pyqt / python-qt5

Unofficial PyQt5 via PyPI for Python 2.7 64-bit on Windows
GNU General Public License v3.0
284 stars 79 forks source link

pylupdate5 fail to extract translated string on black formatted code #54

Open vtexier opened 4 years ago

vtexier commented 4 years ago

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.
                                          """,
    )
hasecilu commented 9 months ago

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