mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-20 01:34:24 +08:00
Update formater
This commit is contained in:
committed by
mayswind
parent
6bd1d09fa8
commit
c1b06eaa6f
+11
-11
@@ -847,7 +847,7 @@ function getAllCurrencyDisplayTypes(userStore, settingsStore, translateFn) {
|
|||||||
const defaultCurrency = userStore.currentUserDefaultCurrency;
|
const defaultCurrency = userStore.currentUserDefaultCurrency;
|
||||||
|
|
||||||
const ret = [];
|
const ret = [];
|
||||||
const defaultSampleValue = getFormatedAmountWithCurrency(12345, defaultCurrency, translateFn, userStore, settingsStore, false, defaultCurrencyDisplayType);
|
const defaultSampleValue = getFormattedAmountWithCurrency(12345, defaultCurrency, translateFn, userStore, settingsStore, false, defaultCurrencyDisplayType);
|
||||||
|
|
||||||
ret.push({
|
ret.push({
|
||||||
type: currencyConstants.defaultCurrencyDisplayTypeValue,
|
type: currencyConstants.defaultCurrencyDisplayTypeValue,
|
||||||
@@ -859,7 +859,7 @@ function getAllCurrencyDisplayTypes(userStore, settingsStore, translateFn) {
|
|||||||
let displayName = translateFn(type.name);
|
let displayName = translateFn(type.name);
|
||||||
|
|
||||||
if (type.symbol !== currencyConstants.allCurrencyDisplaySymbol.None) {
|
if (type.symbol !== currencyConstants.allCurrencyDisplaySymbol.None) {
|
||||||
const sampleValue = getFormatedAmountWithCurrency(12345, defaultCurrency, translateFn, userStore, settingsStore, false, type);
|
const sampleValue = getFormattedAmountWithCurrency(12345, defaultCurrency, translateFn, userStore, settingsStore, false, type);
|
||||||
displayName = `${displayName} (${sampleValue})`
|
displayName = `${displayName} (${sampleValue})`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -954,7 +954,7 @@ function getParsedAmountNumber(value, translateFn, userStore) {
|
|||||||
return parseAmount(value, numberFormatOptions);
|
return parseAmount(value, numberFormatOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFormatedAmount(value, translateFn, userStore) {
|
function getFormattedAmount(value, translateFn, userStore) {
|
||||||
const numberFormatOptions = getNumberFormatOptions(translateFn, userStore);
|
const numberFormatOptions = getNumberFormatOptions(translateFn, userStore);
|
||||||
return formatAmount(value, numberFormatOptions);
|
return formatAmount(value, numberFormatOptions);
|
||||||
}
|
}
|
||||||
@@ -974,7 +974,7 @@ function getCurrentCurrencyDisplayType(translateFn, userStore) {
|
|||||||
return currencyDisplayType;
|
return currencyDisplayType;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFormatedAmountWithCurrency(value, currencyCode, translateFn, userStore, settingsStore, notConvertValue, currencyDisplayType) {
|
function getFormattedAmountWithCurrency(value, currencyCode, translateFn, userStore, settingsStore, notConvertValue, currencyDisplayType) {
|
||||||
if (!isNumber(value) && !isString(value)) {
|
if (!isNumber(value) && !isString(value)) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@@ -1019,7 +1019,7 @@ function getFormatedAmountWithCurrency(value, currencyCode, translateFn, userSto
|
|||||||
return appendCurrencySymbol(value, currencyDisplayType, currencyCode, currencyUnit, currencyName, isPlural);
|
return appendCurrencySymbol(value, currencyDisplayType, currencyCode, currencyUnit, currencyName, isPlural);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFormatedExchangeRateAmount(value, translateFn, userStore) {
|
function getFormattedExchangeRateAmount(value, translateFn, userStore) {
|
||||||
const numberFormatOptions = getNumberFormatOptions(translateFn, userStore);
|
const numberFormatOptions = getNumberFormatOptions(translateFn, userStore);
|
||||||
return formatExchangeRateAmount(value, numberFormatOptions);
|
return formatExchangeRateAmount(value, numberFormatOptions);
|
||||||
}
|
}
|
||||||
@@ -1421,9 +1421,9 @@ function getCategorizedAccountsWithDisplayBalance(allVisibleAccounts, showAccoun
|
|||||||
const account = accountCategory.accounts[i];
|
const account = accountCategory.accounts[i];
|
||||||
|
|
||||||
if (showAccountBalance && account.isAsset) {
|
if (showAccountBalance && account.isAsset) {
|
||||||
account.displayBalance = getFormatedAmountWithCurrency(account.balance, account.currency, translateFn, userStore, settingsStore);
|
account.displayBalance = getFormattedAmountWithCurrency(account.balance, account.currency, translateFn, userStore, settingsStore);
|
||||||
} else if (showAccountBalance && account.isLiability) {
|
} else if (showAccountBalance && account.isLiability) {
|
||||||
account.displayBalance = getFormatedAmountWithCurrency(-account.balance, account.currency, translateFn, userStore, settingsStore);
|
account.displayBalance = getFormattedAmountWithCurrency(-account.balance, account.currency, translateFn, userStore, settingsStore);
|
||||||
} else {
|
} else {
|
||||||
account.displayBalance = '***';
|
account.displayBalance = '***';
|
||||||
}
|
}
|
||||||
@@ -1462,7 +1462,7 @@ function getCategorizedAccountsWithDisplayBalance(allVisibleAccounts, showAccoun
|
|||||||
totalBalance = totalBalance + '+';
|
totalBalance = totalBalance + '+';
|
||||||
}
|
}
|
||||||
|
|
||||||
accountCategory.displayBalance = getFormatedAmountWithCurrency(totalBalance, defaultCurrency, translateFn, userStore, settingsStore);
|
accountCategory.displayBalance = getFormattedAmountWithCurrency(totalBalance, defaultCurrency, translateFn, userStore, settingsStore);
|
||||||
} else {
|
} else {
|
||||||
accountCategory.displayBalance = '***';
|
accountCategory.displayBalance = '***';
|
||||||
}
|
}
|
||||||
@@ -1739,9 +1739,9 @@ export function i18nFunctions(i18nGlobal) {
|
|||||||
getCurrentDigitGroupingType: (userStore) => getCurrentDigitGroupingType(i18nGlobal.t, userStore.currentUserDigitGrouping),
|
getCurrentDigitGroupingType: (userStore) => getCurrentDigitGroupingType(i18nGlobal.t, userStore.currentUserDigitGrouping),
|
||||||
appendDigitGroupingSymbol: (userStore, value) => getNumberWithDigitGroupingSymbol(value, i18nGlobal.t, userStore),
|
appendDigitGroupingSymbol: (userStore, value) => getNumberWithDigitGroupingSymbol(value, i18nGlobal.t, userStore),
|
||||||
parseAmount: (userStore, value) => getParsedAmountNumber(value, i18nGlobal.t, userStore),
|
parseAmount: (userStore, value) => getParsedAmountNumber(value, i18nGlobal.t, userStore),
|
||||||
formatAmount: (userStore, value) => getFormatedAmount(value, i18nGlobal.t, userStore),
|
formatAmount: (userStore, value) => getFormattedAmount(value, i18nGlobal.t, userStore),
|
||||||
formatAmountWithCurrency: (settingsStore, userStore, value, currencyCode) => getFormatedAmountWithCurrency(value, currencyCode, i18nGlobal.t, userStore, settingsStore),
|
formatAmountWithCurrency: (settingsStore, userStore, value, currencyCode) => getFormattedAmountWithCurrency(value, currencyCode, i18nGlobal.t, userStore, settingsStore),
|
||||||
formatExchangeRateAmount: (userStore, value) => getFormatedExchangeRateAmount(value, i18nGlobal.t, userStore),
|
formatExchangeRateAmount: (userStore, value) => getFormattedExchangeRateAmount(value, i18nGlobal.t, userStore),
|
||||||
getAdaptiveAmountRate: (userStore, amount1, amount2, fromExchangeRate, toExchangeRate) => getAdaptiveAmountRate(amount1, amount2, fromExchangeRate, toExchangeRate, i18nGlobal.t, userStore),
|
getAdaptiveAmountRate: (userStore, amount1, amount2, fromExchangeRate, toExchangeRate) => getAdaptiveAmountRate(amount1, amount2, fromExchangeRate, toExchangeRate, i18nGlobal.t, userStore),
|
||||||
getAmountPrependAndAppendText: (settingsStore, userStore, currencyCode, isPlural) => getAmountPrependAndAppendText(currencyCode, userStore, settingsStore, isPlural, i18nGlobal.t),
|
getAmountPrependAndAppendText: (settingsStore, userStore, currencyCode, isPlural) => getAmountPrependAndAppendText(currencyCode, userStore, settingsStore, isPlural, i18nGlobal.t),
|
||||||
getAllExpenseAmountColors: () => getAllExpenseIncomeAmountColors(i18nGlobal.t, 1),
|
getAllExpenseAmountColors: () => getAllExpenseIncomeAmountColors(i18nGlobal.t, 1),
|
||||||
|
|||||||
+5
-5
@@ -10,10 +10,10 @@
|
|||||||
"Vietnamese": "Tiếng Việt"
|
"Vietnamese": "Tiếng Việt"
|
||||||
},
|
},
|
||||||
"default": {
|
"default": {
|
||||||
"currency": "USD",
|
"currency": "VND",
|
||||||
"firstDayOfWeek": "Sunday",
|
"firstDayOfWeek": "Monday",
|
||||||
"longDateFormat": "MMDDYYYY",
|
"longDateFormat": "DDMMYYYY",
|
||||||
"shortDateFormat": "MMDDYYYY",
|
"shortDateFormat": "DDMMYYYY",
|
||||||
"longTimeFormat": "HHMMSSA",
|
"longTimeFormat": "HHMMSSA",
|
||||||
"shortTimeFormat": "HHMMA",
|
"shortTimeFormat": "HHMMA",
|
||||||
"decimalSeparator": "Dot",
|
"decimalSeparator": "Dot",
|
||||||
@@ -531,7 +531,7 @@
|
|||||||
"UZS": "Uzbekistani Sum",
|
"UZS": "Uzbekistani Sum",
|
||||||
"VED": "Venezuelan Bolívar Digital",
|
"VED": "Venezuelan Bolívar Digital",
|
||||||
"VES": "Venezuelan Bolívar Soberano",
|
"VES": "Venezuelan Bolívar Soberano",
|
||||||
"VND": "Vietnamese Dong",
|
"VND": "Việt Nam Đồng",
|
||||||
"VUV": "Vanuatu Vatu",
|
"VUV": "Vanuatu Vatu",
|
||||||
"WST": "Samoan Tala",
|
"WST": "Samoan Tala",
|
||||||
"XAF": "Central African CFA Franc",
|
"XAF": "Central African CFA Franc",
|
||||||
|
|||||||
Reference in New Issue
Block a user