Refactoring of i18n (#3165)

Refactoring of i18n
This commit is contained in:
syuilo
2018-11-09 03:44:35 +09:00
committed by GitHub
parent 21303bd06a
commit 25a69ec1b6
211 changed files with 1825 additions and 1624 deletions

View File

@@ -1,30 +1,32 @@
<template>
<div class="cdeuzmsthagexbkpofbmatmugjuvogfb">
<ui-card>
<div slot="title"><fa icon="broadcast-tower"/> %i18n:@announcements%</div>
<div slot="title"><fa icon="broadcast-tower"/> {{ $t('announcements') }}</div>
<section v-for="(announcement, i) in announcements" class="fit-top">
<ui-input v-model="announcement.title" @change="save">
<span>%i18n:@title%</span>
<span>{{ $t('title') }}</span>
</ui-input>
<ui-textarea v-model="announcement.text">
<span>%i18n:@text%</span>
<span>{{ $t('text') }}</span>
</ui-textarea>
<ui-horizon-group>
<ui-button @click="save()"><fa :icon="['far', 'save']"/> %i18n:@save%</ui-button>
<ui-button @click="remove(i)"><fa :icon="['far', 'trash-alt']"/> %i18n:@remove%</ui-button>
<ui-button @click="save()"><fa :icon="['far', 'save']"/> {{ $t('save') }}</ui-button>
<ui-button @click="remove(i)"><fa :icon="['far', 'trash-alt']"/> {{ $t('remove') }}</ui-button>
</ui-horizon-group>
</section>
<section>
<ui-button @click="add"><fa icon="plus"/> %i18n:@add%</ui-button>
<ui-button @click="add"><fa icon="plus"/> {{ $t('add') }}</ui-button>
</section>
</ui-card>
</div>
</template>
<script lang="ts">
import Vue from "vue";
import Vue from 'vue';
import i18n from '../../i18n';
export default Vue.extend({
i18n: i18n('admin/views/announcements.vue'),
data() {
return {
announcements: [],
@@ -48,7 +50,7 @@ export default Vue.extend({
remove(i) {
this.$swal({
type: 'warning',
text: '%i18n:@_remove.are-you-sure%'.replace('$1', this.announcements.find((_, j) => j == i).title),
text: this.$t('_remove.are-you-sure').replace('$1', this.announcements.find((_, j) => j == i).title),
showCancelButton: true
}).then(res => {
if (!res.value) return;
@@ -56,7 +58,7 @@ export default Vue.extend({
this.save(true);
this.$swal({
type: 'success',
text: '%i18n:@_remove.removed%'
text: this.$t('_remove.removed')
});
});
},
@@ -68,7 +70,7 @@ export default Vue.extend({
if (!silent) {
this.$swal({
type: 'success',
text: '%i18n:@saved%'
text: this.$t('saved')
});
}
}).catch(e => {