mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-29 09:49:20 +00:00
feat(app): the languages resources are updated (with make) if a qml file changes
This commit is contained in:
parent
35c7003bce
commit
467c2102c5
4 changed files with 38 additions and 11 deletions
|
|
@ -1,3 +1,7 @@
|
|||
# ====================================================================
|
||||
# CMakeLists.txt
|
||||
# ====================================================================
|
||||
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(linphone)
|
||||
|
||||
|
|
@ -7,6 +11,10 @@ set(LINPHONE_EXEC linphone)
|
|||
set(CMAKE_AUTOMOC 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(LIBS)
|
||||
|
|
@ -65,6 +73,7 @@ endfunction ()
|
|||
# Force absolute paths.
|
||||
PREPEND(SOURCES "${CMAKE_SOURCE_DIR}/")
|
||||
PREPEND(HEADERS "${CMAKE_SOURCE_DIR}/")
|
||||
PREPEND(QRC_RESOURCES "${CMAKE_SOURCE_DIR}/")
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,14 @@
|
|||
# ====================================================================
|
||||
# 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.
|
||||
set(TS_FILES)
|
||||
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")
|
|||
|
||||
file(WRITE "${CMAKE_BINARY_DIR}/${LANGUAGES_DIRECTORY}/${I18N_FILENAME}" "${I18N_CONTENT}")
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
# 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)
|
||||
# Compute QML files list.
|
||||
set(QML_SOURCES)
|
||||
file(STRINGS ${QRC_RESOURCES} QRC_RESOURCES_CONTENT)
|
||||
foreach (line ${QRC_RESOURCES_CONTENT})
|
||||
set(result)
|
||||
string(REGEX REPLACE
|
||||
"^[ \t]+<file>[ \t]*(.+\\.qml)[ \t]*</file>[ \t]*$"
|
||||
"\\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.
|
||||
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})
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@
|
|||
<translation type="unfinished">Please choose one or many files</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>DROP YOUR ATTACHMENT</source>
|
||||
<source>dropYourAttachment</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@
|
|||
<translation type="unfinished">Merci de choisir un ou plusieurs fichiers</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>DROP YOUR ATTACHMENT</source>
|
||||
<source>dropYourAttachment</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue