FreeCAD / FreeCAD-translations

Repository tracking localization issues and progress
5 stars 3 forks source link

[FreeCAD-addons] - Maintainers should NOT use `pylupdate5` to update translation files #297

Open hasecilu opened 9 months ago

hasecilu commented 9 months ago

In my journey translating WB I have encounter cases were some strings are not included on the .ts file.

As Chris reported some time ago black formatted code wasn't being picked by lupdate, a fix was made back then and in FreeCAD code was good again but somehow it looks that this problem is still present on external WB. https://forum.freecad.org/viewtopic.php?t=65744

With this in mind when I added translation support on FreeGrid, Gears, SheetMetal, Assembly3 and Assembly 4 (WIP) I used pylupdate6 in the scripts. I tried to do the same on Fasteners but it seems that there the code is not formatted and pylupdate5 works fine, I tried to use pylupdate6 but it gets error for some code.

Reading on the issues here it seems that this is a recurring problem so maybe we can track issues related to this, the solution is to use pylupdate6.

Maintainers would be interested on this script that have helped me to fix this problem: https://github.com/FreeCAD/FreeCAD-translations/pull/296

On my Arch Linux system pylupdate6 is a mini script. I don't know about other systems maybe someone check that.

$ file /usr/bin/pylupdate6
/usr/bin/pylupdate6: POSIX shell script, ASCII text executable
$  cat /usr/bin/pylupdate6
#!/bin/sh
exec /usr/bin/python -m PyQt6.lupdate.pylupdate ${1+"$@"}
chennes commented 9 months ago

What error are you getting from lupdate6? We use it exclusively on FreeCAD main, for the reasons you link to.

hasecilu commented 9 months ago

What error are you getting from lupdate6? We use it exclusively on FreeCAD main, for the reasons you link to.

From lupdate6 none, the problem is when external WB uses lupdate5 and that makes strings are not marked and thus translation is not completed, here I'm tracking WB that have this problem

chennes commented 9 months ago

I should note that "pylupdate6" is not the official Qt6/PySide6 executable -- we do not use it for FreeCAD main, we use Qt6's lupdate tool, which directly supports Python code now. That may not be relevant here, I'm just pointing it out for posterity.

hasecilu commented 6 months ago

What error are you getting from lupdate6? We use it exclusively on FreeCAD main, for the reasons you link to.

I just realized I explicitly said there was a problem with pylupdate6 and then said no. I meant not problems in general but a specific problem in Fasteners WB.

Today I investigated the problem and solved it, the explanation is in point 2 on https://github.com/shaise/FreeCAD_FastenersWB/pull/384

Could be a regression on upstream? because pylupdate5 worked fine but pylupdate6 gave the error.

Anyway, I'll test with lupdate to see if it's a 1 to 1 replacement.