shaise / FreeCAD_SheetMetal

A simple sheet metal workbench for FreeCAD
http://theseger.com/projects/2015/06/sheet-metal-addon-for-freecad/
GNU Lesser General Public License v2.1
193 stars 56 forks source link

Update translation script #301

Closed hasecilu closed 6 months ago

hasecilu commented 6 months ago

Same as in Fasteners WB, with some changes.

I tested both scripts and the generated files is the same.

Click to Déjà vu The old script worked good enough but it was hard to read and also didn't follow the workflow (updated and released at the same time when in reality the changes of the translator should be in the middle, minor thing). The new script: - is based on the script available at freecad.workbench_starterkit template - is well documented and easy to read - files are saved in lowercase - an language agnostic file is updated every time another file is updated The script updates `fasteners.ts` file every time any other translation file is created or updated. This is made with the objective of having this file updated with the most current changes. If a translator doesn't have access to `pylupdate` command it can start translating based on the `fasteners.ts` file, it only needs to replace ```xml ``` for ```xml ``` using their language code (must be supported on FreeCAD).

The advantage to use pylupdate6 over pylupdate5 is that some strings that are formatted are not picked with pylupdate5 but they are with pylupdate6, pylupdate5 is buggy, in fact, the first time I translated this WB even though I finished all lines some commands were missing, pylupdate5 was responsible. Example: the comma after the string in Python is recommended in case you want to add another element to the list but pylupdate5 fails to catch it.

ToolTip = FreeCAD.Qt.translate(
        "SheetMetal",
        "Sheet Metal workbench allows for designing and unfolding sheet metal parts",
    )
shaise commented 6 months ago

Thanks!!