Skip to content

Commit

Permalink
Add German translation (#261)
Browse files Browse the repository at this point in the history
* Translated using Weblate (English)

Currently translated at 3.8% (16 of 412 strings)

Translation: qdmr/Graphical User Interface
Translate-URL: https://translate.codeberg.org/projects/qdmr/graphical-user-interface/en/

* Added translation using Weblate (German)

* Translated using Weblate (English)

Currently translated at 96.1% (396 of 412 strings)

Translation: qdmr/Graphical User Interface
Translate-URL: https://translate.codeberg.org/projects/qdmr/graphical-user-interface/en/

* Translated using Weblate (German)

Currently translated at 9.4% (39 of 412 strings)

Translation: qdmr/Graphical User Interface
Translate-URL: https://translate.codeberg.org/projects/qdmr/graphical-user-interface/de/

* Translated using Weblate (German)

Currently translated at 9.4% (39 of 412 strings)

Translation: qdmr/Graphical User Interface
Translate-URL: https://translate.codeberg.org/projects/qdmr/graphical-user-interface/de/

* Updated translation strings.

* Translated using Weblate (English)

Currently translated at 95.1% (642 of 675 strings)

Translation: qdmr/Graphical User Interface
Translate-URL: https://translate.codeberg.org/projects/qdmr/graphical-user-interface/en/

* Translated using Weblate (German)

Currently translated at 97.4% (658 of 675 strings)

Translation: qdmr/Graphical User Interface
Translate-URL: https://translate.codeberg.org/projects/qdmr/graphical-user-interface/de/

* Translated using Weblate (German)

Currently translated at 97.4% (658 of 675 strings)

Translation: qdmr/Graphical User Interface
Translate-URL: https://translate.codeberg.org/projects/qdmr/graphical-user-interface/de/

* Added generation of qm files from translated ts files, added translation to GUI.

* Translated using Weblate (English)

Currently translated at 94.8% (640 of 675 strings)

Translation: qdmr/Graphical User Interface
Translate-URL: https://translate.codeberg.org/projects/qdmr/graphical-user-interface/en/

* Translated using Weblate (German)

Currently translated at 97.7% (660 of 675 strings)

Translation: qdmr/Graphical User Interface
Translate-URL: https://translate.codeberg.org/projects/qdmr/graphical-user-interface/de/

* Updated translation strings.

* Translated using Weblate (English)

Currently translated at 96.1% (654 of 680 strings)

Translation: qdmr/Graphical User Interface
Translate-URL: https://translate.codeberg.org/projects/qdmr/graphical-user-interface/en/

* Translated using Weblate (German)

Currently translated at 96.6% (657 of 680 strings)

Translation: qdmr/Graphical User Interface
Translate-URL: https://translate.codeberg.org/projects/qdmr/graphical-user-interface/de/

Co-authored-by: Hannes Matuschek <[email protected]>
Co-authored-by: Hiajen <[email protected]>
Co-authored-by: Weblate <[email protected]>
  • Loading branch information
4 people committed Oct 21, 2022
1 parent 094e915 commit 19f2687
Show file tree
Hide file tree
Showing 9 changed files with 5,838 additions and 614 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ IF(UNIX AND APPLE)
message(STATUS "RPATH: ${CMAKE_INSTALL_RPATH}")
ENDIF(UNIX AND APPLE)

# Directory to install translations to
SET(LOCALE_DIRECTORY "${CMAKE_INSTALL_PREFIX}/share/locale/")

# Sources...
add_subdirectory(lib)
add_subdirectory(cli)
Expand Down
2 changes: 1 addition & 1 deletion i18n/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
update:
lupdate ../src/*.cc ../src/*.hh ../src/*.ui ../shared/ui/*.ui ../lib/*.cc -ts empty.ts
lupdate ../src/*.cc ../src/*.hh ../src/*.ui ../shared/ui/*.ui ../lib/*.cc -ts empty.ts en_US.ts de.ts
3,748 changes: 3,748 additions & 0 deletions i18n/de.ts

Large diffs are not rendered by default.

303 changes: 167 additions & 136 deletions i18n/empty.ts

Large diffs are not rendered by default.

2,341 changes: 1,870 additions & 471 deletions i18n/en_US.ts

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions lib/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
#define VERSION_MINOR @PROJECT_VERSION_MINOR@
#define VERSION_PATCH @PROJECT_VERSION_PATCH@
#define VERSION_STRING @PROJECT_VERSION_STRING@
#define LOCALE_DIRECTORY "@LOCALE_DIRECTORY@"
15 changes: 13 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,17 @@ SET(qdmr_UI_FORMS dmrcontactdialog.ui dtmfcontactdialog.ui rxgrouplistdialog.ui
errormessageview.ui extensionview.ui
deviceselectiondialog.ui radioselectiondialog.ui dmriddialog.ui configobjecttypeselectiondialog.ui)

set(qdmr_TS_FILES ../i18n/de.ts ../i18n/en_US.ts)
qt5_wrap_cpp(qdmr_MOC_SOURCES ${qdmr_MOC_HEADERS})
qt5_wrap_ui(qdmr_UI_SOURCES ${qdmr_UI_FORMS})

qt5_add_translation(qdmr_QM_FILES ${qdmr_TS_FILES})
message(STATUS "Translations at: ${qdmr_QM_FILES}")

qt5_add_resources(qdmr_RCC_SOURCES ../shared/resources.qrc)

add_executable(qdmr WIN32
${qdmr_SOURCES} ${qdmr_MOC_SOURCES} ${qdmr_RCC_SOURCES} ${qdmr_UI_SOURCES})
${qdmr_SOURCES} ${qdmr_MOC_SOURCES} ${qdmr_RCC_SOURCES} ${qdmr_UI_SOURCES} ${qdmr_QM_FILES})

if (UNIX AND APPLE AND INSTALL_BUNDLE)
set_target_properties(qdmr PROPERTIES
Expand All @@ -50,7 +55,7 @@ if (UNIX AND APPLE AND INSTALL_BUNDLE)
MACOSX_BUNDLE_ICON_FILE "Resources/qdmr.icns"
MACOSX_BUNDLE_LONG_VERSION_STRING ${CMAKE_PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING "${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}"
RESOURCE "${CMAKE_SOURCE_DIR}/dist/macosx/qdmr.icns")
RESOURCE "${CMAKE_SOURCE_DIR}/dist/macosx/qdmr.icns" ${qdmr_QM_FILES})
endif(UNIX AND APPLE AND INSTALL_BUNDLE)

target_link_libraries(qdmr ${LIBS} libdmrconf)
Expand All @@ -63,4 +68,10 @@ if (UNIX AND APPLE AND INSTALL_BUNDLE)
RESOURCE DESTINATION "${BUNDLE_PATH}/${CMAKE_PROJECT_NAME}.app/Contents/Resources")
else()
install(TARGETS qdmr DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
foreach(QM_FILE ${qdmr_QM_FILES})
get_filename_component(QM_LANGUAGE ${QM_FILE} NAME_WE)
install(FILES ${QM_FILE}
DESTINATION "${LOCALE_DIRECTORY}/${QM_LANGUAGE}/LC_MESSAGES/"
RENAME "qdmr_qt.qm")
endforeach()
endif(UNIX AND APPLE AND INSTALL_BUNDLE)
37 changes: 33 additions & 4 deletions src/application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#include <QMainWindow>
#include <QtUiTools>
#include <QDesktopServices>
#include <QTranslator>
#include <QStandardPaths>

#include "logger.hh"
#include "radio.hh"
Expand Down Expand Up @@ -38,10 +40,21 @@
#include "deviceselectiondialog.hh"
#include "radioselectiondialog.hh"

inline QStringList getLanguages() {
QStringList languages = {QLocale::system().name()};
if (languages.last().contains("_")) {
languages.append(languages.last().split("_").first());
}
return languages;
}

inline QString getLocalePath(const QString &language) {
return QDir(LOCALE_DIRECTORY "/" + language + "/LC_MESSAGES/").absolutePath();
}

Application::Application(int &argc, char *argv[])
: QApplication(argc, argv), _config(nullptr), _mainWindow(nullptr), _repeater(nullptr),
_lastDevice()
: QApplication(argc, argv), _config(nullptr), _mainWindow(nullptr), _translator(nullptr),
_repeater(nullptr), _lastDevice()
{
setApplicationName("qdmr");
setOrganizationName("DM3MAT");
Expand All @@ -51,18 +64,33 @@ Application::Application(int &argc, char *argv[])
QString logdir = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation);
Logger::get().addHandler(new FileLogHandler(logdir+"/qdmr.log"));

// Register icon themes
// register icon themes
QStringList iconPaths = QIcon::themeSearchPaths();
iconPaths.prepend(":/icons");
QIcon::setThemeSearchPaths(iconPaths);
onPaletteChanged(palette());

// handle translations
_translator = new QTranslator(this);
foreach (QString language, getLanguages()) {
logDebug() << "Search for translation in '" << getLocalePath(language) << "'.";
if (_translator->load("qdmr", getLocalePath(language), "", "_qt.qm")) {
this->installTranslator(_translator);
logDebug() << "Installed translator for locale '" << QLocale::system().name() << "'.";
break;
}
}

// load settings
Settings settings;
// load databases
_repeater = new RepeaterBookList(this);
_users = new UserDatabase(30, this);
_talkgroups = new TalkGroupDatabase(30, this);
_config = new Config(this);
// create empty codeplug
_config = new Config(this);

// Handle args (if there are some)
if (argc>1) {
QFileInfo info(argv[1]);
QFile file(argv[1]);
Expand All @@ -86,6 +114,7 @@ Application::Application(int &argc, char *argv[])
}
}

// load position
_currentPosition = settings.position();
_source = QGeoPositionInfoSource::createDefaultSource(this);
if (_source) {
Expand Down
2 changes: 2 additions & 0 deletions src/application.hh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "radio.hh"

class QMainWindow;
class QTranslator;
class RepeaterBookList;
class UserDatabase;
class TalkGroupDatabase;
Expand Down Expand Up @@ -81,6 +82,7 @@ private slots:
protected:
Config *_config;
QMainWindow *_mainWindow;
QTranslator *_translator;

GeneralSettingsView *_generalSettings;
RadioIDListView *_radioIdTab;
Expand Down

0 comments on commit 19f2687

Please sign in to comment.