Skip to content

Commit

Permalink
Add translation script
Browse files Browse the repository at this point in the history
I don't know the current method to maintain the translations on this WB but
it seems that there are some problems with some strings, so this script
aims to fix that.

- Add bash script to include marked strings on translation files (*.ts)
  - Read from `.ui` files
  - Read from `.py` files
- Make WB name and tooltip translatable

Fix:
- FreeCAD/FreeCAD-translations#135
- FreeCAD/FreeCAD-translations#136
  • Loading branch information
hasecilu authored and amrit3701 committed Mar 5, 2024
1 parent bbec5bf commit 948c0f3
Show file tree
Hide file tree
Showing 3 changed files with 3,955 additions and 240 deletions.
14 changes: 9 additions & 5 deletions InitGui.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,19 @@
wb_icon_path = str(
Path(RebarTools.__file__).parent.absolute() / "icons" / "Reinforcement.svg"
)
FreeCADGui.addLanguagePath(
str(Path(RebarTools.__file__).parent.absolute() / "translations")
)
FreeCADGui.updateLocale()


class ReinforcementWorkbench(FreeCADGui.Workbench):
from FreeCAD import Qt

global wb_icon_path
MenuText = "Reinforcement"
ToolTip = "Create Building Reinforcement"

MenuText = Qt.translate("ReinforcementWorkbench", "Reinforcement")
ToolTip = Qt.translate("ReinforcementWorkbench", "Create Building Reinforcement")
Icon = wb_icon_path

def Initialize(self):
Expand Down Expand Up @@ -67,9 +74,6 @@ def Initialize(self):
/ "preferences"
)
)
FreeCADGui.addLanguagePath(
str(Path(RebarTools.__file__).parent.absolute() / "translations")
)

def Activated(self):
"""This function is executed when the workbench is activated"""
Expand Down
Loading

0 comments on commit 948c0f3

Please sign in to comment.