Translation of strings.

This commit is contained in:
Markus Lampert 2017-01-06 21:09:21 -08:00
parent 3cbf1c32b4
commit 126fe81689
2 changed files with 14 additions and 5 deletions

View File

@ -141,7 +141,7 @@ class HoldingTagsPreferences:
def __init__(self):
self.form = FreeCADGui.PySideUic.loadUi(":/preferences/PathDressupHoldingTags.ui")
self.label = 'Holding Tags'
self.label = translate('PathDressup_HoldingTags', 'Holding Tags')
def loadSettings(self):
self.form.ifWidth.setText(FreeCAD.Units.Quantity(self.defaultWidth(0), FreeCAD.Units.Length).UserString)

View File

@ -27,6 +27,18 @@ import FreeCADGui
from PySide import QtCore, QtGui
from PathScripts.PathPreferences import PathPreferences
# Qt tanslation handling
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def translate(context, text, disambig=None):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def translate(context, text, disambig=None):
return QtGui.QApplication.translate(context, text, disambig)
_dressups = []
def RegisterDressup(dressup):
@ -34,9 +46,8 @@ def RegisterDressup(dressup):
class DressupPreferencesPage:
def __init__(self, parent=None):
print('dressup - __init__')
self.form = QtGui.QToolBox()
self.form.setWindowTitle('Dressups')
self.form.setWindowTitle(translate('PathPreferencesPathDressup', 'Dressups'))
pages = []
for dressup in _dressups:
page = dressup.preferencesPage()
@ -48,12 +59,10 @@ class DressupPreferencesPage:
self.pages = pages
def saveSettings(self):
print('dressup - save settings')
for page in self.pages:
page.saveSettings()
def loadSettings(self):
print('dressup - load settings')
for page in self.pages:
page.loadSettings()