fix(@desktop): use system locale across the application

This commit is contained in:
Dario Gabriel Lipicar 2023-01-11 11:10:53 -03:00 committed by dlipicar
parent d11017f7b3
commit a6afdb5266
38 changed files with 7 additions and 60 deletions

View File

@ -98,7 +98,7 @@ StatusSectionLayout {
Repeater { Repeater {
model: d.featuredCommunitiesModel model: d.featuredCommunitiesModel
delegate: StatusCommunityCard { delegate: StatusCommunityCard {
locale: "es" locale: Qt.locale("es")
communityId: model.communityId communityId: model.communityId
loaded: model.available loaded: model.available
logo: model.logo logo: model.logo
@ -136,7 +136,7 @@ StatusSectionLayout {
Repeater { Repeater {
model: d.popularCommunitiesModel model: d.popularCommunitiesModel
delegate: StatusCommunityCard { delegate: StatusCommunityCard {
locale: "es" locale: Qt.locale("es")
communityId: model.communityId communityId: model.communityId
loaded: model.available loaded: model.available
logo: model.logo logo: model.logo

View File

@ -23,7 +23,7 @@ GridLayout {
Repeater { Repeater {
model: Models.curatedCommunitiesModel model: Models.curatedCommunitiesModel
delegate: StatusCommunityCard { delegate: StatusCommunityCard {
locale: "en" locale: Qt.locale("en")
communityId: model.communityId communityId: model.communityId
loaded: model.available loaded: model.available
logo: model.logo logo: model.logo

View File

@ -96,9 +96,8 @@ Rectangle {
/*! /*!
\qmlproperty var StatusCommunityCard::locale \qmlproperty var StatusCommunityCard::locale
This property holds the application locale used to give format to members number representation. This property holds the application locale used to give format to members number representation.
If not provided, default value is "en".
*/ */
property var locale: Qt.locale("en") property var locale: Qt.locale()
/*! /*!
\qmlproperty url StatusCommunityCard::banner \qmlproperty url StatusCommunityCard::banner
This property holds the community banner image url. This property holds the community banner image url.

View File

@ -40,7 +40,7 @@ QtObject {
return "N/A" return "N/A"
} }
if (typeof(currencyAmount) !== "object") { if (typeof(currencyAmount) !== "object") {
console.log("Wrong type for currencyAmount: " + JSON.stringify(currencyAmount)) console.warn("Wrong type for currencyAmount: " + JSON.stringify(currencyAmount))
console.trace() console.trace()
return NaN return NaN
} }

View File

@ -204,12 +204,10 @@ Popup {
AssetsView { AssetsView {
id: assetsTab id: assetsTab
locale: RootStore.locale
account: WalletStore.dappBrowserAccount account: WalletStore.dappBrowserAccount
} }
HistoryView { HistoryView {
id: historyTab id: historyTab
locale: RootStore.locale
account: WalletStore.dappBrowserAccount account: WalletStore.dappBrowserAccount
} }
} }

View File

@ -7,8 +7,6 @@ import shared.stores 1.0
QtObject { QtObject {
id: root id: root
property var locale: Qt.locale(localAppSettings.language)
property var contactsStore property var contactsStore
property bool openCreateChat: false property bool openCreateChat: false

View File

@ -170,7 +170,6 @@ StatusSectionLayout {
padding: 0 padding: 0
bottomPadding: d.layoutBottomMargin bottomPadding: d.layoutBottomMargin
locale: communitiesStore.locale
model: filteredCommunitiesModel model: filteredCommunitiesModel
searchLayout: d.searchMode searchLayout: d.searchMode

View File

@ -28,7 +28,6 @@ QtObject {
property bool discordImportHasCommunityImage: root.communitiesModuleInst.discordImportHasCommunityImage property bool discordImportHasCommunityImage: root.communitiesModuleInst.discordImportHasCommunityImage
property var discordImportTasks: root.communitiesModuleInst.discordImportTasks property var discordImportTasks: root.communitiesModuleInst.discordImportTasks
property bool downloadingCommunityHistoryArchives: root.communitiesModuleInst.downloadingCommunityHistoryArchives property bool downloadingCommunityHistoryArchives: root.communitiesModuleInst.downloadingCommunityHistoryArchives
property var locale: Qt.locale()
property var advancedModule: profileSectionModule.advancedModule property var advancedModule: profileSectionModule.advancedModule
// TODO: Could the backend provide directly 2 filtered models?? // TODO: Could the backend provide directly 2 filtered models??

View File

@ -13,7 +13,6 @@ import SortFilterProxyModel 0.2
StatusScrollView { StatusScrollView {
id: root id: root
property var locale
property var model property var model
property bool searchLayout: false property bool searchLayout: false
@ -64,7 +63,6 @@ StatusScrollView {
json: tags json: tags
} }
locale: root.locale
communityId: model.id communityId: model.id
loaded: model.available loaded: model.available
logo: model.icon logo: model.icon

View File

@ -18,7 +18,6 @@ import "../stores"
Item { Item {
id: root id: root
property var locale
property string currency: "" property string currency: ""
property var currentAccount property var currentAccount
property var store property var store

View File

@ -59,7 +59,6 @@ StatusModal {
root.selectedAccount = newAccount root.selectedAccount = newAccount
} }
showAllWalletTypes: true showAllWalletTypes: true
locale: RootStore.locale
} }
contentItem: Column { contentItem: Column {

View File

@ -22,7 +22,6 @@ QtObject {
property var generatedAccounts: walletSectionAccounts.generated property var generatedAccounts: walletSectionAccounts.generated
property var appSettings: localAppSettings property var appSettings: localAppSettings
property var accountSensitiveSettings: localAccountSensitiveSettings property var accountSensitiveSettings: localAccountSensitiveSettings
property var locale: Qt.locale(appSettings.language)
property bool hideSignPhraseModal: accountSensitiveSettings.hideSignPhraseModal property bool hideSignPhraseModal: accountSensitiveSettings.hideSignPhraseModal
property var currencyStore: SharedStore.RootStore.currencyStore property var currencyStore: SharedStore.RootStore.currencyStore

View File

@ -54,7 +54,6 @@ Item {
ColumnLayout { ColumnLayout {
WalletHeader { WalletHeader {
Layout.fillWidth: true Layout.fillWidth: true
locale: RootStore.locale
currency: RootStore.currentCurrency currency: RootStore.currentCurrency
currentAccount: RootStore.currentAccount currentAccount: RootStore.currentAccount
store: root.store store: root.store
@ -92,7 +91,6 @@ Item {
AssetsView { AssetsView {
account: RootStore.currentAccount account: RootStore.currentAccount
assetDetailsLaunched: stack.currentIndex === 2 assetDetailsLaunched: stack.currentIndex === 2
locale: RootStore.locale
onAssetClicked: { onAssetClicked: {
assetDetailView.token = token assetDetailView.token = token
stack.currentIndex = 2 stack.currentIndex = 2
@ -104,7 +102,6 @@ Item {
} }
} }
HistoryView { HistoryView {
locale: RootStore.locale
account: RootStore.currentAccount account: RootStore.currentAccount
onLaunchTransactionDetail: { onLaunchTransactionDetail: {
transactionDetailView.transaction = transaction transactionDetailView.transaction = transaction
@ -128,7 +125,6 @@ Item {
} }
TransactionDetailView { TransactionDetailView {
id: transactionDetailView id: transactionDetailView
locale: RootStore.locale
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
sendModal: root.sendModal sendModal: root.sendModal

View File

@ -7,8 +7,6 @@ import "../Profile/stores"
QtObject { QtObject {
id: root id: root
property var locale: Qt.locale()
property var mainModuleInst: mainModule property var mainModuleInst: mainModule
property var aboutModuleInst: aboutModule property var aboutModuleInst: aboutModule
property var communitiesModuleInst: communitiesModule property var communitiesModuleInst: communitiesModule

View File

@ -25,7 +25,7 @@ Input {
+ textField.leftPadding + textField.leftPadding
function setAmount(amount) { function setAmount(amount) {
root.text = LocaleUtils.numberToLocaleString(amount, -1, root.locale) root.text = LocaleUtils.numberToLocaleString(amount)
} }
QtObject { QtObject {
@ -59,7 +59,7 @@ Input {
} }
try { try {
d.amount = Number.fromLocaleString(root.locale, text) || 0 d.amount = LocaleUtils.numberFromLocaleString(text) || 0
root.validationError = "" root.validationError = ""
} catch (err) { } catch (err) {
root.validationError = qsTr("Invalid amount format") root.validationError = qsTr("Invalid amount format")

View File

@ -12,7 +12,6 @@ Item {
id: assetDelegate id: assetDelegate
objectName: symbol objectName: symbol
property var locale
property string currency: "" property string currency: ""
property string currencySymbol: "" property string currencySymbol: ""

View File

@ -21,7 +21,6 @@ Item {
property var getGasEthValue: function () {} property var getGasEthValue: function () {}
property var getFiatValue: function () {} property var getFiatValue: function () {}
property var getCurrencyAmount: function () {} property var getCurrencyAmount: function () {}
property var locale
width: parent.width width: parent.width
height: visible ? advancedGasSelector.height + Style.current.halfPadding : 0 height: visible ? advancedGasSelector.height + Style.current.halfPadding : 0

View File

@ -9,7 +9,6 @@ import utils 1.0
StatusListItem { StatusListItem {
id: root id: root
property var locale
property var getNetworkIcon: function(chainId){ property var getNetworkIcon: function(chainId){
return "" return ""
} }

View File

@ -10,7 +10,6 @@ import utils 1.0
StatusListItem { StatusListItem {
id: root id: root
property var locale
title: name title: name
subTitle: LocaleUtils.currencyAmountToLocaleString(enabledNetworkBalance) subTitle: LocaleUtils.currencyAmountToLocaleString(enabledNetworkBalance)
asset.name: symbol ? Style.png("tokens/" + symbol) : "" asset.name: symbol ? Style.png("tokens/" + symbol) : ""

View File

@ -11,7 +11,6 @@ import shared 1.0
StatusListItem { StatusListItem {
id: root id: root
property var locale
property var modelData property var modelData
property string symbol property string symbol
property bool isIncoming property bool isIncoming

View File

@ -27,7 +27,6 @@ Item {
property string userSelectedToken property string userSelectedToken
property string currentCurrencySymbol property string currentCurrencySymbol
property string placeholderText property string placeholderText
property var locale
property var tokenAssetSourceFn: function (symbol) { property var tokenAssetSourceFn: function (symbol) {
return "" return ""
@ -150,7 +149,6 @@ Item {
delegate: TokenBalancePerChainDelegate { delegate: TokenBalancePerChainDelegate {
objectName: "AssetSelector_ItemDelegate_" + symbol objectName: "AssetSelector_ItemDelegate_" + symbol
width: comboBox.control.popup.width width: comboBox.control.popup.width
locale: root.locale
getNetworkIcon: root.getNetworkIcon getNetworkIcon: root.getNetworkIcon
onTokenSelected: { onTokenSelected: {
userSelectedToken = selectedToken.symbol userSelectedToken = selectedToken.symbol

View File

@ -18,7 +18,6 @@ import "../views"
StatusFloatingButtonsSelector { StatusFloatingButtonsSelector {
id: root id: root
property var locale
property var selectedAccount property var selectedAccount
// Expected signature: function(newAccount, newIndex) // Expected signature: function(newAccount, newIndex)
property var changeSelectedAccount: function(){} property var changeSelectedAccount: function(){}

View File

@ -157,7 +157,6 @@ StatusDialog {
header: AccountsModalHeader { header: AccountsModalHeader {
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: -height - 18 anchors.topMargin: -height - 18
locale: popup.store.locale
model: popup.store.accounts model: popup.store.accounts
selectedAccount: popup.selectedAccount selectedAccount: popup.selectedAccount
changeSelectedAccount: function(newAccount, newIndex) { changeSelectedAccount: function(newAccount, newIndex) {
@ -241,7 +240,6 @@ StatusDialog {
} }
popup.recalculateRoutesAndFees() popup.recalculateRoutesAndFees()
} }
locale: popup.store.locale
} }
StatusListItemTag { StatusListItemTag {
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
@ -258,7 +256,6 @@ StatusDialog {
AmountToSend { AmountToSend {
id: amountToSendInput id: amountToSendInput
Layout.fillWidth:true Layout.fillWidth:true
locale: popup.store.locale
isBridgeTx: popup.isBridgeTx isBridgeTx: popup.isBridgeTx
interactive: popup.interactive interactive: popup.interactive
selectedAsset: assetSelector.selectedAsset selectedAsset: assetSelector.selectedAsset
@ -282,7 +279,6 @@ StatusDialog {
id: amountToReceive id: amountToReceive
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
Layout.fillWidth:true Layout.fillWidth:true
locale: popup.store.locale
visible: popup.bestRoutes !== undefined && popup.bestRoutes.length > 0 visible: popup.bestRoutes !== undefined && popup.bestRoutes.length > 0
store: popup.store store: popup.store
isLoading: popup.isLoading isLoading: popup.isLoading
@ -302,7 +298,6 @@ StatusDialog {
anchors.right: parent.right anchors.right: parent.right
visible: !assetSelector.selectedAsset visible: !assetSelector.selectedAsset
assets: popup.selectedAccount && popup.selectedAccount.assets ? popup.selectedAccount.assets : [] assets: popup.selectedAccount && popup.selectedAccount.assets ? popup.selectedAccount.assets : []
locale: popup.store.locale
searchTokenSymbolByAddressFn: function (address) { searchTokenSymbolByAddressFn: function (address) {
if(popup.selectedAccount) { if(popup.selectedAccount) {
return popup.selectedAccount.findTokenSymbolByAddress(address) return popup.selectedAccount.findTokenSymbolByAddress(address)
@ -415,7 +410,6 @@ StatusDialog {
d.waitTimer.restart() d.waitTimer.restart()
} }
visible: !d.recipientReady && !isBridgeTx && !!assetSelector.selectedAsset visible: !d.recipientReady && !isBridgeTx && !!assetSelector.selectedAsset
locale: popup.store.locale
} }
NetworkSelector { NetworkSelector {

View File

@ -5,8 +5,6 @@ import "../../../app/AppLayouts/Profile/stores"
QtObject { QtObject {
id: root id: root
property var locale: Qt.locale(localAppSettings.language)
// Some token+currency-related functions are implemented in the profileSectionModule. // Some token+currency-related functions are implemented in the profileSectionModule.
// We should probably refactor this and move those functions to some Wallet module. // We should probably refactor this and move those functions to some Wallet module.
property ProfileSectionStore profileSectionStore: ProfileSectionStore {} property ProfileSectionStore profileSectionStore: ProfileSectionStore {}

View File

@ -23,7 +23,6 @@ QtObject {
property bool isTenorWarningAccepted: !!accountSensitiveSettings ? accountSensitiveSettings.isTenorWarningAccepted : false property bool isTenorWarningAccepted: !!accountSensitiveSettings ? accountSensitiveSettings.isTenorWarningAccepted : false
property bool displayChatImages: !!accountSensitiveSettings ? accountSensitiveSettings.displayChatImages : false property bool displayChatImages: !!accountSensitiveSettings ? accountSensitiveSettings.displayChatImages : false
property var locale: Qt.locale(localAppSettings.language)
// property string signingPhrase: !!walletModelInst ? walletModelInst.utilsView.signingPhrase : "" // property string signingPhrase: !!walletModelInst ? walletModelInst.utilsView.signingPhrase : ""
// property string gasPrice: !!walletModelInst ? walletModelInst.gasView.gasPrice : "0" // property string gasPrice: !!walletModelInst ? walletModelInst.gasView.gasPrice : "0"
// property string gasEthValue: !!walletModelInst ? walletModelInst.gasView.getGasEthValue : "0" // property string gasEthValue: !!walletModelInst ? walletModelInst.gasView.getGasEthValue : "0"

View File

@ -15,7 +15,6 @@ QtObject {
property var mainModuleInst: mainModule property var mainModuleInst: mainModule
property var walletSectionTransactionsInst: walletSectionTransactions property var walletSectionTransactionsInst: walletSectionTransactions
property var locale: Qt.locale(localAppSettings.language)
property string currentCurrency: walletSection.currentCurrency property string currentCurrency: walletSection.currentCurrency
property var allNetworks: networksModule.all property var allNetworks: networksModule.all
property var accounts: walletSectionAccounts.model property var accounts: walletSectionAccounts.model

View File

@ -10,7 +10,6 @@ import shared.stores 1.0
ColumnLayout { ColumnLayout {
id: root id: root
property var locale
property var store property var store
property var selectedAsset property var selectedAsset
property bool isLoading: false property bool isLoading: false

View File

@ -14,7 +14,6 @@ ColumnLayout {
property alias input: topAmountToSendInput property alias input: topAmountToSendInput
property var locale
property var selectedAsset property var selectedAsset
property bool isBridgeTx: false property bool isBridgeTx: false
property bool interactive: false property bool interactive: false

View File

@ -18,7 +18,6 @@ Item {
property var account property var account
property bool assetDetailsLaunched: false property bool assetDetailsLaunched: false
property var locale
signal assetClicked(var token) signal assetClicked(var token)
@ -44,7 +43,6 @@ Item {
delegate: TokenDelegate { delegate: TokenDelegate {
objectName: "AssetView_TokenListItem_" + symbol objectName: "AssetView_TokenListItem_" + symbol
locale: root.locale
readonly property string balance: "%1".arg(enabledNetworkBalance.amount) // Needed for the tests readonly property string balance: "%1".arg(enabledNetworkBalance.amount) // Needed for the tests
width: ListView.view.width width: ListView.view.width
onClicked: { onClicked: {

View File

@ -67,7 +67,6 @@ Rectangle {
} }
GasSelector { GasSelector {
id: gasSelector id: gasSelector
locale: root.store.locale
width: parent.width width: parent.width
getGasEthValue: root.currencyStore.getGasEthValue getGasEthValue: root.currencyStore.getGasEthValue
getFiatValue: root.currencyStore.getFiatValue getFiatValue: root.currencyStore.getFiatValue

View File

@ -17,7 +17,6 @@ import "../controls"
ColumnLayout { ColumnLayout {
id: historyView id: historyView
property var locale
property var account property var account
property int pageSize: 20 // number of transactions per page property int pageSize: 20 // number of transactions per page
property bool isLoading: false property bool isLoading: false
@ -114,7 +113,6 @@ ColumnLayout {
Component { Component {
id: transactionDelegate id: transactionDelegate
TransactionDelegate { TransactionDelegate {
locale: historyView.locale
property bool modelDataValid: modelData !== undefined && !!modelData property bool modelDataValid: modelData !== undefined && !!modelData
isIncoming: modelDataValid ? modelData.to === account.address: false isIncoming: modelDataValid ? modelData.to === account.address: false
cryptoValue: modelDataValid ? RootStore.getCurrencyAmount(RootStore.hex2Eth(modelData.value), resolvedSymbol) : "" cryptoValue: modelDataValid ? RootStore.getCurrencyAmount(RootStore.hex2Eth(modelData.value), resolvedSymbol) : ""

View File

@ -16,7 +16,6 @@ Item {
id: root id: root
property var store property var store
property var locale
property var bestRoutes property var bestRoutes
property var selectedAccount property var selectedAccount
property var selectedAsset property var selectedAsset

View File

@ -80,7 +80,6 @@ Item {
amountToSend: root.amountToSend amountToSend: root.amountToSend
isLoading: root.isLoading isLoading: root.isLoading
store: root.store store: root.store
locale: root.store.locale
selectedAsset: root.selectedAsset selectedAsset: root.selectedAsset
selectedAccount: root.selectedAccount selectedAccount: root.selectedAccount
errorMode: root.errorMode errorMode: root.errorMode

View File

@ -82,7 +82,6 @@ ColumnLayout {
visible: active visible: active
sourceComponent: NetworkCardsComponent { sourceComponent: NetworkCardsComponent {
store: root.store store: root.store
locale: root.store.locale
selectedAccount: root.selectedAccount selectedAccount: root.selectedAccount
allNetworks: root.store.allNetworks allNetworks: root.store.allNetworks
amountToSend: root.amountToSend amountToSend: root.amountToSend

View File

@ -16,7 +16,6 @@ RowLayout {
id: root id: root
property var store property var store
property var locale
property var bestRoutes property var bestRoutes
property var amountToSend property var amountToSend
property bool isLoading: false property bool isLoading: false

View File

@ -22,7 +22,6 @@ Item {
implicitHeight: visible ? accountSelectionTabBar.height + stackLayout.height + Style.current.bigPadding: 0 implicitHeight: visible ? accountSelectionTabBar.height + stackLayout.height + Style.current.bigPadding: 0
property var store property var store
property var locale
signal contactSelected(string address, int type) signal contactSelected(string address, int type)

View File

@ -14,7 +14,6 @@ import "../controls"
Rectangle { Rectangle {
id: root id: root
property var locale
property var assets: [] property var assets: []
signal tokenSelected(var selectedToken) signal tokenSelected(var selectedToken)
property var searchTokenSymbolByAddressFn: function (address) { property var searchTokenSymbolByAddressFn: function (address) {
@ -56,7 +55,6 @@ Rectangle {
} }
delegate: TokenBalancePerChainDelegate { delegate: TokenBalancePerChainDelegate {
width: ListView.view.width width: ListView.view.width
locale: root.locale
getNetworkIcon: root.getNetworkIcon getNetworkIcon: root.getNetworkIcon
onTokenSelected: root.tokenSelected(selectedToken) onTokenSelected: root.tokenSelected(selectedToken)
} }

View File

@ -18,7 +18,6 @@ import "../controls"
Item { Item {
id: root id: root
property var locale
property var currentAccount: RootStore.currentAccount property var currentAccount: RootStore.currentAccount
property var contactsStore property var contactsStore
property var transaction property var transaction
@ -58,7 +57,6 @@ Item {
objectName: "transactionDetailHeader" objectName: "transactionDetailHeader"
width: parent.width width: parent.width
locale: root.locale
modelData: transaction modelData: transaction
isIncoming: d.isIncoming isIncoming: d.isIncoming
property bool transactionValid: root.transaction !== undefined && !!root.transaction property bool transactionValid: root.transaction !== undefined && !!root.transaction
@ -156,7 +154,6 @@ Item {
spacing: 8 spacing: 8
TransactionDelegate { TransactionDelegate {
width: parent.width width: parent.width
locale: root.locale
modelData: transaction modelData: transaction
isIncoming: d.isIncoming isIncoming: d.isIncoming
property bool transactionValid: root.transaction !== undefined && !!root.transaction property bool transactionValid: root.transaction !== undefined && !!root.transaction