diff --git a/src/app/profile/view.nim b/src/app/profile/view.nim index c01ff77200..6283b5ff21 100644 --- a/src/app/profile/view.nim +++ b/src/app/profile/view.nim @@ -86,6 +86,16 @@ QtObject: read = getProfileSettingsFile notify = profileSettingsFileChanged + proc getGlobalSettingsFile(self: ProfileView): string {.slot.} = + return os.joinPath(accountConstants.DATADIR, "qt", "global") + + proc globalSettingsFileChanged*(self: ProfileView) {.signal.} + + QtProperty[string] globalSettingsFile: + read = getGlobalSettingsFile + notify = globalSettingsFileChanged + + proc initialized*(self: ProfileView) {.signal.} proc getProfile(self: ProfileView): QVariant {.slot.} = diff --git a/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/ChatTime.qml b/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/ChatTime.qml index 36ddfc7697..976a444d8c 100644 --- a/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/ChatTime.qml +++ b/ui/app/AppLayouts/Chat/ChatColumn/MessageComponents/ChatTime.qml @@ -8,12 +8,12 @@ StyledText { id: chatTime visible: isMessage color: isImage ? Style.current.white : Style.current.secondaryText - text: formatDateTime ? Utils.formatDateTime(timestamp, appSettings.locale) : Utils.formatTime(timestamp, appSettings.locale) + text: formatDateTime ? Utils.formatDateTime(timestamp, globalSettings.locale) : Utils.formatTime(timestamp, globalSettings.locale) font.pixelSize: Style.current.asideTextFontSize StatusToolTip { visible: hhandler.hovered - text: new Date(parseInt(timestamp, 10)).toLocaleString(Qt.locale(appSettings.locale)) + text: new Date(parseInt(timestamp, 10)).toLocaleString(Qt.locale(globalSettings.locale)) maxWidth: 350 } diff --git a/ui/app/AppLayouts/Chat/ContactsColumn/Channel.qml b/ui/app/AppLayouts/Chat/ContactsColumn/Channel.qml index 0af8ace5f3..a767d17678 100644 --- a/ui/app/AppLayouts/Chat/ContactsColumn/Channel.qml +++ b/ui/app/AppLayouts/Chat/ContactsColumn/Channel.qml @@ -142,7 +142,7 @@ Item { StyledText { id: contactTime visible: !isCompact - text: Utils.formatDateTime(wrapper.timestamp, appSettings.locale) + text: Utils.formatDateTime(wrapper.timestamp, globalSettings.locale) anchors.right: parent.right anchors.rightMargin: Style.current.padding anchors.top: parent.top diff --git a/ui/app/AppLayouts/Profile/Sections/LanguageContainer.qml b/ui/app/AppLayouts/Profile/Sections/LanguageContainer.qml index 311f5f6f5b..3a18be2623 100644 --- a/ui/app/AppLayouts/Profile/Sections/LanguageContainer.qml +++ b/ui/app/AppLayouts/Profile/Sections/LanguageContainer.qml @@ -30,7 +30,7 @@ Item { //% "Language" text: qsTrId("language") //% "Default" - currentValue: appSettings.locale === "" ? qsTrId("default") : appSettings.locale + currentValue: globalSettings.locale === "" ? qsTrId("default") : globalSettings.locale onClicked: languagePopup.createObject(languageContainer).open() } } diff --git a/ui/app/AppLayouts/Profile/Sections/LanguageModal.qml b/ui/app/AppLayouts/Profile/Sections/LanguageModal.qml index dbc5fce6e1..b632d984b6 100644 --- a/ui/app/AppLayouts/Profile/Sections/LanguageModal.qml +++ b/ui/app/AppLayouts/Profile/Sections/LanguageModal.qml @@ -46,11 +46,11 @@ ModalPopup { anchors.rightMargin: 0 text: modelData.name buttonGroup: languageGroup - checked: appSettings.locale === modelData.locale + checked: globalSettings.locale === modelData.locale onRadioCheckedChanged: { - if (checked && appSettings.locale !== modelData.locale) { + if (checked && globalSettings.locale !== modelData.locale) { profileModel.changeLocale(modelData.locale) - appSettings.locale = modelData.locale + globalSettings.locale = modelData.locale } } } diff --git a/ui/app/AppLayouts/Wallet/AssetsTab.qml b/ui/app/AppLayouts/Wallet/AssetsTab.qml index 6f5bbabe75..1eda8b7262 100644 --- a/ui/app/AppLayouts/Wallet/AssetsTab.qml +++ b/ui/app/AppLayouts/Wallet/AssetsTab.qml @@ -59,7 +59,7 @@ Item { StyledText { id: assetFiatValue color: Style.current.secondaryText - text: Utils.toLocaleString(fiatBalance, appSettings.locale) + " " + walletModel.defaultCurrency.toUpperCase() + text: Utils.toLocaleString(fiatBalance, globalSettings.locale) + " " + walletModel.defaultCurrency.toUpperCase() anchors.right: parent.right anchors.rightMargin: 0 anchors.bottom: parent.bottom diff --git a/ui/app/AppLayouts/Wallet/LeftTab.qml b/ui/app/AppLayouts/Wallet/LeftTab.qml index bd17f24e65..e0ea810bdf 100644 --- a/ui/app/AppLayouts/Wallet/LeftTab.qml +++ b/ui/app/AppLayouts/Wallet/LeftTab.qml @@ -43,7 +43,7 @@ Rectangle { StyledTextEdit { id: walletAmountValue color: Style.current.textColor - text: Utils.toLocaleString(walletModel.totalFiatBalance, appSettings.locale) + " " + walletModel.defaultCurrency.toUpperCase() + text: Utils.toLocaleString(walletModel.totalFiatBalance, globalSettings.locale) + " " + walletModel.defaultCurrency.toUpperCase() selectByMouse: true cursorVisible: true readOnly: true @@ -141,7 +141,7 @@ Rectangle { } StyledText { id: walletBalance - text: isLoading ? "..." : Utils.toLocaleString(fiatBalance, appSettings.locale) + " " + walletModel.defaultCurrency.toUpperCase() + text: isLoading ? "..." : Utils.toLocaleString(fiatBalance, globalSettings.locale) + " " + walletModel.defaultCurrency.toUpperCase() anchors.top: parent.top anchors.topMargin: Style.current.smallPadding anchors.right: parent.right diff --git a/ui/app/AppMain.qml b/ui/app/AppMain.qml index 4a66ee6f6a..75fdcd131c 100644 --- a/ui/app/AppMain.qml +++ b/ui/app/AppMain.qml @@ -115,7 +115,6 @@ RowLayout { property bool displayChatImages: false property bool useCompactMode: true property bool timelineEnabled: true - property string locale: "en" property var recentEmojis: [] property var hiddenCommunityWelcomeBanners: [] property real volume: 0.2 @@ -151,6 +150,13 @@ RowLayout { property bool compatibilityMode: true } + Settings { + id: globalSettings + category: "global" + fileName: profileModel.globalSettingsFile + property string locale: "en" + } + ErrorSound { id: errorSound } @@ -175,7 +181,8 @@ RowLayout { Connections { target: profileModel onProfileSettingsFileChanged: { - profileModel.changeLocale(appSettings.locale) + profileModel.changeLocale(globalSettings.locale) + // Since https://github.com/status-im/status-desktop/commit/93668ff75 // we're hiding the setting to change appearance for compact normal mode