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,7 +1,7 @@
<template>
<div class="mkw-messaging">
<mk-widget-container :show-header="props.design == 0">
<template slot="header"><fa icon="comments"/>%i18n:@title%</template>
<template slot="header"><fa icon="comments"/>{{ $t('title') }}</template>
<button slot="func" @click="add"><fa icon="plus"/></button>
<mk-messaging ref="index" compact @navigate="navigate"/>
@ -11,6 +11,7 @@
<script lang="ts">
import define from '../../../common/define-widget';
import i18n from '../../../i18n';
import MkMessagingRoomWindow from '../components/messaging-room-window.vue';
import MkMessagingWindow from '../components/messaging-window.vue';
@ -20,6 +21,7 @@ export default define({
design: 0
})
}).extend({
i18n: i18n('desktop/views/widgets/messaging.vue'),
methods: {
navigate(user) {
(this as any).os.new(MkMessagingRoomWindow, {

View File

@ -1,8 +1,8 @@
<template>
<div class="mkw-notifications">
<mk-widget-container :show-header="!props.compact">
<template slot="header"><fa :icon="['far', 'bell']"/>%i18n:@title%</template>
<!-- <button slot="func" title="%i18n:@settings%" @click="settings"><fa icon="cog"/></button> -->
<template slot="header"><fa :icon="['far', 'bell']"/>{{ $t('title') }}</template>
<!-- <button slot="func" :title="$t('title')" @click="settings"><fa icon="cog"/></button> -->
<mk-notifications :class="$style.notifications"/>
</mk-widget-container>
@ -11,12 +11,15 @@
<script lang="ts">
import define from '../../../common/define-widget';
import i18n from '../../../i18n';
export default define({
name: 'notifications',
props: () => ({
compact: false
})
}).extend({
i18n: i18n('desktop/views/widgets/notifications.vue'),
methods: {
settings() {
alert('not implemented yet');

View File

@ -1,8 +1,8 @@
<template>
<div class="mkw-polls">
<mk-widget-container :show-header="!props.compact">
<template slot="header"><fa icon="chart-pie"/>%i18n:@title%</template>
<button slot="func" title="%i18n:@refresh%" @click="fetch"><fa icon="sync"/></button>
<template slot="header"><fa icon="chart-pie"/>{{ $t('title') }}</template>
<button slot="func" :title="$t('title')" @click="fetch"><fa icon="sync"/></button>
<div class="mkw-polls--body">
<div class="poll" v-if="!fetching && poll != null">
@ -10,8 +10,8 @@
<p v-if="!poll.text"><router-link :to="poll | notePage"><fa icon="link"/></router-link></p>
<mk-poll :note="poll"/>
</div>
<p class="empty" v-if="!fetching && poll == null">%i18n:@nothing%</p>
<p class="fetching" v-if="fetching"><fa icon="spinner .pulse" fixed-width/>%i18n:common.loading%<mk-ellipsis/></p>
<p class="empty" v-if="!fetching && poll == null">{{ $t('nothing') }}</p>
<p class="fetching" v-if="fetching"><fa icon="spinner .pulse" fixed-width/>{{ $t('@.loading') }}<mk-ellipsis/></p>
</div>
</mk-widget-container>
</div>
@ -19,6 +19,7 @@
<script lang="ts">
import define from '../../../common/define-widget';
import i18n from '../../../i18n';
export default define({
name: 'polls',
@ -26,6 +27,7 @@ export default define({
compact: false
})
}).extend({
i18n: i18n('desktop/views/widgets/polls.vue'),
data() {
return {
poll: null,

View File

@ -1,21 +1,24 @@
<template>
<div class="mkw-post-form">
<template v-if="props.design == 0">
<p class="title"><fa icon="pencil-alt"/>%i18n:@title%</p>
<p class="title"><fa icon="pencil-alt"/>{{ $t('title') }}</p>
</template>
<textarea :disabled="posting" v-model="text" @keydown="onKeydown" :placeholder="placeholder"></textarea>
<button @click="post" :disabled="posting">%i18n:@note%</button>
<button @click="post" :disabled="posting">{{ $t('note') }}</button>
</div>
</template>
<script lang="ts">
import define from '../../../common/define-widget';
import i18n from '../../../i18n';
export default define({
name: 'post-form',
props: () => ({
design: 0
})
}).extend({
i18n: i18n('desktop/views/widgets/post-form.vue'),
data() {
return {
posting: false,
@ -25,12 +28,12 @@ export default define({
computed: {
placeholder(): string {
const xs = [
'%i18n:common.note-placeholders.a%',
'%i18n:common.note-placeholders.b%',
'%i18n:common.note-placeholders.c%',
'%i18n:common.note-placeholders.d%',
'%i18n:common.note-placeholders.e%',
'%i18n:common.note-placeholders.f%'
this.$t('@.note-placeholders.a'),
this.$t('@.note-placeholders.b'),
this.$t('@.note-placeholders.c'),
this.$t('@.note-placeholders.d'),
this.$t('@.note-placeholders.e'),
this.$t('@.note-placeholders.f')
];
return xs[Math.floor(Math.random() * xs.length)];
}

View File

@ -7,13 +7,13 @@
>
<div class="banner"
:style="$store.state.i.bannerUrl ? `background-image: url(${$store.state.i.bannerUrl})` : ''"
title="%i18n:@update-banner%"
:title="$t('update-banner')"
@click="() => os.apis.updateBanner()"
></div>
<mk-avatar class="avatar" :user="$store.state.i"
:disable-link="true"
@click="() => os.apis.updateAvatar()"
title="%i18n:@update-avatar%"
:title="$t('update-avatar')"
/>
<router-link class="name" :to="$store.state.i | userPage">{{ $store.state.i | userName }}</router-link>
<p class="username">@{{ $store.state.i | acct }}</p>
@ -24,6 +24,7 @@
<script lang="ts">
import define from '../../../common/define-widget';
import i18n from '../../../i18n';
export default define({
name: 'profile',
@ -31,6 +32,7 @@ export default define({
design: 0
})
}).extend({
i18n: i18n('desktop/views/widgets/profile.vue'),
methods: {
func() {
if (this.props.design == 2) {

View File

@ -1,16 +1,16 @@
<template>
<div class="mkw-trends">
<mk-widget-container :show-header="!props.compact">
<template slot="header"><fa icon="fire"/>%i18n:@title%</template>
<button slot="func" title="%i18n:@refresh%" @click="fetch"><fa icon="sync"/></button>
<template slot="header"><fa icon="fire"/>{{ $t('title') }}</template>
<button slot="func" :title="$t('title')" @click="fetch"><fa icon="sync"/></button>
<div class="mkw-trends--body">
<p class="fetching" v-if="fetching"><fa icon="spinner .pulse" fixed-width/>%i18n:common.loading%<mk-ellipsis/></p>
<p class="fetching" v-if="fetching"><fa icon="spinner .pulse" fixed-width/>{{ $t('@.loading') }}<mk-ellipsis/></p>
<div class="note" v-else-if="note != null">
<p class="text"><router-link :to="note | notePage">{{ note.text }}</router-link></p>
<p class="author"><router-link :to="note.user | userPage">@{{ note.user | acct }}</router-link></p>
</div>
<p class="empty" v-else>%i18n:@nothing%</p>
<p class="empty" v-else>{{ $t('nothing') }}</p>
</div>
</mk-widget-container>
</div>
@ -18,6 +18,7 @@
<script lang="ts">
import define from '../../../common/define-widget';
import i18n from '../../../i18n';
export default define({
name: 'trends',
@ -25,6 +26,7 @@ export default define({
compact: false
})
}).extend({
i18n: i18n('desktop/views/widgets/trends.vue'),
data() {
return {
note: null,

View File

@ -1,11 +1,11 @@
<template>
<div class="mkw-users">
<mk-widget-container :show-header="!props.compact">
<template slot="header"><fa icon="users"/>%i18n:@title%</template>
<button slot="func" title="%i18n:@refresh%" @click="refresh"><fa icon="sync"/></button>
<template slot="header"><fa icon="users"/>{{ $t('title') }}</template>
<button slot="func" :title="$t('title')" @click="refresh"><fa icon="sync"/></button>
<div class="mkw-users--body">
<p class="fetching" v-if="fetching"><fa icon="spinner .pulse" fixed-width/>%i18n:common.loading%<mk-ellipsis/></p>
<p class="fetching" v-if="fetching"><fa icon="spinner .pulse" fixed-width/>{{ $t('@.loading') }}<mk-ellipsis/></p>
<template v-else-if="users.length != 0">
<div class="user" v-for="_user in users">
<mk-avatar class="avatar" :user="_user"/>
@ -15,7 +15,7 @@
</div>
</div>
</template>
<p class="empty" v-else>%i18n:@no-one%</p>
<p class="empty" v-else>{{ $t('no-one') }}</p>
</div>
</mk-widget-container>
</div>
@ -23,6 +23,7 @@
<script lang="ts">
import define from '../../../common/define-widget';
import i18n from '../../../i18n';
const limit = 3;
@ -32,6 +33,7 @@ export default define({
compact: false
})
}).extend({
i18n: i18n('desktop/views/widgets/users.vue'),
data() {
return {
users: [],