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 {
model: d.featuredCommunitiesModel
delegate: StatusCommunityCard {
locale: "es"
locale: Qt.locale("es")
communityId: model.communityId
loaded: model.available
logo: model.logo
@ -136,7 +136,7 @@ StatusSectionLayout {
Repeater {
model: d.popularCommunitiesModel
delegate: StatusCommunityCard {
locale: "es"
locale: Qt.locale("es")
communityId: model.communityId
loaded: model.available
logo: model.logo

View File

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

View File

@ -96,9 +96,8 @@ Rectangle {
/*!
\qmlproperty var StatusCommunityCard::locale
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
This property holds the community banner image url.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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