Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
vtexier opened this issue Apr 18, 2020 · 1 comment
Open

Comments

@vtexier
Copy link

vtexier commented Apr 18, 2020

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
Copy link

hasecilu commented Feb 3, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants