WSL/SLF GitLab Repository

Commit 557e03cc authored by Mathias Bavay's avatar Mathias Bavay
Browse files

I did not manage to have Inishell opening up in German, but at least the...

I did not manage to have Inishell opening up in German, but at least the translation files can be generated and don't stop the compilation
parent c9861055
......@@ -64,52 +64,13 @@ SET(SUPPORT_TRANSLATIONS OFF CACHE BOOL "Support translating the user interface?
IF(SUPPORT_TRANSLATIONS)
FIND_PACKAGE(Qt5LinguistTools REQUIRED)
MARK_AS_ADVANCED(FORCE Qt5LinguistTools_DIR)
SET(REFRESH_TRANSLATION_FILES OFF CACHE BOOL "Regenerate the translation files? (this will overwrite the existing .ts files)")
IF(REFRESH_TRANSLATION_FILES)
qt5_create_translation(QM_FILES ${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/resources/langs/inishell_de.ts)
ENDIF(REFRESH_TRANSLATION_FILES)
# SET(REFRESH_TRANSLATION_FILES OFF CACHE BOOL "Regenerate the translation files? (this will overwrite the existing .ts files)")
# IF(REFRESH_TRANSLATION_FILES)
# qt5_create_translation(QM_FILES ${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/resources/langs/inishell_de.ts)
# ENDIF(REFRESH_TRANSLATION_FILES)
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})
# qt5_create_translation(QM_FILES ${PROJECT_SOURCE_DIR} ${TS_FILES} OPTIONS -source-language en_US -no-obsolete)
#SET(TS_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../resources/langs/inishell_de.ts")
# SET_SOURCE_FILES_PROPERTIES(${TS_FILES} PROPERTIES OUTPUT_LOCATION "resources/l10n")
# qt5_add_translation(QM_FILES ${TS_FILES})
# ADD_CUSTOM_TARGET(translations DEPENDS ${QM_FILES})
#
# if(NOT QT_TRANSLATIONS_DIR)
# # If this directory is missing, we are in a Qt5 environment.
# # Extract the qmake executable location
# GET_TARGET_PROPERTY(QT5_QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION)
# # Ask Qt5 where to put the translations
# EXECUTE_PROCESS(COMMAND ${QT5_QMAKE_EXECUTABLE} -query QT_INSTALL_TRANSLATIONS
# OUTPUT_VARIABLE qt_translations_dir OUTPUT_STRIP_TRAILING_WHITESPACE)
# # make sure we have / and not \ as qmake gives on windows
# FILE(TO_CMAKE_PATH "${qt_translations_dir}" qt_translations_dir)
# SET(QT_TRANSLATIONS_DIR ${qt_translations_dir} CACHE PATH "The location of the Qt translations" FORCE)
# endif()
#
# INSTALL(FILES ${QM_FILES} DESTINATION ${QT_TRANSLATIONS_DIR})
# qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/resources/langs/inishell_de.ts)
# qt5_add_translation(QM_FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/langs/inishell_de.ts)
# configure_file(translations.qrc ${CMAKE_BINARY_DIR} COPYONLY)
#set(TS_FILES helloworld_en.ts helloworld_de.ts)
# SET_SOURCE_FILES_PROPERTIES(${TS_FILES} PROPERTIES OUTPUT_LOCATION "resources/l10n")
# qt5_add_translation(QM_FILES ${TS_FILES})
# file(GLOB TRANSLATION_FILES ${CMAKE_SOURCE_DIR}/Translations/*.ts)
# qt5_add_translation(QM_FILES ${TRANSLATION_FILES})
ENDIF(SUPPORT_TRANSLATIONS)
ADD_EXECUTABLE(${TARGET} ${TARGET_TYPE} ${EXTRA_LIBS_SRC} ${SOURCES} ${RESOURCES} ${QM_FILES})
......
......@@ -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>langs/inishell_de.qm</file>-->
<file>l10n/inishell_de.qm</file>
<file>doc/help.xml</file>
<file>doc/help_dev.xml</file>
......
......@@ -307,7 +307,7 @@ int main(int argc, char *argv[])
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
const QString language_file(":/langs/inishell_" + language);
const QString language_file(":/l10n/inishell_" + language);
if (translator.load(language_file)) {
QApplication::installTranslator(&translator);
} else { //should not happen since it's a resource and the build process would complain
......
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