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

@@ -15,13 +15,13 @@
<path class="wave d" d="M29.18,1.06c-0.479-0.502-1.273-0.522-1.775-0.044c-0.016,0.015-0.029,0.029-0.045,0.044c-0.5,0.52-0.5,1.36,0,1.88 c1.361,1.4,2.041,3.24,2.041,5.08s-0.68,3.66-2.041,5.08c-0.5,0.52-0.5,1.36,0,1.88c0.509,0.508,1.332,0.508,1.841,0 c1.86-1.92,2.8-4.44,2.8-6.96C31.99,5.424,30.98,2.931,29.18,1.06z"></path>
</svg>
</div>
<p class="fetching" v-if="fetching">%i18n:@fetching%<mk-ellipsis/></p>
<h1 v-if="!fetching">{{ announcements.length == 0 ? '%i18n:@no-broadcasts%' : announcements[i].title }}</h1>
<p class="fetching" v-if="fetching">{{ $t('fetching') }}<mk-ellipsis/></p>
<h1 v-if="!fetching">{{ announcements.length == 0 ? this.$t('no-broadcasts') : announcements[i].title }}</h1>
<p v-if="!fetching">
<span v-if="announcements.length != 0" v-html="announcements[i].text"></span>
<template v-if="announcements.length == 0">%i18n:@have-a-nice-day%</template>
<template v-if="announcements.length == 0">{{ $t('have-a-nice-day') }}</template>
</p>
<a v-if="announcements.length > 1" @click="next">%i18n:@next% &gt;&gt;</a>
<a v-if="announcements.length > 1" @click="next">{{ $t('next') }} &gt;&gt;</a>
</div>
</mk-widget-container>
</div>
@@ -29,6 +29,7 @@
<script lang="ts">
import define from '../../../common/define-widget';
import i18n from '../../../i18n';
export default define({
name: 'broadcast',
@@ -36,6 +37,7 @@ export default define({
design: 0
})
}).extend({
i18n: i18n('common/views/widgets/broadcast.vue'),
data() {
return {
i: 0,

View File

@@ -4,27 +4,27 @@
<div class="mkw-calendar--body">
<div class="calendar" :data-is-holiday="isHoliday">
<p class="month-and-year">
<span class="year">{{ '%i18n:@year%'.split('{}')[0] }}{{ year }}{{ '%i18n:@year%'.split('{}')[1] }}</span>
<span class="month">{{ '%i18n:@month%'.split('{}')[0] }}{{ month }}{{ '%i18n:@month%'.split('{}')[1] }}</span>
<span class="year">{{ this.$t('year').split('{}')[0] }}{{ year }}{{ this.$t('year').split('{}')[1] }}</span>
<span class="month">{{ this.$t('month').split('{}')[0] }}{{ month }}{{ this.$t('month').split('{}')[1] }}</span>
</p>
<p class="day">{{ '%i18n:@day%'.split('{}')[0] }}{{ day }}{{ '%i18n:@day%'.split('{}')[1] }}</p>
<p class="day">{{ this.$t('day').split('{}')[0] }}{{ day }}{{ this.$t('day').split('{}')[1] }}</p>
<p class="week-day">{{ weekDay }}</p>
</div>
<div class="info">
<div>
<p>%i18n:@today%<b>{{ dayP.toFixed(1) }}%</b></p>
<p>{{ $t('today') }}<b>{{ dayP.toFixed(1) }}%</b></p>
<div class="meter">
<div class="val" :style="{ width: `${dayP}%` }"></div>
</div>
</div>
<div>
<p>%i18n:@this-month%<b>{{ monthP.toFixed(1) }}%</b></p>
<p>{{ $t('this-month') }}<b>{{ monthP.toFixed(1) }}%</b></p>
<div class="meter">
<div class="val" :style="{ width: `${monthP}%` }"></div>
</div>
</div>
<div>
<p>%i18n:@this-year%<b>{{ yearP.toFixed(1) }}%</b></p>
<p>{{ $t('this-year') }}<b>{{ yearP.toFixed(1) }}%</b></p>
<div class="meter">
<div class="val" :style="{ width: `${yearP}%` }"></div>
</div>
@@ -37,12 +37,15 @@
<script lang="ts">
import define from '../../../common/define-widget';
import i18n from '../../../i18n';
export default define({
name: 'calendar',
props: () => ({
design: 0
})
}).extend({
i18n: i18n('common/views/widgets/calendar.vue'),
data() {
return {
now: new Date(),
@@ -85,13 +88,13 @@ export default define({
this.month = nm + 1;
this.day = nd;
this.weekDay = [
'%i18n:common.weekday.sunday%',
'%i18n:common.weekday.monday%',
'%i18n:common.weekday.tuesday%',
'%i18n:common.weekday.wednesday%',
'%i18n:common.weekday.thursday%',
'%i18n:common.weekday.friday%',
'%i18n:common.weekday.saturday%'
this.$t('@.weekday.sunday'),
this.$t('@.weekday.monday'),
this.$t('@.weekday.tuesday'),
this.$t('@.weekday.wednesday'),
this.$t('@.weekday.thursday'),
this.$t('@.weekday.friday'),
this.$t('@.weekday.saturday')
][now.getDay()];
const dayNumer = now.getTime() - new Date(ny, nm, nd).getTime();

View File

@@ -2,11 +2,11 @@
<div>
<mk-widget-container :show-header="false">
<article class="dolfvtibguprpxxhfndqaosjitixjohx">
<h1><fa icon="heart"/>%i18n:@title%</h1>
<h1><fa icon="heart"/>{{ $t('title') }}</h1>
<p v-if="meta">
{{ '%i18n:@text%'.substr(0, '%i18n:@text%'.indexOf('{')) }}
{{ this.$t('text').substr(0, this.$t('text').indexOf('{')) }}
<a :href="'mailto:' + meta.maintainer.email">{{ meta.maintainer.name }}</a>
{{ '%i18n:@text%'.substr('%i18n:@text%'.indexOf('}') + 1) }}
{{ this.$t('text').substr(this.$t('text').indexOf('}') + 1) }}
</p>
</article>
</mk-widget-container>
@@ -15,9 +15,12 @@
<script lang="ts">
import define from '../../../common/define-widget';
import i18n from '../../../i18n';
export default define({
name: 'donation'
}).extend({
i18n: i18n('common/views/widgets/donation.vue'),
data() {
return {
meta: null

View File

@@ -1,7 +1,7 @@
<template>
<div class="mkw-hashtags">
<mk-widget-container :show-header="!props.compact">
<template slot="header"><fa icon="hashtag"/>%i18n:@title%</template>
<template slot="header"><fa icon="hashtag"/>{{ $t('title') }}</template>
<div class="mkw-hashtags--body" :data-mobile="platform == 'mobile'">
<mk-trends/>
@@ -12,6 +12,7 @@
<script lang="ts">
import define from '../../../common/define-widget';
import i18n from '../../../i18n';
export default define({
name: 'hashtags',
@@ -19,6 +20,7 @@ export default define({
compact: false
})
}).extend({
i18n: i18n('common/views/widgets/hashtags.vue'),
methods: {
func() {
this.props.compact = !this.props.compact;

View File

@@ -1,11 +1,11 @@
<template>
<div class="mkw-memo">
<mk-widget-container :show-header="!props.compact">
<template slot="header"><fa :icon="['far', 'sticky-note']"/>%i18n:@title%</template>
<template slot="header"><fa :icon="['far', 'sticky-note']"/>{{ $t('title') }}</template>
<div class="mkw-memo--body">
<textarea v-model="text" placeholder="%i18n:@memo%" @input="onChange"></textarea>
<button @click="saveMemo" :disabled="!changed">%i18n:@save%</button>
<textarea v-model="text" :placeholder="$t('placeholder')" @input="onChange"></textarea>
<button @click="saveMemo" :disabled="!changed">{{ $t('save') }}</button>
</div>
</mk-widget-container>
</div>
@@ -13,6 +13,7 @@
<script lang="ts">
import define from '../../define-widget';
import i18n from '../../../i18n';
export default define({
name: 'memo',
@@ -20,6 +21,7 @@ export default define({
compact: false
})
}).extend({
i18n: i18n('common/views/widgets/memo.vue'),
data() {
return {
text: null,

View File

@@ -1,25 +1,29 @@
<template>
<div class="mkw-photo-stream" :class="$style.root" :data-melt="props.design == 2">
<mk-widget-container :show-header="props.design == 0" :naked="props.design == 2">
<template slot="header"><fa icon="camera"/>%i18n:@title%</template>
<template slot="header"><fa icon="camera"/>{{ $t('title') }}</template>
<p :class="$style.fetching" v-if="fetching"><fa icon="spinner .pulse" fixed-width/>%i18n:common.loading%<mk-ellipsis/></p>
<p :class="$style.fetching" v-if="fetching"><fa icon="spinner .pulse" fixed-width/>{{ $t('@.loading') }}<mk-ellipsis/></p>
<div :class="$style.stream" v-if="!fetching && images.length > 0">
<div v-for="image in images" :class="$style.img" :style="`background-image: url(${image.thumbnailUrl || image.url})`"></div>
</div>
<p :class="$style.empty" v-if="!fetching && images.length == 0">%i18n:@no-photos%</p>
<p :class="$style.empty" v-if="!fetching && images.length == 0">{{ $t('no-photos') }}</p>
</mk-widget-container>
</div>
</template>
<script lang="ts">
import define from '../../../common/define-widget';
import i18n from '../../../i18n';
export default define({
name: 'photo-stream',
props: () => ({
design: 0
})
}).extend({
i18n: i18n('common/views/widgets/photo-stream.vue'),
data() {
return {
images: [],

View File

@@ -1,8 +1,8 @@
<template>
<div class="mkw-posts-monitor">
<mk-widget-container :show-header="props.design == 0" :naked="props.design == 2">
<template slot="header"><fa icon="chart-line"/>%i18n:@title%</template>
<button slot="func" @click="toggle" title="%i18n:@toggle%"><fa icon="sort"/></button>
<template slot="header"><fa icon="chart-line"/>{{ $t('title') }}</template>
<button slot="func" @click="toggle" :title="$t('toggle')"><fa icon="sort"/></button>
<div class="qpdmibaztplkylerhdbllwcokyrfxeyj" :class="{ dual: props.view == 0 }">
<svg :viewBox="`0 0 ${ viewBoxX } ${ viewBoxY }`" v-show="props.view != 2">
@@ -70,15 +70,18 @@
<script lang="ts">
import define from '../../../common/define-widget';
import i18n from '../../../i18n';
import * as uuid from 'uuid';
export default define({
name: 'server',
name: 'posts-monitor',
props: () => ({
design: 0,
view: 0
})
}).extend({
i18n: i18n('common/views/widgets/posts-monitor.vue'),
data() {
return {
connection: null,

View File

@@ -5,7 +5,7 @@
<button slot="func" title="設定" @click="setting"><fa icon="cog"/></button>
<div class="mkw-rss--body" :data-mobile="platform == 'mobile'">
<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="feed" v-else>
<a v-for="item in items" :href="item.link" target="_blank">{{ item.title }}</a>
</div>
@@ -16,6 +16,8 @@
<script lang="ts">
import define from '../../../common/define-widget';
import i18n from '../../../i18n';
export default define({
name: 'rss',
props: () => ({
@@ -23,6 +25,7 @@ export default define({
url: 'http://news.yahoo.co.jp/pickup/rss.xml'
})
}).extend({
i18n: i18n(),
data() {
return {
items: [],

View File

@@ -1,10 +1,10 @@
<template>
<div class="mkw-server">
<mk-widget-container :show-header="props.design == 0" :naked="props.design == 2">
<template slot="header"><fa icon="server"/>%i18n:@title%</template>
<button slot="func" @click="toggle" title="%i18n:@toggle%"><fa icon="sort"/></button>
<template slot="header"><fa icon="server"/>{{ $t('title') }}</template>
<button slot="func" @click="toggle" :title="$t('toggle')"><fa icon="sort"/></button>
<p :class="$style.fetching" v-if="fetching"><fa icon="spinner .pulse" fixed-width/>%i18n:common.loading%<mk-ellipsis/></p>
<p :class="$style.fetching" v-if="fetching"><fa icon="spinner .pulse" fixed-width/>{{ $t('@.loading') }}<mk-ellipsis/></p>
<template v-if="!fetching">
<x-cpu-memory v-show="props.view == 0" :connection="connection"/>
<x-cpu v-show="props.view == 1" :connection="connection" :meta="meta"/>
@@ -19,6 +19,7 @@
<script lang="ts">
import define from '../../../common/define-widget';
import i18n from '../../../i18n';
import XCpuMemory from './server.cpu-memory.vue';
import XCpu from './server.cpu.vue';
import XMemory from './server.memory.vue';
@@ -33,6 +34,8 @@ export default define({
view: 0
})
}).extend({
i18n: i18n('common/views/widgets/server.vue'),
components: {
XCpuMemory,
XCpu,

View File

@@ -2,10 +2,10 @@
<div class="mkw-slideshow" :data-mobile="platform == 'mobile'">
<div @click="choose">
<p v-if="props.folder === undefined">
<template v-if="isCustomizeMode">%i18n:@folder-customize-mode%</template>
<template v-else>%i18n:@folder%</template>
<template v-if="isCustomizeMode">{{ $t('folder-customize-mode') }}</template>
<template v-else>{{ $t('folder') }}</template>
</p>
<p v-if="props.folder !== undefined && images.length == 0 && !fetching">%i18n:@no-image%</p>
<p v-if="props.folder !== undefined && images.length == 0 && !fetching">{{ $t('no-image') }}</p>
<div ref="slideA" class="slide a"></div>
<div ref="slideB" class="slide b"></div>
</div>
@@ -15,6 +15,8 @@
<script lang="ts">
import * as anime from 'animejs';
import define from '../../../common/define-widget';
import i18n from '../../../i18n';
export default define({
name: 'slideshow',
props: () => ({
@@ -22,6 +24,8 @@ export default define({
size: 0
})
}).extend({
i18n: i18n('common/views/widgets/slideshow.vue'),
data() {
return {
images: [],

View File

@@ -7,35 +7,37 @@
<script lang="ts">
import * as anime from 'animejs';
import define from '../../../common/define-widget';
const tips = [
'%i18n:@tips-line1%',
'%i18n:@tips-line2%',
'%i18n:@tips-line3%',
'%i18n:@tips-line4%',
'%i18n:@tips-line5%',
'%i18n:@tips-line6%',
'%i18n:@tips-line7%',
'%i18n:@tips-line8%',
'%i18n:@tips-line9%',
'%i18n:@tips-line10%',
'%i18n:@tips-line11%',
'%i18n:@tips-line13%',
'%i18n:@tips-line14%',
'%i18n:@tips-line17%',
'%i18n:@tips-line19%',
'%i18n:@tips-line20%',
'%i18n:@tips-line21%',
'%i18n:@tips-line23%',
'%i18n:@tips-line24%',
'%i18n:@tips-line25%'
]
import i18n from '../../../i18n';
export default define({
name: 'tips'
}).extend({
i18n: i18n('common/views/widgets/tips.vue'),
data() {
return {
tips: [
this.$t('tips-line1'),
this.$t('tips-line2'),
this.$t('tips-line3'),
this.$t('tips-line4'),
this.$t('tips-line5'),
this.$t('tips-line6'),
this.$t('tips-line7'),
this.$t('tips-line8'),
this.$t('tips-line9'),
this.$t('tips-line10'),
this.$t('tips-line11'),
this.$t('tips-line13'),
this.$t('tips-line14'),
this.$t('tips-line17'),
this.$t('tips-line19'),
this.$t('tips-line20'),
this.$t('tips-line21'),
this.$t('tips-line23'),
this.$t('tips-line24'),
this.$t('tips-line25')
],
tip: null,
clock: null
};