Commit 467c2102 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(app): the languages resources are updated (with make) if a qml file changes

parent 35c7003b
# ====================================================================
# CMakeLists.txt
# ====================================================================
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.0)
project(linphone) project(linphone)
...@@ -7,6 +11,10 @@ set(LINPHONE_EXEC linphone) ...@@ -7,6 +11,10 @@ set(LINPHONE_EXEC linphone)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)
# --------------------------------------------------------------------
# Define packages, libs, sources, headers, resources and languages
# --------------------------------------------------------------------
set(QT5_PACKAGES Core Gui Quick Widgets QuickControls2 LinguistTools) set(QT5_PACKAGES Core Gui Quick Widgets QuickControls2 LinguistTools)
set(LIBS) set(LIBS)
...@@ -65,6 +73,7 @@ endfunction () ...@@ -65,6 +73,7 @@ endfunction ()
# Force absolute paths. # Force absolute paths.
PREPEND(SOURCES "${CMAKE_SOURCE_DIR}/") PREPEND(SOURCES "${CMAKE_SOURCE_DIR}/")
PREPEND(HEADERS "${CMAKE_SOURCE_DIR}/") PREPEND(HEADERS "${CMAKE_SOURCE_DIR}/")
PREPEND(QRC_RESOURCES "${CMAKE_SOURCE_DIR}/")
# -------------------------------------------------------------------- # --------------------------------------------------------------------
......
# ====================================================================
# languages/CMakeLists.txt
# ====================================================================
# This line prevent `.ts` files deletion.
# See: https://bugreports.qt.io/browse/QTBUG-31860
#
# On October 17, 2016, this issue is marked `invalid` but it's a
# bullshit. It's not tolerated to remove sources files.
set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM true)
# Build languages resource file. # Build languages resource file.
set(TS_FILES) set(TS_FILES)
set(I18N_CONTENT "<!DOCTYPE RCC>\n<RCC version=\"1.0\">\n <qresource prefix=\"/\">\n") set(I18N_CONTENT "<!DOCTYPE RCC>\n<RCC version=\"1.0\">\n <qresource prefix=\"/\">\n")
...@@ -13,15 +24,22 @@ set(I18N_CONTENT "${I18N_CONTENT} </qresource>\n</RCC>\n") ...@@ -13,15 +24,22 @@ set(I18N_CONTENT "${I18N_CONTENT} </qresource>\n</RCC>\n")
file(WRITE "${CMAKE_BINARY_DIR}/${LANGUAGES_DIRECTORY}/${I18N_FILENAME}" "${I18N_CONTENT}") file(WRITE "${CMAKE_BINARY_DIR}/${LANGUAGES_DIRECTORY}/${I18N_FILENAME}" "${I18N_CONTENT}")
# -------------------------------------------------------------------- # Compute QML files list.
set(QML_SOURCES)
# Prevent `.ts` files deletion. file(STRINGS ${QRC_RESOURCES} QRC_RESOURCES_CONTENT)
# See: https://bugreports.qt.io/browse/QTBUG-31860 foreach (line ${QRC_RESOURCES_CONTENT})
# set(result)
# On October 17, 2016, this issue is marked `invalid` but it's a string(REGEX REPLACE
# bullshit. It's not tolerated to remove sources files. "^[ \t]+<file>[ \t]*(.+\\.qml)[ \t]*</file>[ \t]*$"
set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM true) "\\1"
result
${line})
string(REGEX MATCH "qml$" isQml ${result})
if (NOT ${isQml} STREQUAL "")
list(APPEND QML_SOURCES "${CMAKE_SOURCE_DIR}/${result}")
endif ()
endforeach ()
# Create `qm` files from `ts` files. # Create `qm` files from `ts` files.
qt5_create_translation(QM_FILES ${TS_FILES} ${SOURCES} ${HEADERS}) qt5_create_translation(QM_FILES ${TS_FILES} ${SOURCES} ${HEADERS} ${QML_SOURCES})
add_custom_target(update_translations DEPENDS ${QM_FILES}) add_custom_target(update_translations DEPENDS ${QM_FILES})
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
<translation type="unfinished">Please choose one or many files</translation> <translation type="unfinished">Please choose one or many files</translation>
</message> </message>
<message> <message>
<source>DROP YOUR ATTACHMENT</source> <source>dropYourAttachment</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
......
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
<translation type="unfinished">Merci de choisir un ou plusieurs fichiers</translation> <translation type="unfinished">Merci de choisir un ou plusieurs fichiers</translation>
</message> </message>
<message> <message>
<source>DROP YOUR ATTACHMENT</source> <source>dropYourAttachment</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
......
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