Skip to content

Commit

Permalink
UI now mostly translated
Browse files Browse the repository at this point in the history
  • Loading branch information
knipknap committed Aug 26, 2023
1 parent b47b186 commit f3bdbb6
Show file tree
Hide file tree
Showing 18 changed files with 517 additions and 90 deletions.
4 changes: 4 additions & 0 deletions btl/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
f"btl_{bcp47}.qm",
)

# Have to import AFTER getting the locale, as FreeCAD may change the locale.
import FreeCAD
translate = FreeCAD.Qt.translate

def install_translator(app):
# First the translator for Qt built-in strings.
path = QLibraryInfo.location(QLibraryInfo.TranslationsPath)
Expand Down
10 changes: 6 additions & 4 deletions btl/machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ def __init__(self,

def validate(self):
if not self.label:
raise AttributeError(f"Machine name is required")
raise AttributeError('Machine name is required')
if self.peak_torque_rpm > self.max_rpm:
raise AttributeError(f"Peak Torque RPM {self.peak_torque_rpm} must be less than max RPM {self.max_rpm}")
err = 'Peak Torque RPM {ptrpm} must be less than max RPM {max_rpm}'
err = err.format(ptrpm=self.peak_torque_rpm, max_rpm=self.max_rpm)
raise AttributeError(err)
if self.max_rpm <= self.min_rpm:
raise AttributeError(f"Max rpm must be larger than min rpm")
raise AttributeError('Max RPM must be larger than min RPM')
if self.max_feed <= self.min_feed:
raise AttributeError(f"Max feed must be larger than min feed")
raise AttributeError('Max feed must be larger than min feed')

def get_torque_at_rpm(self, rpm):
# TODO: More advanced torque curve: lookup table with linear approximation between entries
Expand Down
158 changes: 144 additions & 14 deletions btl/resources/translations/btl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,72 +4,72 @@
<context>
<name>btl</name>
<message>
<location filename="../../ui/library.py" line="135"/>
<location filename="../../ui/library.py" line="133"/>
<source>Move to library...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/library.py" line="175"/>
<location filename="../../ui/library.py" line="173"/>
<source>No job found in main window</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/library.py" line="186"/>
<location filename="../../ui/library.py" line="184"/>
<source>Unused tools</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/library.py" line="253"/>
<location filename="../../ui/library.py" line="251"/>
<source>New Library</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/library.py" line="284"/>
<location filename="../../ui/library.py" line="282"/>
<source>Confirm library deletion</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/library.py" line="418"/>
<location filename="../../ui/library.py" line="416"/>
<source>Delete</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/library.py" line="280"/>
<location filename="../../ui/library.py" line="278"/>
<source>Are you sure you want to delete library {library}? This action cannot be reversed.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/library.py" line="310"/>
<location filename="../../ui/library.py" line="308"/>
<source>Export the tool library {}</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/library.py" line="347"/>
<location filename="../../ui/library.py" line="345"/>
<source>New {}</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/library.py" line="397"/>
<location filename="../../ui/library.py" line="395"/>
<source>Delete tool {tool} from library {library}?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/library.py" line="402"/>
<location filename="../../ui/library.py" line="400"/>
<source>Delete unused tool {tool}?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/library.py" line="407"/>
<location filename="../../ui/library.py" line="405"/>
<source>Delete {n} selected tools from library {library}?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/library.py" line="410"/>
<location filename="../../ui/library.py" line="408"/>
<source>Delete {} unused tools from the library?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/library.py" line="414"/>
<location filename="../../ui/library.py" line="412"/>
<source>Confirm tool deletion</source>
<translation type="unfinished"></translation>
</message>
Expand All @@ -83,6 +83,136 @@
<source>Open an editor to manage ToolBit libraries</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/tablecell.py" line="46"/>
<source>Pocket</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/libraryproperties.py" line="19"/>
<source>Create Library</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/tooleditor.py" line="24"/>
<source>Tool name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/tooleditor.py" line="38"/>
<source>Feeds &amp;&amp; Speeds</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/tooleditor.py" line="45"/>
<source>Attributes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/preferences.py" line="29"/>
<source>Choose a Library File</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/preferences.py" line="30"/>
<source>FreeCAD library files .fctl (*.fctl)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/movetool.py" line="21"/>
<source>Copy Tool</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/shapeselector.py" line="57"/>
<source>Choose a Shape File</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/shapeselector.py" line="58"/>
<source>FreeCAD files .fcstd (*.fcstd)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/feedsandspeeds.py" line="134"/>
<source>Show internal properties</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/feedsandspeeds.py" line="221"/>
<source>Please select a machine.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/feedsandspeeds.py" line="224"/>
<source>Please select a material.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/feedsandspeeds.py" line="227"/>
<source>Please enter the stickout of the tool.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/feedsandspeeds.py" line="230"/>
<source>Tool needs to have more than zero flutes.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/feedsandspeeds.py" line="233"/>
<source>Tool shape not supported by the calculator.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/feedsandspeeds.py" line="241"/>
<source>Calculator error: {error}</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/feedsandspeeds.py" line="274"/>
<source>No valid result found. Best result has error: {error}</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/feedsandspeeds.py" line="284"/>
<source>none</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/toolproperties.py" line="109"/>
<source>Tool location</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/toolproperties.py" line="122"/>
<source>Well-known properties</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/toolproperties.py" line="135"/>
<source>Tool-specific properties</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/toolproperties.py" line="161"/>
<source>Unknown tool attributes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../ui/toolproperties.py" line="172"/>
<source>No unknown attributes found</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../toolmaterial.py" line="12"/>
<source>HSS</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../toolmaterial.py" line="20"/>
<source>Carbide</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Dialog</name>
Expand Down
Binary file modified btl/resources/translations/btl_pt-BR.qm
Binary file not shown.
Loading

0 comments on commit f3bdbb6

Please sign in to comment.