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