Skip to content

Commit

Permalink
Reintroduced translations
Browse files Browse the repository at this point in the history
  • Loading branch information
Odizinne committed Aug 16, 2024
1 parent d2d3a90 commit bcdfd22
Show file tree
Hide file tree
Showing 10 changed files with 180 additions and 8 deletions.
7 changes: 6 additions & 1 deletion HeadsetControl-Qt.pro
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,13 @@ HEADERS += \
FORMS += \
src/HeadsetControlQt/headsetcontrolqt.ui

TRANSLATIONS += \
src/Resources/tr/HeadsetControl-Qt_fr.ts \
src/Resources/tr/HeadsetControl-Qt_en.ts

RESOURCES += \
src/Resources/resources.qrc
src/Resources/resources.qrc \
src/Resources/translations.qrc

RC_FILE = src/Resources/appicon.rc

Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ Precompiled windows binaries can be found in [release](https://github.com/odizin
## To-do
- Add other headsetcontrol supported settings (My headset does not support them so i cannot test)
- Bring back linux support
- Bring back translations
2 changes: 1 addition & 1 deletion src/HeadsetControlQt/headsetcontrolqt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ HeadsetControlQt::HeadsetControlQt(QWidget *parent)
ui->setupUi(this);
setWindowTitle("HeadsetControl-Qt");
setWindowIcon(QIcon(":/icons/icon.png"));
setFixedSize(size());
setFont();
loadSettings();
initUI();
Expand Down Expand Up @@ -329,6 +328,7 @@ void HeadsetControlQt::toggleUIElements(bool show)
ui->notFoundLabel->setVisible(!show);
this->setMinimumSize(0, 0);
this->adjustSize();
this->setFixedSize(this->size());
}

void HeadsetControlQt::onLedBoxStateChanged()
Expand Down
10 changes: 5 additions & 5 deletions src/HeadsetControlQt/headsetcontrolqt.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>433</width>
<width>381</width>
<height>351</height>
</rect>
</property>
Expand Down Expand Up @@ -180,7 +180,7 @@
<widget class="QSpinBox" name="lightBatterySpinbox">
<property name="minimumSize">
<size>
<width>100</width>
<width>0</width>
<height>25</height>
</size>
</property>
Expand All @@ -207,15 +207,15 @@
</size>
</property>
<property name="text">
<string>Send notification when battery goes below</string>
<string>Send notification when battery goes below:</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QSpinBox" name="notificationBatterySpinbox">
<property name="minimumSize">
<size>
<width>100</width>
<width>0</width>
<height>25</height>
</size>
</property>
Expand Down Expand Up @@ -295,7 +295,7 @@
<widget class="QComboBox" name="themeComboBox">
<property name="minimumSize">
<size>
<width>100</width>
<width>0</width>
<height>25</height>
</size>
</property>
Expand Down
Binary file added src/Resources/tr/HeadsetControl-Qt_en.qm
Binary file not shown.
77 changes: 77 additions & 0 deletions src/Resources/tr/HeadsetControl-Qt_en.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="en_US">
<context>
<name>HeadsetControlQt</name>
<message>
<location filename="../../HeadsetControlQt/headsetcontrolqt.ui" line="20"/>
<source>HeadsetControl-Qt</source>
<translation></translation>
</message>
<message>
<location filename="../../HeadsetControlQt/headsetcontrolqt.ui" line="44"/>
<source>GroupBox</source>
<translation></translation>
</message>
<message>
<location filename="../../HeadsetControlQt/headsetcontrolqt.ui" line="61"/>
<source>Battery</source>
<translation></translation>
</message>
<message>
<location filename="../../HeadsetControlQt/headsetcontrolqt.ui" line="90"/>
<source>Sidetone</source>
<translation></translation>
</message>
<message>
<location filename="../../HeadsetControlQt/headsetcontrolqt.ui" line="121"/>
<source>Lights</source>
<translation></translation>
</message>
<message>
<location filename="../../HeadsetControlQt/headsetcontrolqt.ui" line="156"/>
<source>Disable lights when battery goes below:</source>
<translation></translation>
</message>
<message>
<location filename="../../HeadsetControlQt/headsetcontrolqt.ui" line="210"/>
<source>Send notification when battery goes below</source>
<translation></translation>
</message>
<message>
<location filename="../../HeadsetControlQt/headsetcontrolqt.ui" line="256"/>
<source>Settings</source>
<translation></translation>
</message>
<message>
<location filename="../../HeadsetControlQt/headsetcontrolqt.ui" line="271"/>
<source>Icon theme</source>
<translation></translation>
</message>
<message>
<location filename="../../HeadsetControlQt/headsetcontrolqt.ui" line="313"/>
<source>Run at startup</source>
<translation></translation>
</message>
<message>
<location filename="../../HeadsetControlQt/headsetcontrolqt.ui" line="351"/>
<source>No supported headset found.</source>
<translation></translation>
</message>
<message>
<location filename="../../HeadsetControlQt/headsetcontrolqt.cpp" line="63"/>
<source>System</source>
<translation></translation>
</message>
<message>
<location filename="../../HeadsetControlQt/headsetcontrolqt.cpp" line="64"/>
<source>Dark</source>
<translation></translation>
</message>
<message>
<location filename="../../HeadsetControlQt/headsetcontrolqt.cpp" line="65"/>
<source>Light</source>
<translation></translation>
</message>
</context>
</TS>
Binary file added src/Resources/tr/HeadsetControl-Qt_fr.qm
Binary file not shown.
77 changes: 77 additions & 0 deletions src/Resources/tr/HeadsetControl-Qt_fr.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="fr_FR">
<context>
<name>HeadsetControlQt</name>
<message>
<location filename="../../HeadsetControlQt/headsetcontrolqt.ui" line="20"/>
<source>HeadsetControl-Qt</source>
<translation></translation>
</message>
<message>
<location filename="../../HeadsetControlQt/headsetcontrolqt.ui" line="44"/>
<source>GroupBox</source>
<translation></translation>
</message>
<message>
<location filename="../../HeadsetControlQt/headsetcontrolqt.ui" line="61"/>
<source>Battery</source>
<translation>Batterie</translation>
</message>
<message>
<location filename="../../HeadsetControlQt/headsetcontrolqt.ui" line="90"/>
<source>Sidetone</source>
<translation>Retour voix</translation>
</message>
<message>
<location filename="../../HeadsetControlQt/headsetcontrolqt.ui" line="121"/>
<source>Lights</source>
<translation>LEDs</translation>
</message>
<message>
<location filename="../../HeadsetControlQt/headsetcontrolqt.ui" line="156"/>
<source>Disable lights when battery goes below:</source>
<translation>Désactiver les LEDs quand la batterie atteint:</translation>
</message>
<message>
<location filename="../../HeadsetControlQt/headsetcontrolqt.ui" line="210"/>
<source>Send notification when battery goes below</source>
<translation>Envoyer une notification quand la batterie atteint:</translation>
</message>
<message>
<location filename="../../HeadsetControlQt/headsetcontrolqt.ui" line="256"/>
<source>Settings</source>
<translation>Paramètres</translation>
</message>
<message>
<location filename="../../HeadsetControlQt/headsetcontrolqt.ui" line="271"/>
<source>Icon theme</source>
<translation>Thème d&apos;icones</translation>
</message>
<message>
<location filename="../../HeadsetControlQt/headsetcontrolqt.ui" line="313"/>
<source>Run at startup</source>
<translation>Lancer au démarrage</translation>
</message>
<message>
<location filename="../../HeadsetControlQt/headsetcontrolqt.ui" line="351"/>
<source>No supported headset found.</source>
<translation>Aucun casque détecté.</translation>
</message>
<message>
<location filename="../../HeadsetControlQt/headsetcontrolqt.cpp" line="63"/>
<source>System</source>
<translation>Système</translation>
</message>
<message>
<location filename="../../HeadsetControlQt/headsetcontrolqt.cpp" line="64"/>
<source>Dark</source>
<translation>Sombre</translation>
</message>
<message>
<location filename="../../HeadsetControlQt/headsetcontrolqt.cpp" line="65"/>
<source>Light</source>
<translation>Clair</translation>
</message>
</context>
</TS>
6 changes: 6 additions & 0 deletions src/Resources/translations.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<RCC>
<qresource prefix="/translations">
<file>tr/HeadsetControl-Qt_en.qm</file>
<file>tr/HeadsetControl-Qt_fr.qm</file>
</qresource>
</RCC>
8 changes: 8 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
#include "headsetcontrolqt.h"

#include <QApplication>
#include <QLocale>
#include <QTranslator>

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
a.setStyle("fusion");
QLocale locale;
QString languageCode = locale.name().section('_', 0, 0);
QTranslator translator;
if (translator.load(":/translations/tr/HeadsetControl-Qt_" + languageCode + ".qm")) {
a.installTranslator(&translator);
}
HeadsetControlQt w;
return a.exec();
}

0 comments on commit bcdfd22

Please sign in to comment.