WSL/SLF GitLab Repository

Commit b5a5c575 authored by Mathias Bavay's avatar Mathias Bavay
Browse files

Now properly supporting compiling without support for translations.

(so those who want to skip installing qt5-tools can compile without!)
parent 850ca7ae
......@@ -67,9 +67,18 @@ IF(SUPPORT_TRANSLATIONS)
FILE(GLOB TS_FILES ${PROJECT_SOURCE_DIR}/resources/langs/*.ts)
SET_SOURCE_FILES_PROPERTIES(${TS_FILES} PROPERTIES OUTPUT_LOCATION "resources/l10n")
qt5_add_translation(QM_FILES ${TS_FILES})
#dynamically create a resources file that contains all translations
SET(TRANSLATION_RESOURCES ${PROJECT_SOURCE_DIR}/resources/translations.qrc)
FILE(WRITE ${TRANSLATION_RESOURCES} "<!DOCTYPE RCC><RCC version=\"1.0\">\n\n<qresource>\n")
FOREACH(_qm_file ${QM_FILES})
GET_FILENAME_COMPONENT(_filename ${_qm_file} NAME)
FILE(APPEND ${TRANSLATION_RESOURCES} "\t<file>l10n/${_filename}</file>\n")
ENDFOREACH()
FILE(APPEND ${TRANSLATION_RESOURCES} "</qresource>\n\n</RCC>\n")
ENDIF(SUPPORT_TRANSLATIONS)
ADD_EXECUTABLE(${TARGET} ${TARGET_TYPE} ${EXTRA_LIBS_SRC} ${SOURCES} ${RESOURCES} ${QM_FILES})
ADD_EXECUTABLE(${TARGET} ${TARGET_TYPE} ${EXTRA_LIBS_SRC} ${SOURCES} ${RESOURCES} ${QM_FILES} ${TRANSLATION_RESOURCES})
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/")
TARGET_LINK_LIBRARIES(${TARGET} ${QT5_LIBRARIES})
......
......@@ -34,7 +34,7 @@ OR find icons/ -name "*.svg" | grep "elementary" | awk '{printf("<file>%s</file>
<file>icons/inishell_192.ico</file>
<file>config_schema.xsd</file>
<file>l10n/inishell_de.qm</file>
<!--<file>l10n/inishell_de.qm</file>-->
<file>doc/help.xml</file>
<file>doc/help_dev.xml</file>
......
......@@ -4,5 +4,6 @@
#define PROJECT_NAME "@PROJECT_NAME@"
#define APP_VERSION_STR "@PROJECT_VERSION@"
#cmakedefine SUPPORT_TRANSLATIONS
#endif // INCLUDE_GUARD
......@@ -304,6 +304,7 @@ int main(int argc, char *argv[])
return 0;
/* GUI mode when reaching this */
#ifdef SUPPORT_TRANSLATIONS
const QString language( getSetting("user::appearance::language", "value") );
QTranslator translator; //can't go out of scope
if (!language.isEmpty() && language != "en") { //texts that are not found will remain in English
......@@ -317,6 +318,9 @@ int main(int argc, char *argv[])
"\" is not a valid language file.");
}
} //endif language
#else
std::cerr << "This version was compiled without support for translations, reverting to English\n";
#endif
setAppStylesheet(app, cmd_args);
//open MainWindow with the XML settings and their path, and errors that occurred so far:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment