From 32053d963fb21ad1bc64a2f38616e8af20f8fb1a Mon Sep 17 00:00:00 2001
From: syuilo <syuilotan@yahoo.co.jp>
Date: Thu, 2 Aug 2018 07:36:25 +0900
Subject: [PATCH] i18n reversi

---
 locales/ja.yml                                | 42 +++++++++++++++++++
 .../components/games/reversi/reversi.game.vue |  4 +-
 .../components/games/reversi/reversi.room.vue | 38 ++++++++---------
 .../components/games/reversi/reversi.vue      | 34 +++++++--------
 4 files changed, 79 insertions(+), 39 deletions(-)

diff --git a/locales/ja.yml b/locales/ja.yml
index cadf75f693..6f1a00309d 100644
--- a/locales/ja.yml
+++ b/locales/ja.yml
@@ -83,6 +83,10 @@ common:
     turn-of: "{}のターンです"
     past-turn-of: "{}のターン"
     won: "{}の勝ち"
+    black: "黒"
+    white: "白"
+    total: "合計"
+    this-turn: "{}ターン目"
 
   widgets:
     analog-clock: "アナログ時計"
@@ -127,6 +131,44 @@ common:
     stack-left: "左に重ねる"
     pop-right: "右に出す"
 
+common/views/components/games/reversi/reversi.vue:
+  title: "Misskey Reversi"
+  sub-title: "他のMisskeyユーザーとリバーシで対戦しよう"
+  invite: "招待"
+  rule: "遊び方"
+  rule-desc: "リバーシは、相手と交互に石をボードに置いて、相手の石を挟んで自分の色に変えてゆき、最終的に残った石が多い方が勝ちというボードゲームです。"
+  mode-invite: "招待"
+  mode-invite-desc: "指定したユーザーと対戦するモードです。"
+  invitations: "対局の招待があります!"
+  my-games: "自分の対局"
+  all-games: "みんなの対局"
+  enter-username: "ユーザー名を入力してください"
+  game-state:
+    ended: "終了"
+    playing: "進行中"
+  matching:
+    waiting-for: "{}を待っています"
+    cacnel: "キャンセル"
+
+common/views/components/games/reversi/reversi.room.vue:
+  settings-of-the-game: "ゲームの設定"
+  choose-map: "マップを選択"
+  random: "ランダム"
+  black-or-white: "先手/後手"
+  black-is: "{}が黒"
+  rules: "ルール"
+  is-llotheo: "石の少ない方が勝ち(ロセオ)"
+  looped-map: "ループマップ"
+  can-put-everywhere: "どこでも置けるモード"
+  settings-of-the-bot: "Botの設定"
+  this-gane-is-started-soon: "ゲームは数秒後に開始されます"
+  waiting-for-other: "相手の準備が完了するのを待っています"
+  waiting-for-me: "あなたの準備が完了するのを待っています"
+  waiting-for-both: "準備中"
+  cancel: "キャンセル"
+  ready: "準備完了"
+  cancel-ready: "準備続行"
+
 common/views/components/connect-failed.vue:
   title: "サーバーに接続できません"
   description: "インターネット回線に問題があるか、サーバーがダウンまたはメンテナンスしている可能性があります。しばらくしてから{再度お試し}ください。"
diff --git a/src/client/app/common/views/components/games/reversi/reversi.game.vue b/src/client/app/common/views/components/games/reversi/reversi.game.vue
index dd2c94a603..0c183b343e 100644
--- a/src/client/app/common/views/components/games/reversi/reversi.game.vue
+++ b/src/client/app/common/views/components/games/reversi/reversi.game.vue
@@ -1,6 +1,6 @@
 <template>
 <div class="root">
-	<header><b>{{ blackUser.name }}</b>(黒) vs <b>{{ whiteUser.name }}</b>(白)</header>
+	<header><b>{{ blackUser.name }}</b>(%i18n:common.reversi.black%) vs <b>{{ whiteUser.name }}</b>(%i18n:common.reversi.white%)</header>
 
 	<div style="overflow: hidden">
 		<p class="turn" v-if="!iAmPlayer && !game.isEnded">{{ '%i18n:common.reversi.turn-of%'.replace('{}', turnUser.name) }}<mk-ellipsis/></p>
@@ -39,7 +39,7 @@
 		</div>
 	</div>
 
-	<p class="status"><b>{{ logPos }}ターン目</b> 黒:{{ o.blackCount }} 白:{{ o.whiteCount }} 合計:{{ o.blackCount + o.whiteCount }}</p>
+	<p class="status"><b>{{ '%i18n:common.reversi.this-turn%'.split('{}')[0] }}{{ logPos }}{{ '%i18n:common.reversi.this-turn%'.split('{}')[1] }}</b> %i18n:common.reversi.black%:{{ o.blackCount }} %i18n:common.reversi.white%:{{ o.whiteCount }} %i18n:common.reversi.total%:{{ o.blackCount + o.whiteCount }}</p>
 
 	<div class="player" v-if="game.isEnded">
 		<el-button-group>
