Qt: made translations possible, added german translation (#5)

develop
tastytea 2018-10-18 00:18:11 +02:00
parent 3cbc2323a2
commit 532e4ec95f
No known key found for this signature in database
GPG Key ID: CFC39497F1B26E07
4 changed files with 286 additions and 11 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.6)
project (whyblocked
VERSION 0.8.0
VERSION 0.9.0
LANGUAGES CXX
)
@ -8,6 +8,7 @@ include(GNUInstallDirs)
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBXDG_BASEDIR REQUIRED libxdg-basedir)
find_package(Qt5Widgets CONFIG REQUIRED)
find_package(Qt5LinguistTools)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@ -31,18 +32,29 @@ configure_file (
"${PROJECT_BINARY_DIR}/version.hpp"
)
if(Qt5_LRELEASE_EXECUTABLE)
file(GLOB TS_FILES "translations/*.ts")
file(GLOB TS_SRC_FILES "src/*")
qt5_create_translation(QM_FILES ${TS_SRC_FILES} ${TS_FILES} OPTIONS -no-obsolete)
qt5_add_translation(QM_FILES ${TS_FILES})
endif()
add_executable(whyblocked src/interface_text.cpp src/whyblocked.cpp)
target_link_libraries(whyblocked
${LIBXDG_BASEDIR_LIBRARIES} vsqlitepp stdc++fs)
install(TARGETS whyblocked DESTINATION ${CMAKE_INSTALL_BINDIR})
if(NOT WITHOUT_QT)
add_executable(whyblocked-gui src/interface_qt.cpp src/whyblocked.cpp)
add_executable(whyblocked-gui src/interface_qt.cpp src/whyblocked.cpp ${QM_FILES})
target_link_libraries(whyblocked-gui
${LIBXDG_BASEDIR_LIBRARIES} vsqlitepp stdc++fs Qt5::Widgets)
${LIBXDG_BASEDIR_LIBRARIES} vsqlitepp stdc++fs
Qt5::Widgets)
install(TARGETS whyblocked-gui DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES de.tastytea.Whyblocked.desktop DESTINATION
${CMAKE_INSTALL_DATAROOTDIR}/applications)
install(FILES ${QM_FILES} DESTINATION
${CMAKE_INSTALL_DATAROOTDIR}/qt5/translations)
endif()

View File

