Skip to content

Commit

Permalink
prepare for translation
Browse files Browse the repository at this point in the history
  • Loading branch information
Odizinne committed Aug 5, 2024
1 parent b33b05c commit ebb18ab
Show file tree
Hide file tree
Showing 5 changed files with 268 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/headsetcontrol-qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import os
from PyQt6.QtWidgets import QApplication, QMainWindow, QSystemTrayIcon, QMenu
from PyQt6.QtGui import QIcon, QAction
from PyQt6.QtCore import QTimer
from PyQt6.QtCore import QTimer, QTranslator, QLocale
from ui_mainwindow import Ui_HeadsetControlQt
from color_utils import set_frame_color_based_on_window
from utils import is_windows_10
Expand Down Expand Up @@ -395,6 +395,21 @@ def check_startup_checkbox(self):

if __name__ == "__main__":
app = QApplication(sys.argv)
translator = QTranslator()
locale = QLocale.system().name()
if locale.startswith("en"):
file_name = "tr/qms_en.qm"
elif locale.startswith("es"):
file_name = "tr/qms_es.qm"
elif locale.startswith("fr"):
file_name = "tr/qms_fr.qm"
elif locale.startswith("de"):
file_name = "tr/qms_de.qm"
else:
file_name = None

if file_name and translator.load(file_name):
app.installTranslator(translator)
if is_windows_10():
app.setStyle("fusion")
window = HeadsetControlApp()
Expand Down
63 changes: 63 additions & 0 deletions src/tr/headsetcontrol-qt_de.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>HeadsetControlQt</name>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>MainWindow</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>No supported headset found.</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>Icon theme</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>Run at startup</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>Lights</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>Battery</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>Sidetone</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>Disable lights when battery goes below:</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>Send notification when battery goes below</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>TextLabel</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>General settings</source>
<translation type="unfinished" />
</message>
</context>
</TS>
63 changes: 63 additions & 0 deletions src/tr/headsetcontrol-qt_en.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>HeadsetControlQt</name>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>MainWindow</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>No supported headset found.</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>Icon theme</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>Run at startup</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>Lights</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>Battery</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>Sidetone</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>Disable lights when battery goes below:</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>Send notification when battery goes below</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>TextLabel</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>General settings</source>
<translation type="unfinished" />
</message>
</context>
</TS>
63 changes: 63 additions & 0 deletions src/tr/headsetcontrol-qt_es.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>HeadsetControlQt</name>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>MainWindow</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>No supported headset found.</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>Icon theme</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>Run at startup</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>Lights</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>Battery</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>Sidetone</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>Disable lights when battery goes below:</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>Send notification when battery goes below</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>TextLabel</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>General settings</source>
<translation type="unfinished" />
</message>
</context>
</TS>
63 changes: 63 additions & 0 deletions src/tr/headsetcontrol-qt_fr.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>HeadsetControlQt</name>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>MainWindow</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>No supported headset found.</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>Icon theme</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>Run at startup</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>Lights</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>Battery</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>Sidetone</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>Disable lights when battery goes below:</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>Send notification when battery goes below</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>TextLabel</source>
<translation type="unfinished" />
</message>
<message>
<location filename="..\designer\ui_mainwindow.ui" line="0" />
<source>General settings</source>
<translation type="unfinished" />
</message>
</context>
</TS>

0 comments on commit ebb18ab

Please sign in to comment.