diff --git a/src/client/app/common/views/components/games/reversi/reversi.room.vue b/src/client/app/common/views/components/games/reversi/reversi.room.vue
index 841f6b366a..7aec4069c5 100644
--- a/src/client/app/common/views/components/games/reversi/reversi.room.vue
+++ b/src/client/app/common/views/components/games/reversi/reversi.room.vue
@@ -3,12 +3,12 @@
 	<header><b>{{ game.user1.name }}</b> vs <b>{{ game.user2.name }}</b></header>
 
 	<div>
-		<p>ゲームの設定</p>
+		<p>%i18n:@settings-of-the-game%</p>
 
 		<el-card class="map">
 			<div slot="header">
-				<el-select :class="$style.mapSelect" v-model="mapName" placeholder="マップを選択" @change="onMapChange">
-					<el-option label="ランダム" :value="null"/>
+				<el-select :class="$style.mapSelect" v-model="mapName" placeholder="%i18n:@choose-map%" @change="onMapChange">
+					<el-option label="%i18n:@random%" :value="null"/>
 					<el-option-group v-for="c in mapCategories" :key="c" :label="c">
 						<el-option v-for="m in maps" v-if="m.category == c" :key="m.name" :label="m.name" :value="m.name">
 							<span style="float: left">{{ m.name }}</span>
@@ -30,25 +30,25 @@
 
 		<el-card class="bw">
 			<div slot="header">
-				<span>先手/後手</span>
+				<span>%i18n:@black-or-white%</span>
 			</div>
-			<el-radio v-model="game.settings.bw" label="random" @change="updateSettings">ランダム</el-radio>
-			<el-radio v-model="game.settings.bw" :label="1" @change="updateSettings">{{ game.user1.name }}が黒</el-radio>
-			<el-radio v-model="game.settings.bw" :label="2" @change="updateSettings">{{ game.user2.name }}が黒</el-radio>
+			<el-radio v-model="game.settings.bw" label="random" @change="updateSettings">%i18n:@random%</el-radio>
+			<el-radio v-model="game.settings.bw" :label="1" @change="updateSettings">{{ '%i18n:@black-is%'.split('{}')[0] }}{{ game.user1.name }}{{ '%i18n:@black-is%'.split('{}')[1] }}</el-radio>
+			<el-radio v-model="game.settings.bw" :label="2" @change="updateSettings">{{ '%i18n:@black-is%'.split('{}')[0] }}{{ game.user2.name }}{{ '%i18n:@black-is%'.split('{}')[1] }}</el-radio>
 		</el-card>
 
 		<el-card class="rules">
 			<div slot="header">
-				<span>ルール</span>
+				<span>%i18n:@rules%</span>
 			</div>
-			<mk-switch v-model="game.settings.isLlotheo" @change="updateSettings" text="石の少ない方が勝ち(ロセオ)"/>
-			<mk-switch v-model="game.settings.loopedBoard" @change="updateSettings" text="ループマップ"/>
-			<mk-switch v-model="game.settings.canPutEverywhere" @change="updateSettings" text="どこでも置けるモード"/>
+			<mk-switch v-model="game.settings.isLlotheo" @change="updateSettings" text="%i18n:@is-llotheo%"/>
+			<mk-switch v-model="game.settings.loopedBoard" @change="updateSettings" text="%i18n:@looped-map%"/>
+			<mk-switch v-model="game.settings.canPutEverywhere" @change="updateSettings" text="%i18n:@can-put-everywhere%"/>
 		</el-card>
 
 		<el-card class="bot-form" v-if="form">
 			<div slot="header">
-				<span>Botの設定</span>
+				<span>%i18n:@settings-of-the-bot%</span>
 			</div>
 			<el-alert v-for="message in messages"
 				:title="message.text"
@@ -77,16 +77,16 @@
 
 	<footer>
 		<p class="status">
-			<template v-if="isAccepted && isOpAccepted">ゲームは数秒後に開始されます<mk-ellipsis/></template>
-			<template v-if="isAccepted && !isOpAccepted">相手の準備が完了するのを待っています<mk-ellipsis/></template>
-			<template v-if="!isAccepted && isOpAccepted">あなたの準備が完了するのを待っています</template>
-			<template v-if="!isAccepted && !isOpAccepted">準備中<mk-ellipsis/></template>
+			<template v-if="isAccepted && isOpAccepted">%i18n:@this-gane-is-started-soon%<mk-ellipsis/></template>
+			<template v-if="isAccepted && !isOpAccepted">%i18n:@waiting-for-other%<mk-ellipsis/></template>
+			<template v-if="!isAccepted && isOpAccepted">%i18n:@waiting-for-me%</template>
+			<template v-if="!isAccepted && !isOpAccepted">%i18n:@waiting-for-both%<mk-ellipsis/></template>
 		</p>
 
 		<div class="actions">
