Skip to content
Snippets Groups Projects
Commit 5b6ab480 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

settings panel: retrigger translation

Else, seems model is not updated correctly

Change-Id: I980a3969b72ebe0d6c702f5fc8c13779603bb8b2
GitLab: #1486
parent 6003d007
No related branches found
No related tags found
No related merge requests found
......@@ -33,6 +33,7 @@ SidePanelBase {
color: JamiTheme.backgroundColor
property int currentIndex
property bool isSinglePane
signal updated
function getHeaders() {
if (AppVersionManager.isUpdaterEnabled()) {
......@@ -188,8 +189,19 @@ SidePanelBase {
function updateModel() {
if (visible) {
listView.model = {};
listView.model = getHeaders();
root.updated()
}
}
Timer {
id: timerTranslate
interval: 100
repeat: false
onTriggered: {
updateModel()
}
}
......@@ -206,7 +218,10 @@ SidePanelBase {
target: UtilsAdapter
function onChangeLanguage() {
updateModel();
// For some reason, under Qt 6.5.3, even if locale is changed before
// model is not computer correctly.
// Delaying the update works
timerTranslate.restart()
}
}
......@@ -253,6 +268,8 @@ SidePanelBase {
ListView {
id: listView
objectName: "listView"
width: page.width
height: page.height
clip: true
......
......@@ -82,8 +82,8 @@ UtilsAdapter::setAppValue(const Settings::Key key, const QVariant& value)
// If we change the lang preference, reload the translations
if (key == Settings::Key::LANG) {
settingsManager_->loadTranslations();
Q_EMIT changeLanguage();
set_isRTL(isRTL());
Q_EMIT changeLanguage();
} else if (key == Settings::Key::BaseZoom)
Q_EMIT changeFontSize();
else if (key == Settings::Key::DisplayHyperlinkPreviews)
......
/*
* Copyright (C) 2021-2024 Savoir-faire Linux Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import QtQuick
import QtTest
import net.jami.Adapters 1.1
import net.jami.Models 1.1
import net.jami.Constants 1.1
import net.jami.Enums 1.1
import "../../../src/app/settingsview"
import "../../../src/app/commoncomponents"
SettingsSidePanel {
id: uut
SignalSpy {
id: spyUpdated
target: uut
signalName: "updated"
}
SignalSpy {
id: spyChangeLang
target: UtilsAdapter
signalName: "changeLanguage"
}
TestCase {
name: "WelcomePage to different account creation page and return back"
when: windowShown
function test_retranslate() {
spyUpdated.clear()
UtilsAdapter.setAppValue(Settings.Key.LANG, "en_EN")
spyChangeLang.wait(1000)
compare(spyChangeLang.count, 1)
spyUpdated.wait(1000)
compare(spyUpdated.count, 1)
UtilsAdapter.setAppValue(Settings.Key.LANG, "fr")
spyChangeLang.wait(1000)
compare(spyChangeLang.count, 2)
spyUpdated.wait(1000)
compare(spyUpdated.count, 2)
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment