code refactor

This commit is contained in:
MaysWind
2023-07-11 00:35:21 +08:00
parent d76e88af21
commit a235d6a8cd
2 changed files with 12 additions and 7 deletions
+11
View File
@@ -627,6 +627,16 @@ function getAllTransactionEditScopeTypes(translateFn) {
}];
}
function getEnableDisableOptions(translateFn) {
return [{
value: true,
displayName: translateFn('Enable')
},{
value: false,
displayName: translateFn('Disable')
}];
}
function getDisplayCurrency(value, currencyCode, options, translateFn) {
if (!isNumber(value) && !isString(value)) {
return value;
@@ -896,6 +906,7 @@ export function i18nFunctions(i18nGlobal) {
getAllStatisticsChartDataTypes: () => getAllStatisticsChartDataTypes(i18nGlobal.t),
getAllStatisticsSortingTypes: () => getAllStatisticsSortingTypes(i18nGlobal.t),
getAllTransactionEditScopeTypes: () => getAllTransactionEditScopeTypes(i18nGlobal.t),
getEnableDisableOptions: () => getEnableDisableOptions(i18nGlobal.t),
getDisplayCurrency: (value, currencyCode, options) => getDisplayCurrency(value, currencyCode, options, i18nGlobal.t),
setLanguage: (locale, force) => setLanguage(i18nGlobal, locale, force),
initLocale: (lastUserLanguage, timezone) => initLocale(i18nGlobal, lastUserLanguage, timezone)