From 80ab56e592500b88eed9b62e4f59aa2979fc155b Mon Sep 17 00:00:00 2001 From: triplus Date: Sat, 11 Mar 2017 14:43:56 +0100 Subject: [PATCH] Navigation indicator translations support --- src/Mod/Tux/NavigationIndicatorGui.py | 183 ++++++++++++++------------ 1 file changed, 102 insertions(+), 81 deletions(-) diff --git a/src/Mod/Tux/NavigationIndicatorGui.py b/src/Mod/Tux/NavigationIndicatorGui.py index 6435e9454444..500cca0d6181 100644 --- a/src/Mod/Tux/NavigationIndicatorGui.py +++ b/src/Mod/Tux/NavigationIndicatorGui.py @@ -30,16 +30,37 @@ p = App.ParamGet("User parameter:Tux/NavigationIndicator") pView = App.ParamGet("User parameter:BaseApp/Preferences/View") -t0 = "Navigation style not recognized." - -t1 = str("""

OpenInventor navigation style

+try: + _encoding = QtGui.QApplication.UnicodeUTF8 + + def translate(context, text): + "convenience function for Qt 4 translator" + return QtGui.QApplication.translate(context, text, None, _encoding) +except AttributeError: + def translate(context, text): + "convenience function for Qt 5 translator" + return QtGui.QApplication.translate(context, text, None) + +text01 = translate("NavigationIndicator", "Select") +text02 = translate("NavigationIndicator", "Zoom") +text03 = translate("NavigationIndicator", "Rotate") +text04 = translate("NavigationIndicator", "Pan") +text05 = translate("NavigationIndicator", "Tilt") +text06 = translate("NavigationIndicator", "navigation style") +text07 = translate("NavigationIndicator", "Page Up or Page Down key.") +text08 = translate("NavigationIndicator", "Rotation focus") +text09 = translate("NavigationIndicator", "Middle mouse button or key H.") + +t0 = translate("NavigationIndicator", "Navigation style not recognized.") + +t1 = "

OpenInventor " + text06 + """

- - - - - + + + + + @@ -48,16 +69,16 @@ -
SelectZoomZoomRotatePan""" + text01 + """""" + text02 + """""" + text02 + """""" + text03 + """""" + text04 + """
""") +""" -t2 = str("""

CAD navigation style

+t2 = "

CAD " + text06 + """

- - - - - + + + + + @@ -66,16 +87,16 @@ -
SelectZoomRotateRotatePan""" + text01 + """""" + text02 + """""" + text03 + """""" + text03 + """""" + text04 + """
""") +""" -t3 = str("""

Blender navigation style

+t3 = "

Blender " + text06 + """

- - - - - + + + + + @@ -84,17 +105,17 @@ -
SelectZoomRotatePanPan""" + text01 + """""" + text02 + """""" + text03 + """""" + text04 + """""" + text04 + """
""") +""" -t4 = str("""

MayaGesture navigation style

+t4 = "

MayaGesture " + text06 + """

- - - - - - + + + + + + @@ -105,12 +126,12 @@ - - - - - - + + + + + + @@ -121,18 +142,18 @@
SelectZoomZoomRotatePanTilt""" + text01 + """""" + text02 + """""" + text02 + """""" + text03 + """""" + text04 + """""" + text05 + """
SelectZoomRotatePanPanTilt""" + text01 + """""" + text02 + """""" + text03 + """""" + text04 + """""" + text04 + """""" + text05 + """
-

Zoom: Page Up or Page Down key.
-Rotation focus: Middle mouse button or key H.

""") +

""" + text02 + ": " + text07 + """
+""" + text08 + ": " + text09 + "

" -t5 = str("""

Touchpad navigation style

+t5 = "

Touchpad " + text06 + """

- - - - - - + + + + + + @@ -143,11 +164,11 @@ - - - - - + + + + + @@ -157,17 +178,17 @@
SelectZoomZoomRotateRotatePan""" + text01 + """""" + text02 + """""" + text02 + """""" + text03 + """""" + text03 + """""" + text04 + """
SelectZoomRotateRotatePan""" + text01 + """""" + text02 + """""" + text03 + """""" + text03 + """""" + text04 + """
-

Zoom: Page Up or Page Down key.

""") +

""" + text02 + ": " + text07 + "

" -t6 = str("""

Gesture navigation style

+t6 = "

Gesture " + text06 + """

- - - - - - + + + + + + @@ -178,12 +199,12 @@ - - - - - - + + + + + + @@ -194,18 +215,18 @@
SelectZoomRotateRotatePanTilt""" + text01 + """""" + text02 + """""" + text03 + """""" + text03 + """""" + text04 + """""" + text05 + """
SelectZoomRotatePanPanTilt""" + text01 + """""" + text02 + """""" + text03 + """""" + text04 + """""" + text04 + """""" + text05 + """
-

Zoom: Page Up or Page Down key.
-Rotation focus: Middle mouse button or key H.

""") +

""" + text02 + ": " + text07 + """
+""" + text08 + ": " + text09 + "

" -t7 = str("""

OpenCascade navigation style

+t7 = "

OpenCascade " + text06 + """

- - - - - - + + + + + + @@ -215,7 +236,7 @@ -
SelectZoomZoomRotatePanPan""" + text01 + """""" + text02 + """""" + text02 + """""" + text03 + """""" + text04 + """""" + text04 + """
""") +""" indicator = QtGui.QPushButton(statusBar) indicator.setFlat(True) @@ -224,23 +245,23 @@ menu = QtGui.QMenu(indicator) indicator.setMenu(menu) -menuSettings = QtGui.QMenu("Settings", menu) -menuOrbit = QtGui.QMenu("Orbit style", menu) +menuSettings = QtGui.QMenu(translate("NavigationIndicator", "Settings"), menu) +menuOrbit = QtGui.QMenu(translate("NavigationIndicator", "Orbit style"), menu) aCompact = QtGui.QAction(menuSettings) -aCompact.setText("Compact") +aCompact.setText(translate("NavigationIndicator", "Compact")) aCompact.setCheckable(True) aTooltip = QtGui.QAction(menuSettings) -aTooltip.setText("Tooltip") +aTooltip.setText(translate("NavigationIndicator", "Tooltip")) aTooltip.setCheckable(True) gOrbit = QtGui.QActionGroup(menuSettings) aTurntable = QtGui.QAction(gOrbit) -aTurntable.setText("Turntable") +aTurntable.setText(translate("NavigationIndicator", "Turntable")) aTurntable.setCheckable(True) aTrackball = QtGui.QAction(gOrbit) -aTrackball.setText("Trackball") +aTrackball.setText(translate("NavigationIndicator", "Trackball")) aTrackball.setCheckable(True) menuOrbit.addAction(aTurntable) @@ -255,7 +276,7 @@ a0 = QtGui.QAction(gStyle) a0.setIcon(QtGui.QIcon(":/icons/NavigationUndefined.svg")) -a0.setText("Undefined") +a0.setText(translate("NavigationIndicator", "Undefined")) a0.setData("Undefined") a0.setObjectName("Indicator_NavigationUndefined")