From f3479d1b989af5ca93ad0c1a794cf9c5b97f8c4f Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 3 Dec 2018 09:38:43 +0900 Subject: [PATCH] Refactor --- locales/ja-JP.yml | 20 +++---- .../views/components/language-settings.vue | 54 +++++++++++++++++++ .../app/desktop/views/components/settings.vue | 36 ++----------- .../app/mobile/views/pages/settings.vue | 38 ++----------- 4 files changed, 70 insertions(+), 78 deletions(-) create mode 100644 src/client/app/common/views/components/language-settings.vue diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 248437533..d6a0521fe 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -485,6 +485,14 @@ common/views/components/trends.vue: count: "{}人が投稿" empty: "トレンドなし" +common/views/components/language-settings.vue: + title: "表示言語" + pick-language: "言語を選択" + recommended: "推奨" + auto: "自動" + specify-language: "言語を指定" + info: "変更はページの再度読み込み後に反映されます。" + common/views/components/profile-editor.vue: title: "プロフィール" name: "名前" @@ -870,13 +878,6 @@ desktop/views/components/settings.vue: volume: "ボリューム" test: "テスト" - language: "言語" - pick-language: "言語を選択" - recommended: "推奨" - auto: "自動" - specify-language: "言語を指定" - language-desc: "変更はページの再度読み込み後に反映されます。" - cache: "キャッシュ" clean-cache: "クリーンアップ" cache-warn: "クリーンアップを行うと、ブラウザに記憶されたアカウント情報のキャッシュ、書きかけの投稿・返信・メッセージ、およびその他のデータ(設定情報含む)が削除されます。クリーンアップを行った後はページを再度読み込みする必要があります。" @@ -1554,11 +1555,6 @@ mobile/views/pages/selectdrive.vue: mobile/views/pages/settings.vue: signed-in-as: "{}としてサインイン中" - lang: "言語" - lang-tip: "変更はページの再読み込み後に反映されます。" - recommended: "推奨" - auto: "自動" - specify-language: "言語を指定" design: "デザインと表示" dark-mode: "ダークモード" i-am-under-limited-internet: "私は通信を制限されている" diff --git a/src/client/app/common/views/components/language-settings.vue b/src/client/app/common/views/components/language-settings.vue new file mode 100644 index 000000000..aa3f29051 --- /dev/null +++ b/src/client/app/common/views/components/language-settings.vue @@ -0,0 +1,54 @@ + + + diff --git a/src/client/app/desktop/views/components/settings.vue b/src/client/app/desktop/views/components/settings.vue index 39145bdb0..a89982eea 100644 --- a/src/client/app/desktop/views/components/settings.vue +++ b/src/client/app/desktop/views/components/settings.vue @@ -169,24 +169,7 @@ - -
{{ $t('language') }}
-
- - - - - - - - - -
-
Current: {{ this.currentLanguage }}
-

{{ $t('language-desc') }}

-
-
-
+
{{ $t('cache') }}
@@ -318,8 +301,9 @@ import XMuteAndBlock from '../../../common/views/components/mute-and-block.vue'; import XPasswordSettings from '../../../common/views/components/password-settings.vue'; import XProfileEditor from '../../../common/views/components/profile-editor.vue'; import XApiSettings from '../../../common/views/components/api-settings.vue'; +import XLanguageSettings from '../../../common/views/components/language-settings.vue'; -import { url, langs, clientVersion as version } from '../../../config'; +import { url, clientVersion as version } from '../../../config'; import checkForUpdate from '../../../common/scripts/check-for-update'; export default Vue.extend({ @@ -338,6 +322,7 @@ export default Vue.extend({ XPasswordSettings, XProfileEditor, XApiSettings, + XLanguageSettings, }, props: { initialPage: { @@ -350,8 +335,6 @@ export default Vue.extend({ page: this.initialPage || 'profile', meta: null, version, - langs, - currentLanguage: 'Unknown', latestVersion: undefined, checkingForUpdate: false }; @@ -412,11 +395,6 @@ export default Vue.extend({ set(value) { this.$store.commit('device/set', { key: 'soundVolume', value }); } }, - lang: { - get() { return this.$store.state.device.lang; }, - set(value) { this.$store.commit('device/set', { key: 'lang', value }); } - }, - preventUpdate: { get() { return this.$store.state.device.preventUpdate; }, set(value) { this.$store.commit('device/set', { key: 'preventUpdate', value }); } @@ -556,12 +534,6 @@ export default Vue.extend({ this.$root.getMeta().then(meta => { this.meta = meta; }); - - try { - const locale = JSON.parse(localStorage.getItem('locale') || "{}"); - const localeKey = localStorage.getItem('localeKey'); - this.currentLanguage = `${locale.meta.lang} (${localeKey})`; - } catch { } }, methods: { readAllUnreadNotes() { diff --git a/src/client/app/mobile/views/pages/settings.vue b/src/client/app/mobile/views/pages/settings.vue index ff4475242..de881af3b 100644 --- a/src/client/app/mobile/views/pages/settings.vue +++ b/src/client/app/mobile/views/pages/settings.vue @@ -105,23 +105,7 @@
- -
{{ $t('lang') }}
- -
- - - - - - - - - -
Current: {{ this.currentLanguage }}
-

{{ $t('lang-tip') }}

-
-
+
{{ $t('twitter') }}
@@ -199,7 +183,7 @@