1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Compiled launcher translations are now in launcher/translations/ dir

This commit is contained in:
Ivan Savenko 2022-12-25 22:18:14 +02:00
parent a0c78e8ecb
commit b012cd9490
4 changed files with 19 additions and 12 deletions

View File

@ -316,8 +316,8 @@ find_package(TBB REQUIRED)
if(ENABLE_LAUNCHER OR ENABLE_EDITOR)
# Widgets finds its own dependencies (QtGui and QtCore).
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Network)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Network)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Network LinguistTools)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Network LinguistTools)
endif()
if(ENABLE_LUA)

View File

@ -62,6 +62,13 @@ set(launcher_FORMS
lobby/lobbyroomrequest_moc.ui
)
set(launcher_TS
translation/english.ts
translation/german.ts
translation/polish.ts
translation/russian.ts
translation/ukrainian.ts)
if(APPLE_IOS)
list(APPEND launcher_SRCS
ios/main.m
@ -83,13 +90,13 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
if(TARGET Qt6::Core)
qt_wrap_ui(launcher_UI_HEADERS ${launcher_FORMS})
qt_add_translation( launcher_QM ${launcher_TS} )
else()
set_source_files_properties(${launcher_TS} PROPERTIES OUTPUT_LOCATION ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/launcher/translations)
qt5_wrap_ui(launcher_UI_HEADERS ${launcher_FORMS})
qt5_add_translation( launcher_QM ${launcher_TS} )
endif()
find_package(Qt5LinguistTools)
set(launcher_TS translation/launcher_en.ts translation/launcher_pl.ts translation/launcher_ru.ts translation/launcher_uk.ts)
qt5_add_translation( QM_FILES ${launcher_TS} )
if(WIN32)
set(launcher_ICON VCMI_launcher.rc)
@ -98,7 +105,7 @@ endif()
if(BUILD_SINGLE_APP)
add_library(vcmilauncher STATIC ${launcher_SRCS} ${launcher_HEADERS} ${launcher_UI_HEADERS})
else()
add_executable(vcmilauncher WIN32 ${QM_FILES} ${launcher_SRCS} ${launcher_HEADERS} ${launcher_UI_HEADERS} ${launcher_ICON})
add_executable(vcmilauncher WIN32 ${launcher_QM} ${launcher_SRCS} ${launcher_HEADERS} ${launcher_UI_HEADERS} ${launcher_ICON})
endif()
if(WIN32)
@ -130,7 +137,7 @@ vcmi_set_output_dir(vcmilauncher "")
enable_pch(vcmilauncher)
if(APPLE_IOS)
set(ICONS_DESTINATION ${DATA_DIR})
set(RESOURCES_DESTINATION ${DATA_DIR})
# workaround https://github.com/conan-io/conan-center-index/issues/13332
if(USING_CONAN)
@ -144,7 +151,7 @@ if(APPLE_IOS)
)
endif()
else()
set(ICONS_DESTINATION ${DATA_DIR}/launcher)
set(RESOURCES_DESTINATION ${DATA_DIR}/launcher)
# Copy to build directory for easier debugging
add_custom_command(TARGET vcmilauncher POST_BUILD
@ -161,4 +168,5 @@ else()
endif()
endif()
install(DIRECTORY icons DESTINATION ${ICONS_DESTINATION})
install(DIRECTORY icons DESTINATION ${RESOURCES_DESTINATION})
install(DIRECTORY ts DESTINATION ${RESOURCES_DESTINATION})

View File

@ -129,7 +129,7 @@ void MainWindow::updateTranslation()
{
std::string languageCode = settings["general"]["language"].String();
QString translationFile = "./launcher_" + QString::fromStdString(languageCode) + ".qm";
QString translationFile = "./launcher/translations/" + QString::fromStdString(languageCode) + ".qm";
qApp->removeTranslator(&translator);
if (!translator.load(translationFile))

View File

@ -158,8 +158,7 @@ QString CModEntry::getName() const
QVariant CModEntry::getValue(QString value) const
{
QString lang = QString::fromStdString(settings["general"]["language"].String());
QString langValue = "translation_" + lang;
QString langValue = QString::fromStdString(settings["general"]["language"].String());
// Priorities
// 1) data from newest version