Skip to content

Commit

Permalink
Add german translation for screen settings
Browse files Browse the repository at this point in the history
  • Loading branch information
rkunze committed Oct 4, 2017
1 parent 62bf5fe commit 1be20c0
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ class DisplaySettingsPlugin(LauncherPlugin):

def __init__(self, application):
LauncherPlugin.__init__(self, application)
self.mainWindow = TouchWindow(QCoreApplication.translate("main", "Settings"))

translator = QTranslator()
path = os.path.dirname(os.path.realpath(__file__))
translator.load(self.locale(), os.path.join(path, "display_"))
self.installTranslator(translator)

self.mainWindow = TouchWindow(QCoreApplication.translate("main", "Display"))
rotation = 0
try:
config = open("/etc/default/launcher", "r")
Expand All @@ -23,16 +29,16 @@ def __init__(self, application):
self.vbox = QVBoxLayout()
self.mainWindow.centralWidget.setLayout(self.vbox)
self.rotate = QComboBox()
self.rotate.addItem(QCoreApplication.translate("main", "Rotate 0°"))
self.rotate.addItem(QCoreApplication.translate("main", "Rotate 90°"))
self.rotate.addItem(QCoreApplication.translate("main", "Rotate 180°"))
self.rotate.addItem(QCoreApplication.translate("main", "Rotate 270°"))
self.rotate.addItem(QCoreApplication.translate("main", "Rotate 0"))
self.rotate.addItem(QCoreApplication.translate("main", "Rotate 90"))
self.rotate.addItem(QCoreApplication.translate("main", "Rotate 180"))
self.rotate.addItem(QCoreApplication.translate("main", "Rotate 270"))
rot_idx = int(rotation / 90)
if (rot_idx < 4):
self.rotate.setCurrentIndex(rot_idx)
self.rotate.activated.connect(self.on_change_orientation)
self.vbox.addWidget(self.rotate)
self.calibrate = QPushButton(QCoreApplication.translate("main", "Calibrate touch"))
self.calibrate = QPushButton(QCoreApplication.translate("main", "Calibrate\ntouchscreen"))
self.calibrate.clicked.connect(self.on_calibrate_touchscreen)
self.vbox.addWidget(self.calibrate)
self.mainWindow.show()
Expand All @@ -44,14 +50,15 @@ def on_calibrate_touchscreen(self):
self.mainWindow.show()
old_window.close()
subprocess.run(["sudo", "/usr/bin/ts_calibrate"])
self.restart_launcher(QCoreApplication.translate("main", "Activating new touch screen calibration..."))
self.restart_launcher(QCoreApplication.translate("main", "Activating new touchscreen calibration..."))

def on_change_orientation(self, index):
rotation = index * 90
config = open("/etc/default/launcher", "w")
config.write("SCREEN_ROTATION=%i\n" % rotation)
config.close()
self.restart_launcher(QCoreApplication.translate("main", "Rotating screen to %i°...") % rotation)
msg = QCoreApplication.translate("main", "Rotating screen to %i...")
self.restart_launcher(msg % rotation)

def restart_launcher(self, text):
old_window = self.mainWindow
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="de" sourcelanguage="en">
<context>
<name>main</name>
<message>
<location filename="display.py" line="41"/>
<source>Calibrate
touchscreen</source>
<translation>Touchscreen
kalibrieren</translation>
</message>
<message>
<location filename="display.py" line="53"/>
<source>Activating new touchscreen calibration...</source>
<translation>Übernehme neue Touchscreen-Kalibrierung...</translation>
</message>
<message>
<location filename="display.py" line="60"/>
<source>Rotating screen to %i...</source>
<translation>Bildschirm wird gedreht (%i°)...</translation>
</message>
<message>
<location filename="display.py" line="32"/>
<source>Rotate 0</source>
<translation>Rotation 0</translation>
</message>
<message>
<location filename="display.py" line="33"/>
<source>Rotate 90</source>
<translation>Rotation 90</translation>
</message>
<message>
<location filename="display.py" line="34"/>
<source>Rotate 180</source>
<translation>Rotation 180</translation>
</message>
<message>
<location filename="display.py" line="35"/>
<source>Rotate 270</source>
<translation>Rotation 270</translation>
</message>
<message>
<location filename="display.py" line="19"/>
<source>Display</source>
<translation>Bildschirm</translation>
</message>
</context>
</TS>

0 comments on commit 1be20c0

Please sign in to comment.