-			<el-button @click="exit">キャンセル</el-button>
-			<el-button type="primary" @click="accept" v-if="!isAccepted">準備完了</el-button>
-			<el-button type="primary" @click="cancel" v-if="isAccepted">準備続行</el-button>
+			<el-button @click="exit">%i18n:@cancel%</el-button>
+			<el-button type="primary" @click="accept" v-if="!isAccepted">%i18n:@ready%</el-button>
+			<el-button type="primary" @click="cancel" v-if="isAccepted">%i18n:@cancel-ready%</el-button>
 		</div>
 	</footer>
 </div>
diff --git a/src/client/app/common/views/components/games/reversi/reversi.vue b/src/client/app/common/views/components/games/reversi/reversi.vue
index 3d28b6bdd6..2ec275e818 100644
--- a/src/client/app/common/views/components/games/reversi/reversi.vue
+++ b/src/client/app/common/views/components/games/reversi/reversi.vue
@@ -4,32 +4,30 @@
 		<x-gameroom :game="game"/>
 	</div>
 	<div class="matching" v-else-if="matching">
-		<h1><b>{{ matching.name }}</b>を待っています<mk-ellipsis/></h1>
+		<h1>{{ '%i18n:@matching.waiting-for%'.split('{}')[0] }}<b>{{ matching.name }}</b>{{ '%i18n:@matching.waiting-for%'.split('{}')[1] }}<mk-ellipsis/></h1>
 		<div class="cancel">
-			<el-button round @click="cancel">キャンセル</el-button>
+			<el-button round @click="cancel">%i18n:@matching.cancel%</el-button>
 		</div>
 	</div>
 	<div class="index" v-else>
-		<h1>Misskey Reversi</h1>
-		<p>他のMisskeyユーザーとリバーシで対戦しよう</p>
+		<h1>%i18n:@title%</h1>
+		<p>%i18n:@sub-title%</p>
 		<div class="play">
-			<el-button round>フリーマッチ(準備中)</el-button>
-			<el-button type="primary" round @click="match">指名</el-button>
+			<!--<el-button round>フリーマッチ(準備中)</el-button>-->
+			<el-button type="primary" round @click="match">%i18n:@invite%</el-button>
 			<details>
-				<summary>遊び方</summary>
+				<summary>%i18n:@rule%</summary>
 				<div>
-					<p>リバーシは、相手と交互に石をボードに置いてゆき、相手の石を挟んでひっくり返しながら、最終的に残った石が多い方が勝ちというボードゲームです。</p>
+					<p>%i18n:@rule-desc%</p>
 					<dl>
-						<dt><b>フリーマッチ</b></dt>
-						<dd>ランダムなユーザーと対戦するモードです。</dd>
-						<dt><b>指名</b></dt>
-						<dd>指定したユーザーと対戦するモードです。</dd>
+						<dt><b>%i18n:@mode-invite%</b></dt>
+						<dd>%i18n:@mode-invite-desc%</dd>
 					</dl>
 				</div>
 			</details>
 		</div>
 		<section v-if="invitations.length > 0">
-			<h2>対局の招待があります!:</h2>
+			<h2>%i18n:@invitations%</h2>
 			<div class="invitation" v-for="i in invitations" tabindex="-1" @click="accept(i)">
 				<mk-avatar class="avatar" :user="i.parent"/>
 				<span class="name"><b>{{ i.parent.name }}</b></span>
@@ -38,21 +36,21 @@
 			</div>
 		</section>
 		<section v-if="myGames.length > 0">
-			<h2>自分の対局</h2>
+			<h2>%i18n:@my-games%</h2>
 			<a class="game" v-for="g in myGames" tabindex="-1" @click.prevent="go(g)" :href="`/reversi/${g.id}`">
 				<mk-avatar class="avatar" :user="g.user1"/>
 				<mk-avatar class="avatar" :user="g.user2"/>
 				<span><b>{{ g.user1.name }}</b> vs <b>{{ g.user2.name }}</b></span>
-				<span class="state">{{ g.isEnded ? '終了' : '進行中' }}</span>
+				<span class="state">{{ g.isEnded ? '%i18n:@game-state.ended%' : '%i18n:@game-state.playing%' }}</span>
 			</a>
 		</section>
 		<section v-if="games.length > 0">
-			<h2>みんなの対局</h2>
+			<h2>%i18n:@all-games%</h2>
 			<a class="game" v-for="g in games" tabindex="-1" @click.prevent="go(g)" :href="`/reversi/${g.id}`">
 				<mk-avatar class="avatar" :user="g.user1"/>
 				<mk-avatar class="avatar" :user="g.user2"/>
 				<span><b>{{ g.user1.name }}</b> vs <b>{{ g.user2.name }}</b></span>
-				<span class="state">{{ g.isEnded ? '終了' : '進行中' }}</span>
+				<span class="state">{{ g.isEnded ? '%i18n:@game-state.ended%' : '%i18n:@game-state.playing%' }}</span>
 			</a>
 		</section>
 	</div>
@@ -153,7 +151,7 @@ export default Vue.extend({
 
 		match() {
 			(this as any).apis.input({
-				title: 'ユーザー名を入力してください'
+				title: '%i18n:@enter-username%'
 			}).then(username => {
 				(this as any).api('users/show', {
 					username