diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 37a5d3a7e..ca0f7a5fe 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -7,13 +7,16 @@ set(LINPHONE_EXEC linphone)
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
-set(QT5_PACKAGES Core Gui Quick Widgets QuickControls2)
+set(QT5_PACKAGES Core Gui Quick Widgets QuickControls2 LinguistTools)
-set(LIBS "")
-foreach(package ${QT5_PACKAGES})
- list(APPEND LIBS "Qt::${package}")
-
-find_package(Qt5 COMPONENTS ${QT5_PACKAGES})
+set(LIBS)
+foreach (package ${QT5_PACKAGES})
+ # `qt5_create_translation` is provided from `LinguistTools` package.
+ # But the `Qt5::LinguistTools` lib does not exist. Remove it.
+ if (NOT (${package} STREQUAL LinguistTools))
+ list(APPEND LIBS "Qt5::${package}")
+ endif ()
+endforeach ()
set(SOURCES
src/app.cpp
@@ -39,8 +42,37 @@ set(HEADERS
src/components/settings/SettingsModel.hpp
)
-# Include `qrc` files.
-qt5_add_resources(RESOURCES resources.qrc)
+set(QRC_RESOURCES
+ resources.qrc
+)
+
+set(LANGUAGES_DIRECTORY languages)
+set(LANGUAGES en fr)
+
+# --------------------------------------------------------------------
+
+find_package(Qt5 COMPONENTS ${QT5_PACKAGES})
+
+# Build languages resource file.
+set(TS_FILES)
+set(I18N_CONTENT "\n\n \n")
+foreach (lang ${LANGUAGES})
+ list(APPEND TS_FILES "${LANGUAGES_DIRECTORY}/${lang}.ts")
+
+ # Note: the below `languages/` path is not the same as the `${LANGUAGES_DIRECTORY}` value.
+ # It's the symbolic path used by the linphone binary in the qrc model.
+ set(I18N_CONTENT "${I18N_CONTENT} ${lang}.qm\n")
+endforeach ()
+set(I18N_CONTENT "${I18N_CONTENT} \n\n")
+
+set(I18N_RESOURCE i18n.qrc)
+file(WRITE "${CMAKE_BINARY_DIR}/${I18N_RESOURCE}" "${I18N_CONTENT}")
+
+# Create `qm` files from `ts` files.
+qt5_create_translation(QM_FILES ${TS_FILES} src ui)
+
+# Add qrc. (images, qml, translations...)
+qt5_add_resources(RESOURCES ${QRC_RESOURCES} "${CMAKE_BINARY_DIR}/${I18N_RESOURCE}")
# Build.
add_executable(${LINPHONE_EXEC} ${SOURCES} ${HEADERS} ${RESOURCES})
diff --git a/tests/linphone.pro b/tests/linphone.pro
deleted file mode 100644
index 96515e41f..000000000
--- a/tests/linphone.pro
+++ /dev/null
@@ -1,55 +0,0 @@
-QT = core gui quick widgets quickcontrols2
-
-TARGET = linphone
-TEMPLATE = app
-CONFIG += c++11
-
-RESOURCES = resources.qrc
-
-SOURCES = \
- src/app.cpp \
- src/components/contacts/ContactModel.cpp \
- src/components/contacts/ContactsListModel.cpp \
- src/components/contacts/ContactsListProxyModel.cpp \
- src/components/notification/Notification.cpp \
- src/components/settings/AccountSettingsListModel.cpp \
- src/components/settings/AccountSettingsModel.cpp \
- src/components/settings/SettingsModel.cpp \
- src/main.cpp \
-
-HEADERS = \
- src/app.hpp \
- src/components/contacts/ContactModel.hpp \
- src/components/contacts/ContactsListModel.hpp \
- src/components/contacts/ContactsListProxyModel.hpp \
- src/components/notification/Notification.hpp \
- src/components/presence/Presence.hpp \
- src/components/settings/AccountSettingsListModel.hpp \
- src/components/settings/AccountSettingsModel.hpp \
- src/components/settings/SettingsModel.hpp \
-
-TRANSLATIONS = \
- languages/en.ts \
- languages/fr.ts \
-
-lupdate_only{
- SOURCES = \
- ui/modules/Common/*.qml \
- ui/modules/Common/Dialog/*.qml \
- ui/modules/Common/Form/*.qml \
- ui/modules/Common/Image/*.qml \
- ui/modules/Common/Popup/*.qml \
- ui/modules/Common/Styles/*.qml \
- ui/modules/Common/Styles/Form/*.qml \
- ui/modules/Common/View/*.qml \
- ui/modules/Linphone/*.qml \
- ui/modules/Linphone/Chat/*.qml \
- ui/modules/Linphone/Contact/*.qml \
- ui/modules/Linphone/Select/*.qml \
- ui/modules/Linphone/Styles/*.qml \
- ui/modules/Linphone/Styles/Contact/*.qml \
- ui/views/*.qml \
- ui/views/Calls/*.qml \
- ui/views/MainWindow/*.qml \
-
-}
diff --git a/tests/resources.qrc b/tests/resources.qrc
index 006cb433a..33d556a11 100644
--- a/tests/resources.qrc
+++ b/tests/resources.qrc
@@ -26,8 +26,6 @@
imgs/right_arrow.svg
imgs/speaker.svg
imgs/valid.svg
- languages/en.qm
- languages/fr.qm
ui/modules/Common/Borders.qml
ui/modules/Common/Collapse.qml
ui/modules/Common/Colors.qml
diff --git a/tests/scripts/update_languages b/tests/scripts/update_languages
deleted file mode 100755
index 8a51b9d87..000000000
--- a/tests/scripts/update_languages
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/usr/bin/bash
-
-lupdate-qt5 -verbose $1/linphone.pro
-lrelease-qt5 $1/linphone.pro
diff --git a/tests/scripts/update_linphone b/tests/scripts/update_linphone
deleted file mode 100755
index 97514cf4a..000000000
--- a/tests/scripts/update_linphone
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/usr/bin/bash
-
-PRO_FILE="linphone.pro"
-
-cd $1
-
-echo "QT = core gui quick widgets quickcontrols2
-
-TARGET = linphone
-TEMPLATE = app
-CONFIG += c++11
-
-RESOURCES = resources.qrc" > $PRO_FILE
-
-echo "
-SOURCES = \\" >> $PRO_FILE
-for filename in $(find src/ -name \*.cpp -type f | sort)
-do
- echo " $filename \\" >> $PRO_FILE
-done
-
-echo "
-HEADERS = \\" >> $PRO_FILE
-for filename in $(find src/ -name \*.hpp -type f | sort)
-do
- echo " $filename \\" >> $PRO_FILE
-done
-
-echo "
-TRANSLATIONS = \\" >> $PRO_FILE
-for filename in $(find languages/ -name \*.ts -type f | sort)
-do
- echo " $filename \\" >> $PRO_FILE
-done
-
-echo "
-lupdate_only{
- SOURCES = \\" >> $PRO_FILE
-for filename in $(find ui/ -type f -name \*.qml -printf '%h\n' | sort -u)
-do
- echo " $filename/*.qml \\" >> $PRO_FILE
-done
-echo "
-}" >> $PRO_FILE
diff --git a/tests/update_project b/tests/update_project
deleted file mode 100755
index 518445030..000000000
--- a/tests/update_project
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/bash
-
-SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-
-$SCRIPT_DIR/scripts/update_linphone $SCRIPT_DIR
-$SCRIPT_DIR/scripts/build_resources_file $SCRIPT_DIR
-$SCRIPT_DIR/scripts/update_languages $SCRIPT_DIR
diff --git a/tests/scripts/build_resources_file b/tests/update_resources
similarity index 67%
rename from tests/scripts/build_resources_file
rename to tests/update_resources
index 214078961..f984ed6ed 100755
--- a/tests/scripts/build_resources_file
+++ b/tests/update_resources
@@ -1,18 +1,19 @@
#!/usr/bin/bash
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
RESOURCE_FILE="resources.qrc"
-cd $1
+cd $SCRIPT_DIR
echo "
" > $RESOURCE_FILE
-for filename in $(find languages/ ui/ imgs/ -type f | sort)
+for filename in $(find ui/ imgs/ -type f | sort)
do
basename="${filename##*/}"
extension="${filename##*.}"
- if [[ "${extension}" == @(qml|svg|png|jpg|qm|js) ||
+ if [[ "${extension}" == @(qml|svg|png|jpg|js) ||
"${basename}" == "qmldir" ]]; then
echo " $filename" >> $RESOURCE_FILE
fi