Skip to content

Commit

Permalink
added french translation
Browse files Browse the repository at this point in the history
  • Loading branch information
Odizinne committed Nov 10, 2024
1 parent b392a25 commit a5a316b
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 8 deletions.
1 change: 1 addition & 0 deletions ACMBKz.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"excluded":[],"includePaths":["C:/Users/Flora/Projects/QuickSoundSwitcher/QuickSoundSwitcher","C:/Users/Flora/Projects/QuickSoundSwitcher/Utils","C:/Users/Flora/Projects/QuickSoundSwitcher/Panel","C:/Users/Flora/Projects/QuickSoundSwitcher/AudioManager","C:/Users/Flora/Projects/QuickSoundSwitcher/ShortcutManager","C:/Qt/6.8.0/msvc2022_64/include","C:/Qt/6.8.0/msvc2022_64/include/QtWidgets","C:/Qt/6.8.0/msvc2022_64/include/QtGui","C:/Qt/6.8.0/msvc2022_64/include/QtCore","C:/Users/Flora/Projects/QuickSoundSwitcher","C:/Users/Flora/Projects/QuickSoundSwitcher"],"projectFile":"C:/Users/Flora/Projects/QuickSoundSwitcher/QuickSoundSwitcher.pro","sources":["C:/Users/Flora/Projects/QuickSoundSwitcher/AudioManager/AudioManager.cpp","C:/Users/Flora/Projects/QuickSoundSwitcher/AudioManager/AudioManager.h","C:/Users/Flora/Projects/QuickSoundSwitcher/AudioManager/PolicyConfig.h","C:/Users/Flora/Projects/QuickSoundSwitcher/Panel/Panel.cpp","C:/Users/Flora/Projects/QuickSoundSwitcher/Panel/Panel.h","C:/Users/Flora/Projects/QuickSoundSwitcher/Panel/Panel.ui","C:/Users/Flora/Projects/QuickSoundSwitcher/QuickSoundSwitcher/QuickSoundSwitcher.cpp","C:/Users/Flora/Projects/QuickSoundSwitcher/QuickSoundSwitcher/QuickSoundSwitcher.h","C:/Users/Flora/Projects/QuickSoundSwitcher/ShortcutManager/ShortcutManager.cpp","C:/Users/Flora/Projects/QuickSoundSwitcher/ShortcutManager/ShortcutManager.h","C:/Users/Flora/Projects/QuickSoundSwitcher/Utils/Utils.cpp","C:/Users/Flora/Projects/QuickSoundSwitcher/Utils/Utils.h","C:/Users/Flora/Projects/QuickSoundSwitcher/main.cpp"],"translations":["C:/Users/Flora/Projects/QuickSoundSwitcher/Resources/Tr/QuickSoundSwitcher_fr.ts","C:/Users/Flora/Projects/QuickSoundSwitcher/Resources/Tr/QuickSoundSwitcher_en.ts"]}]
6 changes: 3 additions & 3 deletions Panel/Panel.ui
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
<string notr="true">Form</string>
</property>
<property name="autoFillBackground">
<bool>true</bool>
Expand Down Expand Up @@ -103,7 +103,7 @@
</size>
</property>
<property name="text">
<string>...</string>
<string notr="true">...</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -172,7 +172,7 @@
</size>
</property>
<property name="text">
<string>...</string>
<string notr="true">...</string>
</property>
</widget>
</item>
Expand Down
8 changes: 7 additions & 1 deletion QuickSoundSwitcher.pro
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ QT += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG += c++17
CONFIG += c++17 silent lrelease embed_translations

QM_FILES_RESOURCE_PREFIX = /translations

INCLUDEPATH += \
QuickSoundSwitcher/ \
Expand Down Expand Up @@ -30,6 +32,10 @@ HEADERS += \
FORMS += \
Panel/Panel.ui \

TRANSLATIONS += \
Resources/Tr/QuickSoundSwitcher_fr.ts \
Resources/Tr/QuickSoundSwitcher_en.ts \

RESOURCES += \
Resources/resources.qrc \

Expand Down
4 changes: 2 additions & 2 deletions QuickSoundSwitcher/QuickSoundSwitcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ void QuickSoundSwitcher::createTrayIcon()
onOutputMuteChanged();
QMenu *trayMenu = new QMenu(this);

QAction *startupAction = new QAction("Run at startup", this);
QAction *startupAction = new QAction(tr("Run at startup"), this);
startupAction->setCheckable(true);
startupAction->setChecked(ShortcutManager::isShortcutPresent());
connect(startupAction, &QAction::triggered, this, &QuickSoundSwitcher::onRunAtStartupStateChanged);
trayMenu->addAction(startupAction);

QAction *exitAction = new QAction("Exit", this);
QAction *exitAction = new QAction(tr("Exit"), this);
connect(exitAction, &QAction::triggered, this, &QApplication::quit);
trayMenu->addAction(exitAction);

Expand Down
35 changes: 35 additions & 0 deletions Resources/Tr/QuickSoundSwitcher_en.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="en_US">
<context>
<name>Panel</name>
<message>
<location filename="../../Panel/Panel.ui" line="71"/>
<source>Input</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../Panel/Panel.ui" line="221"/>
<source>Output</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../Panel/Panel.ui" line="271"/>
<source>Volume mixer</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QuickSoundSwitcher</name>
<message>
<location filename="../../QuickSoundSwitcher/QuickSoundSwitcher.cpp" line="28"/>
<source>Run at startup</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../QuickSoundSwitcher/QuickSoundSwitcher.cpp" line="34"/>
<source>Exit</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>
35 changes: 35 additions & 0 deletions Resources/Tr/QuickSoundSwitcher_fr.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="fr_FR">
<context>
<name>Panel</name>
<message>
<location filename="../../Panel/Panel.ui" line="71"/>
<source>Input</source>
<translation>Entrée</translation>
</message>
<message>
<location filename="../../Panel/Panel.ui" line="221"/>
<source>Output</source>
<translation>Sortie</translation>
</message>
<message>
<location filename="../../Panel/Panel.ui" line="271"/>
<source>Volume mixer</source>
<translation>Mélangeur de volume</translation>
</message>
</context>
<context>
<name>QuickSoundSwitcher</name>
<message>
<location filename="../../QuickSoundSwitcher/QuickSoundSwitcher.cpp" line="28"/>
<source>Run at startup</source>
<translation>Lancer au démarrage</translation>
</message>
<message>
<location filename="../../QuickSoundSwitcher/QuickSoundSwitcher.cpp" line="34"/>
<source>Exit</source>
<translation>Quitter</translation>
</message>
</context>
</TS>
15 changes: 13 additions & 2 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,24 @@
#include <QApplication>
#include <QMessageBox>
#include <QProcess>
#include <QDebug>
#include <QTranslator>
#include <QLocale>

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QuickSoundSwitcher w;
a.setStyle("fusion");
a.setQuitOnLastWindowClosed(false);

QLocale locale;
QString languageCode = locale.name().section('_', 0, 0);
QTranslator translator;

if (translator.load(":/translations/QuickSoundSwitcher_" + languageCode + ".qm")) {
a.installTranslator(&translator);
}

QuickSoundSwitcher w;

return a.exec();
}

0 comments on commit a5a316b

Please sign in to comment.