replace i18n filter

This commit is contained in:
MaysWind
2021-01-24 01:09:01 +08:00
parent d913bdceaa
commit 0e642821eb
11 changed files with 17 additions and 26 deletions
-5
View File
@@ -11163,11 +11163,6 @@
"resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-8.22.1.tgz",
"integrity": "sha512-JNgiEJ5a8YPfk5y2lKyfOAGLmkpAVfhaUi+T4wGpSppRYZ3XSyawSDDketY5KV2CsAiBLAGEIO6jO+0l2hQubg=="
},
"vue-i18n-filter": {
"version": "0.1.6",
"resolved": "https://registry.npmjs.org/vue-i18n-filter/-/vue-i18n-filter-0.1.6.tgz",
"integrity": "sha512-zYo06SmMZtJwTkEd2l+t1jCH8lrtTbkwwoz/6XLvFzNF4tGd5CPOhfIxLLv0wf9vxMVYE14KRuzOZzw26qfRxA=="
},
"vue-loader": {
"version": "15.9.3",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-15.9.3.tgz",
-1
View File
@@ -24,7 +24,6 @@
"vue-clipboard2": "^0.3.1",
"vue-echarts": "^5.0.0-beta.0",
"vue-i18n": "^8.22.1",
"vue-i18n-filter": "^0.1.6",
"vue-moment": "^4.1.0",
"vue-pincode-input": "^0.4.0",
"vuex": "^3.6.0"
+3
View File
@@ -0,0 +1,3 @@
export default function ({i18n}, text, options) {
return i18n.t(text, options || {});
}
+2 -2
View File
@@ -2,7 +2,6 @@ import Vue from 'vue';
import Vuex from 'vuex';
import VueI18n from 'vue-i18n';
import VueI18nFilter from 'vue-i18n-filter';
import ECharts from 'vue-echarts';
import PincodeInput from 'vue-pincode-input';
import VueMoment from 'vue-moment';
@@ -72,6 +71,7 @@ import userstate from './lib/userstate.js';
import webauthn from './lib/webauthn.js';
import utils from './lib/utils.js';
import stores from './store/index.js';
import localizedFilter from './filters/localized.js';
import itemFieldContentFilter from './filters/itemFieldContent.js';
import currencyFilter from './filters/currency.js';
import iconFilter from './filters/icon.js';
@@ -129,7 +129,6 @@ Framework7.use(Framework7Vue);
Vue.use(Vuex);
Vue.use(VueI18n);
Vue.use(VueI18nFilter);
Vue.use(VueMoment, { moment });
Vue.use(VueClipboard);
@@ -287,6 +286,7 @@ Vue.prototype.$hideLoading = function () {
Vue.prototype.$user = userstate;
Vue.filter('localized', (value, options) => localizedFilter({ i18n }, value, options));
Vue.filter('itemFieldContent', (value, fieldName, defaultValue, translate) => itemFieldContentFilter({ i18n }, value, fieldName, defaultValue, translate));
Vue.filter('currency', (value, currencyCode) => currencyFilter({ i18n }, value, currencyCode));
Vue.filter('icon', (value, iconType) => iconFilter(value, iconType));
+1 -1
View File
@@ -13,7 +13,7 @@
<small>Expense</small>
</span>
<span :style="{ opacity: 0.6 }" v-else-if="!loading">
<span class="home-summary-month">{{ dateRange.thisMonth.startTime | moment('MMMM') | monthNameLocalizedKey | t }}</span>
<span class="home-summary-month">{{ dateRange.thisMonth.startTime | moment('MMMM') | monthNameLocalizedKey | localized }}</span>
<span>·</span>
<small>{{ $t('Expense') }}</small>
</span>
+1 -1
View File
@@ -117,7 +117,7 @@
<f7-card v-for="(categories, categoryType) in presetCategories" :key="categoryType">
<f7-card-header>
<small :style="{ opacity: 0.6 }">
<span>{{ categoryType | categoryTypeName($constants.category.allCategoryTypes) | t }}</span>
<span>{{ categoryType | categoryTypeName($constants.category.allCategoryTypes) | localized }}</span>
</small>
</f7-card-header>
<f7-card-content class="no-safe-areas" :padding="false">
+2 -2
View File
@@ -24,7 +24,7 @@
<f7-list-item
link="#"
:title="$t('Account Category')"
:after="account.category | accountCategoryName(allAccountCategories) | t"
:after="account.category | accountCategoryName(allAccountCategories) | localized"
@click="showAccountCategorySheet = true"
>
<list-item-selection-sheet value-type="item"
@@ -41,7 +41,7 @@
link="#"
:class="{ 'disabled': editAccountId }"
:title="$t('Account Type')"
:after="account.type | accountTypeName | t"
:after="account.type | accountTypeName | localized"
@click="showAccountTypeSheet = true"
>
<list-item-selection-sheet value-type="item"
+1 -1
View File
@@ -12,7 +12,7 @@
<f7-card v-for="categoryInfo in allCategories" :key="categoryInfo.type">
<f7-card-header>
<small :style="{ opacity: 0.6 }">
<span>{{ categoryInfo.type | categoryTypeName($constants.category.allCategoryTypes) | t }}</span>
<span>{{ categoryInfo.type | categoryTypeName($constants.category.allCategoryTypes) | localized }}</span>
</small>
</f7-card-header>
<f7-card-content class="no-safe-areas" :padding="false">
+5 -5
View File
@@ -26,10 +26,10 @@
<f7-toolbar tabbar bottom>
<f7-link class="tabbar-text-with-ellipsis" popover-open=".date-popover-menu">
<span :class="{ 'tabbar-item-changed': query.maxTime > 0 || query.minTime > 0 }">{{ query.dateType | dateRangeName(allDateRanges, 'Date') | t }}</span>
<span :class="{ 'tabbar-item-changed': query.maxTime > 0 || query.minTime > 0 }">{{ query.dateType | dateRangeName(allDateRanges, 'Date') | localized }}</span>
</f7-link>
<f7-link class="tabbar-text-with-ellipsis" popover-open=".type-popover-menu">
<span :class="{ 'tabbar-item-changed': query.type > 0 }">{{ query.type | typeName('Type') | t }}</span>
<span :class="{ 'tabbar-item-changed': query.type > 0 }">{{ query.type | typeName('Type') | localized }}</span>
</f7-link>
<f7-link class="tabbar-text-with-ellipsis" popover-open=".category-popover-menu" :class="{ 'disabled': query.type === 1 }">
<span :class="{ 'tabbar-item-changed': query.categoryId > 0 }">{{ query.categoryId | categoryName(allCategories, $t('Category')) }}</span>
@@ -165,7 +165,7 @@
{{ transaction.day }}
</span>
<span class="transaction-day-of-week full-line flex-direction-column">
{{ `datetime.${transaction.dayOfWeek}.short` | t }}
{{ `datetime.${transaction.dayOfWeek}.short` | localized }}
</span>
</div>
<div class="transaction-icon display-flex align-items-center">
@@ -186,7 +186,7 @@
{{ transaction.category.name }}
</span>
<span v-else-if="transaction.type !== $constants.transaction.allTransactionTypes.ModifyBalance && !transaction.category">
{{ transaction.type | transactionTypeName($constants.transaction.allTransactionTypes) | t }}
{{ transaction.type | transactionTypeName($constants.transaction.allTransactionTypes) | localized }}
</span>
</div>
<div slot="text" class="transaction-comment" v-if="transaction.comment">
@@ -233,7 +233,7 @@
<f7-list>
<f7-list-item v-for="dateRange in allDateRanges"
:key="dateRange.type"
:title="dateRange.name | t"
:title="dateRange.name | localized"
@click="changeDateFilter(dateRange.type)">
<f7-icon slot="after" class="list-item-checked" f7="checkmark_alt" v-if="query.dateType === dateRange.type"></f7-icon>
<div slot="footer"
+2 -2
View File
@@ -28,8 +28,8 @@
v-for="token in tokens"
:key="token.tokenId"
:id="token | tokenDomId"
:title="token | tokenTitle | t"
:text="token | tokenDevice | t">
:title="token | tokenTitle | localized"
:text="token | tokenDevice | localized">
<f7-icon slot="media" :f7="token | tokenIcon"></f7-icon>
<small slot="after">{{ token.createdAt | moment($t('format.datetime.long')) }}</small>
<f7-swipeout-actions right v-if="!token.isCurrent">
-6
View File
@@ -99,12 +99,6 @@
"url": "https://github.com/kazupon/vue-i18n",
"licenseUrl": "https://github.com/kazupon/vue-i18n/blob/v8.x/LICENSE"
},
{
"name": "vue-i18n-filter",
"copyright": "Copyright (c) 2018 +v",
"url": "https://github.com/chiaweilee/vue-i18n-filter",
"licenseUrl": "https://github.com/chiaweilee/vue-i18n-filter/blob/master/LICENSE"
},
{
"name": "vue-moment",
"copyright": "Copyright (c) 2017 Brock Petrie",