From 4b64ee467c4b56fa62a38dc9b1561a17328f3075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Thu, 8 Feb 2018 18:16:44 +0100 Subject: [PATCH] Moved translations outside of the binary --- gpxsee.qrc | 5 ----- pkg/gpxsee.nsi | 26 ++++++++++++++++++++++++++ pkg/gpxsee64.nsi | 28 +++++++++++++++++++++++++++- src/GUI/app.cpp | 3 +-- src/config.h | 1 + 5 files changed, 55 insertions(+), 8 deletions(-) diff --git a/gpxsee.qrc b/gpxsee.qrc index 6f2d14eb..90a57df4 100644 --- a/gpxsee.qrc +++ b/gpxsee.qrc @@ -20,10 +20,5 @@ icons/system-run.png icons/document-print-preview.png icons/view-filter.png - lang/gpxsee_cs.qm - lang/gpxsee_sv.qm - lang/gpxsee_de.qm - lang/gpxsee_ru.qm - lang/gpxsee_fi.qm diff --git a/pkg/gpxsee.nsi b/pkg/gpxsee.nsi index 81ec9ce8..96858ae3 100644 --- a/pkg/gpxsee.nsi +++ b/pkg/gpxsee.nsi @@ -196,6 +196,29 @@ Section "ANGLE" SEC_ANGLE SectionEnd +SectionGroup "Localization" SEC_LOCALE + Section "Czech" + CreateDirectory "$INSTDIR\locale" + File /oname=locale\gpxsee_cs.qm locale\gpxsee_cs.qm + SectionEnd + Section "German" + CreateDirectory "$INSTDIR\locale" + File /oname=locale\gpxsee_de.qm locale\gpxsee_de.qm + SectionEnd + Section "Finish" + CreateDirectory "$INSTDIR\locale" + File /oname=locale\gpxsee_fi.qm locale\gpxsee_fi.qm + SectionEnd + Section "Russian" + CreateDirectory "$INSTDIR\locale" + File /oname=locale\gpxsee_ru.qm locale\gpxsee_ru.qm + SectionEnd + Section "Swedish" + CreateDirectory "$INSTDIR\locale" + File /oname=locale\gpxsee_sv.qm locale\gpxsee_sv.qm + SectionEnd +SectionGroupEnd + ;-------------------------------- ; Uninstaller @@ -247,6 +270,8 @@ LangString DESC_ANGLE ${LANG_ENGLISH} \ "ANGLE (OpenGL via Direct3D). Enables OpenGL on systems without native OpenGL drivers." LangString DESC_APP ${LANG_ENGLISH} \ "GPXSee application" +LangString DESC_LOCALE ${LANG_ENGLISH} \ + "Localization" ;Assign language strings to sections !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN @@ -255,4 +280,5 @@ LangString DESC_APP ${LANG_ENGLISH} \ !insertmacro MUI_DESCRIPTION_TEXT ${SEC_ANGLE} $(DESC_ANGLE) !insertmacro MUI_DESCRIPTION_TEXT ${SEC_MSVC} $(DESC_MSVC) !insertmacro MUI_DESCRIPTION_TEXT ${SEC_APP} $(DESC_APP) + !insertmacro MUI_DESCRIPTION_TEXT ${SEC_LOCALE} $(DESC_LOCALE) !insertmacro MUI_FUNCTION_DESCRIPTION_END diff --git a/pkg/gpxsee64.nsi b/pkg/gpxsee64.nsi index 163cd975..9129ba58 100644 --- a/pkg/gpxsee64.nsi +++ b/pkg/gpxsee64.nsi @@ -198,6 +198,29 @@ Section "ANGLE" SEC_ANGLE SectionEnd +SectionGroup "Localization" SEC_LOCALE + Section "Czech" + CreateDirectory "$INSTDIR\locale" + File /oname=locale\gpxsee_cs.qm locale\gpxsee_cs.qm + SectionEnd + Section "German" + CreateDirectory "$INSTDIR\locale" + File /oname=locale\gpxsee_de.qm locale\gpxsee_de.qm + SectionEnd + Section "Finish" + CreateDirectory "$INSTDIR\locale" + File /oname=locale\gpxsee_fi.qm locale\gpxsee_fi.qm + SectionEnd + Section "Russian" + CreateDirectory "$INSTDIR\locale" + File /oname=locale\gpxsee_ru.qm locale\gpxsee_ru.qm + SectionEnd + Section "Swedish" + CreateDirectory "$INSTDIR\locale" + File /oname=locale\gpxsee_sv.qm locale\gpxsee_sv.qm + SectionEnd +SectionGroupEnd + ;-------------------------------- ; Uninstaller @@ -250,6 +273,8 @@ LangString DESC_ANGLE ${LANG_ENGLISH} \ "ANGLE (OpenGL via Direct3D). Enables OpenGL on systems without native OpenGL drivers." LangString DESC_APP ${LANG_ENGLISH} \ "GPXSee application" +LangString DESC_LOCALE ${LANG_ENGLISH} \ + "Localization" ;Assign language strings to sections !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN @@ -258,4 +283,5 @@ LangString DESC_APP ${LANG_ENGLISH} \ !insertmacro MUI_DESCRIPTION_TEXT ${SEC_ANGLE} $(DESC_ANGLE) !insertmacro MUI_DESCRIPTION_TEXT ${SEC_MSVC} $(DESC_MSVC) !insertmacro MUI_DESCRIPTION_TEXT ${SEC_APP} $(DESC_APP) -!insertmacro MUI_FUNCTION_DESCRIPTION_END + !insertmacro MUI_DESCRIPTION_TEXT ${SEC_LOCALE} $(DESC_LOCALE) +!insertmacro MUI_FUNCTION_DESCRIPTION_END \ No newline at end of file diff --git a/src/GUI/app.cpp b/src/GUI/app.cpp index eccf1d64..3c4aee53 100644 --- a/src/GUI/app.cpp +++ b/src/GUI/app.cpp @@ -19,8 +19,7 @@ App::App(int &argc, char **argv) : QApplication(argc, argv), _argc(argc), _argv(argv) { QTranslator *gpxsee = new QTranslator(this); - QString locale = QLocale::system().name(); - gpxsee->load(QString(":/lang/gpxsee_") + locale); + gpxsee->load(QLocale::system(), "gpxsee", "_", LOCALE_DIR); installTranslator(gpxsee); QTranslator *qt = new QTranslator(this); diff --git a/src/config.h b/src/config.h index 6f1b76b9..b3defcf3 100644 --- a/src/config.h +++ b/src/config.h @@ -41,5 +41,6 @@ #define GLOBAL_MAP_DIR GLOBAL_DIR + QString("/") + MAP_DIR #define GLOBAL_POI_DIR GLOBAL_DIR + QString("/") + POI_DIR #define TILES_DIR USER_DIR + QString("/tiles") +#define LOCALE_DIR GLOBAL_DIR + QString("/locale") #endif /* CONFIG_H */