Commit c539a3ad authored by Renaud Guezennec's avatar Renaud Guezennec

Translation with cmake.

parent 9818af31
cmake_minimum_required(VERSION 3.10)
project(rolisteam)
add_definitions(-DVERSION_MAJOR=1 -DVERSION_MIDDLE=9 -DVERSION_MINOR=0)
set(QT_REQUIRED_VERSION "5.12.0")
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED COMPONENTS Core Widgets Gui LinguistTools)
#helper
include(cmake/TranslationHelper.cmake)
add_subdirectory(core)
add_subdirectory(client)
add_subdirectory(server)
#add_subdirectory(android)
#option(TESTS "compile tests" OFF) #Off by default
if (TESTS)
add_subdirectory(tests)
endif()
set(documentation README.md HelpMe.md)
set(tsRoot ${CMAKE_CURRENT_SOURCE_DIR}/translations)
set(poRoot ${CMAKE_CURRENT_SOURCE_DIR}/po)
set(translationFiles ${tsRoot}/rolisteam_hu_HU.ts
${tsRoot}/rolisteam_it.ts
${tsRoot}/rolisteam_nl_NL.ts
${tsRoot}/rolisteam_ca.ts
${tsRoot}/rolisteam_pt_BR.ts
${tsRoot}/rolisteam_de.ts
${tsRoot}/rolisteam_ro_RO.ts
${tsRoot}/rolisteam_es.ts
${tsRoot}/rolisteam_tr.ts
${tsRoot}/rolisteam_fr.ts
${tsRoot}/rolisteam.ts)
foreach(TsFile ${translationFiles})
string(REPLACE ".ts" ".qm" _qmOutput ${TsFile})
string(REPLACE ".ts" ".po" _poOutput ${TsFile})
string(REPLACE ${tsRoot} ${poRoot} _poOutput ${_poOutput})
add_custom_command(OUTPUT ${_qmOutput}
COMMAND cmake -E make_directory ${poRoot}
#Get po from svn
COMMAND Qt5::lconvert -if po -of ts -i ${_poOutput} -o ${TsFile}
COMMAND Qt5::lupdate ${CMAKE_CURRENT_SOURCE_DIR} -ts ${TsFile}
COMMAND Qt5::lrelease -compress -nounfinished ${TsFile} -qm ${_qmOutput}
COMMAND Qt5::lconvert -if ts -of po -i ${TsFile} -o ${_poOutput})
#Push updated po
list(APPEND QM_FILES ${_qmOutput})
endforeach()
add_custom_target(BuildTranslations
ALL DEPENDS ${QM_FILES})
cmake_minimum_required(VERSION 3.10)
project(rolisteam-gui)
project(rolisteam)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
......@@ -14,9 +14,10 @@ set(HEADERS mainwindow.h)
include_directories(../core/src)
set(QT_REQUIRED_VERSION "5.12.0")
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED COMPONENTS Core Widgets Gui)
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED COMPONENTS Core Widgets Gui LinguistTools)
add_executable(rolisteam ${SOURCES} ${HEADERS})
add_executable(rolisteam ${SOURCES} ${HEADERS} ../rolisteam.qrc)
target_link_libraries(rolisteam PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets PRIVATE core)
......
function(convertTs2Po _inFile _outFile)
endfunction()
function(convertPo2Ts _inFile _outFile)
#string(REPLACE ".po" ".ts" _outFile ${_inFile})
endfunction()
function(convertTs2Qm _inFile _result)
string(REPLACE ".ts" ".qm" _qmFile ${_inFile})
set(_result ${_qmFile} PARENT_SCOPE)
endfunction()
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
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