@ -17,6 +17,8 @@
#include <regex>
#include <QMessageBox>
#include <QDebug>
#include <QTranslator>
#include <QLibraryInfo>
#include "version.hpp"
#include "whyblocked.hpp"
#include "interface_qt.hpp"
@ -133,8 +135,8 @@ void MainWindow::remove()
void MainWindow::about()
{
QMessageBox::about(this, tr("About whyblocked"),
tr("<p><b>whyblocked</b> %1</p>"
QMessageBox::about(this, tr("About Whyblocked"),
tr("<p><b>Whyblocked</b> %1</p>"
"<p>Reminds you why you blocked someone.</p>"
"<p>Sourcecode: <a href=\"https://schlomp.space/tastytea/whyblocked\">"
"https://schlomp.space/tastytea/whyblocked</a></p>"
@ -259,6 +261,15 @@ int main(int argc, char *argv[])
QApplication app(argc, argv);
QCoreApplication::setApplicationName("Whyblocked");
QTranslator qtTranslator;
qtTranslator.load("qt_" + QLocale::system().name(),
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
app.installTranslator(&qtTranslator);
QTranslator appTranslator;
appTranslator.load("whyblocked_" + QLocale::system().name(),
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
app.installTranslator(&appTranslator);
MainWindow win;
win.show();

View File

@ -88,7 +88,7 @@
<widget class="QStatusBar" name="statusbar"/>
<widget class="QToolBar" name="toolbar">
<property name="windowTitle">
<string>toolBar</string>
<string/>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
@ -205,7 +205,8 @@
</action>
<action name="action_edit">
<property name="icon">
<iconset theme="edit-redo"/>
<iconset theme="edit-redo">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="text">
<string>&amp;Edit</string>

View File

@ -0,0 +1,251 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="de_DE">
<context>
<name>DialogAdd</name>
<message>
<location filename="../src/whyblocked_add.ui" line="14"/>
<source>Add entry</source>
<translation>Eintrag hinzufügen</translation>
</message>
<message>
<location filename="../src/whyblocked_add.ui" line="37"/>
<source>Memory aids, proof</source>
<translation>Gedächtnisstützen, Beweise</translation>
</message>
<message>
<location filename="../src/whyblocked_add.ui" line="40"/>
<source>Rece&amp;ipts</source>
<translation>Be&amp;lege</translation>
</message>
<message>
<location filename="../src/whyblocked_add.ui" line="53"/>
<source>Add receipt</source>
<translation>Beleg hinzufügen</translation>
</message>
<message>
<location filename="../src/whyblocked_add.ui" line="56"/>
<source>&amp;Add</source>
<translation>&amp;Hinzufügen</translation>
</message>
<message>
<location filename="../src/whyblocked_add.ui" line="76"/>
<source>&amp;Blocked</source>
<translation>&amp;Blockiert</translation>
</message>
<message>
<location filename="../src/whyblocked_add.ui" line="95"/>
<source>&amp;Silenced</source>
<translation>&amp;Gedämpft</translation>
</message>
<message>
<location filename="../src/whyblocked_add.ui" line="102"/>
<source>R&amp;eason</source>
<translation>B&amp;egründung</translation>
</message>
<message>
<location filename="../src/whyblocked_add.ui" line="131"/>
<source>Blocked/Silenced</source>
<translation>Blockiert/Gedämpft</translation>
</message>
<message>
<location filename="../src/whyblocked_add.ui" line="141"/>
<source>&amp;User/Instance</source>
<translation>Ben&amp;utzer/Instanz</translation>
</message>
<message>
<location filename="../src/whyblocked_add.ui" line="151"/>
<source>Remove receipt</source>
<translation>Beleg entfernen</translation>
</message>
<message>
<location filename="../src/whyblocked_add.ui" line="154"/>
<source>Re&amp;move</source>
<translation>Ent&amp;fernen</translation>
</message>
<message>
<location filename="../src/interface_qt.cpp" line="218"/>
<source>Insert receipt here.</source>
<translation>Beleg hier einfügen.</translation>
</message>
<message>
<location filename="../src/interface_qt.cpp" line="253"/>
<source>Added %1 to database.</source>
<translation>%1 zur Datenbank hinzugefügt.</translation>
</message>
</context>
<context>
<name>MainWindow</name>
<message>
<location filename="../src/whyblocked.ui" line="14"/>
<source>Whyblocked</source>
<translation></translation>
</message>
<message>
<location filename="../src/whyblocked.ui" line="24"/>
<source>Click or press enter to view receipts</source>
<translation>Klicken oder Eingabe drücken, um Belege zu anzuzeigen</translation>
</message>
<message>
<location filename="../src/whyblocked.ui" line="67"/>
<source>Memory aids, proof</source>
<translation>Gedächtnisstützen, Beweise</translation>
</message>
<message>
<location filename="../src/whyblocked.ui" line="117"/>
<source>&amp;Database</source>
<translation>&amp;Datenbank</translation>
</message>
<message>
<location filename="../src/whyblocked.ui" line="127"/>
<source>&amp;Help</source>
<translation>&amp;Hilfe</translation>
</message>
<message>
<location filename="../src/whyblocked.ui" line="140"/>
<source>&amp;Add</source>
<translation>&amp;Hinzufügen</translation>
</message>
<message>
<location filename="../src/whyblocked.ui" line="143"/>
<source>Add user or instance</source>
<translation>Benutzer oder Instanz hinzufügen</translation>
</message>
<message>
<location filename="../src/whyblocked.ui" line="146"/>
<source>Ctrl+N</source>
<translation>Strg+N</translation>
</message>
<message>
<location filename="../src/whyblocked.ui" line="155"/>
<source>Re&amp;move</source>
<translation>Ent&amp;fernen</translation>
</message>
<message>
<location filename="../src/whyblocked.ui" line="158"/>
<source>Remove user or instance</source>
<translation>Benutzer oder Instanz entfernen</translation>
</message>
<message>
<location filename="../src/whyblocked.ui" line="161"/>
<source>Del</source>
<translation>Entf</translation>
</message>
<message>
<location filename="../src/whyblocked.ui" line="170"/>
<source>&amp;About</source>
<translation>&amp;Über</translation>
</message>
<message>
<location filename="../src/whyblocked.ui" line="173"/>
<source>About this application</source>
<translation>Über dieses Programm</translation>
</message>
<message>
<location filename="../src/whyblocked.ui" line="182"/>
<source>&amp;Reload</source>
<translation>Neu &amp;laden</translation>
</message>
<message>
<location filename="../src/whyblocked.ui" line="185"/>
<source>Reload database</source>
<translation>Datenbank neu laden</translation>
</message>
<message>
<location filename="../src/whyblocked.ui" line="188"/>
<source>Ctrl+R</source>
<translation>Strg+R</translation>
</message>
<message>
<location filename="../src/whyblocked.ui" line="197"/>
<source>&amp;Quit</source>
<translation>&amp;Beenden</translation>
</message>
<message>
<location filename="../src/whyblocked.ui" line="200"/>
<source>Quit application</source>
<translation>Programm beenden</translation>
</message>
<message>
<location filename="../src/whyblocked.ui" line="203"/>
<source>Ctrl+Q</source>
<translation>Strg+Q</translation>
</message>
<message>
<location filename="../src/whyblocked.ui" line="212"/>
<source>&amp;Edit</source>
<translation>B&amp;earbeiten</translation>
</message>
<message>
<location filename="../src/whyblocked.ui" line="215"/>
<location filename="../src/interface_qt.cpp" line="92"/>
<source>Edit entry</source>
<translation>Eintrag bearbeiten</translation>
</message>
<message>
<location filename="../src/whyblocked.ui" line="218"/>
<source>Ctrl+E</source>
<translation>Strg+E</translation>
</message>
<message>
<location filename="../src/interface_qt.cpp" line="40"/>
<source>User/Instance</source>
<translation>Benutzer/Instanz</translation>
</message>
<message>
<location filename="../src/interface_qt.cpp" line="41"/>
<source>Blocked/Silenced</source>
<translation>Blockiert/Gedämpft</translation>
</message>
<message>
<location filename="../src/interface_qt.cpp" line="42"/>
<source>Reason</source>
<translation>Begründung</translation>
</message>
<message>
<location filename="../src/interface_qt.cpp" line="57"/>
<source>Database loaded.</source>
<translation>Datenbank geladen.</translation>
</message>
<message>
<location filename="../src/interface_qt.cpp" line="66"/>
<source>blocked</source>
<translation>blockiert</translation>
</message>
<message>
<location filename="../src/interface_qt.cpp" line="70"/>
<source>silenced</source>
<translation>gedämpft</translation>
</message>
<message>
<location filename="../src/interface_qt.cpp" line="86"/>
<source>Invalid selection</source>
<translation>Ungültige Auswahl</translation>
</message>
<message>
<location filename="../src/interface_qt.cpp" line="87"/>
<source>Please select only 1 entry to edit.</source>
<translation>Bitte nur 1 Eintrag zum bearbeiten auswählen.</translation>
</message>
<message>
<location filename="../src/interface_qt.cpp" line="124"/>
<source>Removed %1 from database.</source>
<translation>%1 aus der Datenbank gelöscht.</translation>
</message>
<message>
<location filename="../src/interface_qt.cpp" line="132"/>
<source>Select data to remove.</source>
<translation>Wähle Daten zum löschen aus.</translation>
</message>
<message>
<location filename="../src/interface_qt.cpp" line="138"/>
<source>About Whyblocked</source>
<translation>Über Whyblocked</translation>
</message>
<message>
<location filename="../src/interface_qt.cpp" line="139"/>
<source>&lt;p&gt;&lt;b&gt;Whyblocked&lt;/b&gt; %1&lt;/p&gt;&lt;p&gt;Reminds you why you blocked someone.&lt;/p&gt;&lt;p&gt;Sourcecode: &lt;a href=&quot;https://schlomp.space/tastytea/whyblocked&quot;&gt;https://schlomp.space/tastytea/whyblocked&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;small&gt;Copyright © 2018 &lt;a href=&quot;mailto:tastytea@tastytea.de&quot;&gt;tastytea&lt;/a&gt;.&lt;br&gt;Licence GPLv3: &lt;a href=&quot;https://www.gnu.org/licenses/gpl-3.0.html&quot;&gt;GNU GPL version 3&lt;/a&gt;.&lt;br&gt;This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions.&lt;/small&gt;&lt;/p&gt;</source>
<translation>&lt;p&gt;&lt;b&gt;Whyblocked&lt;/b&gt; %1&lt;/p&gt;&lt;p&gt;Erinnert dich, warum du jemanden blockiertest.&lt;/p&gt;&lt;p&gt;Quelltext: &lt;a href=&quot;https://schlomp.space/tastytea/whyblocked&quot;&gt;https://schlomp.space/tastytea/whyblocked&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;small&gt;Copyright © 2018 &lt;a href=&quot;mailto:tastytea@tastytea.de&quot;&gt;tastytea&lt;/a&gt;.&lt;br&gt;Lizenz GPLv3: &lt;a href=&quot;https://www.gnu.org/licenses/gpl-3.0.html&quot;&gt;GNU GPL version 3&lt;/a&gt;.&lt;br&gt;Für dieses Programm besteht KEINERLEI GARANTIE. Dies ist freie Software, die Sie unter bestimmten Bedingungen weitergeben dürfen.&lt;/small&gt;&lt;/p&gt;</translation>
</message>
</context>
</TS>