言語切り替え
This commit is contained in:
parent
2f18f82e3d
commit
fbc801d1da
@ -1,20 +1,4 @@
|
|||||||
_ago:
|
_lang_: "日本語"
|
||||||
unknown: "謎"
|
|
||||||
future: "未来"
|
|
||||||
justNow: "たった今"
|
|
||||||
secondsAgo: "{n}秒前"
|
|
||||||
minutesAgo: "{n}分前"
|
|
||||||
hoursAgo: "{n}時間前"
|
|
||||||
daysAgo: "{n}日前"
|
|
||||||
weeksAgo: "{n}週間前"
|
|
||||||
monthsAgo: "{n}ヶ月前"
|
|
||||||
yearsAgo: "{n}年前"
|
|
||||||
|
|
||||||
_time:
|
|
||||||
second: "秒"
|
|
||||||
minute: "分"
|
|
||||||
hour: "時間"
|
|
||||||
day: "日"
|
|
||||||
|
|
||||||
introMisskey: "ようこそ!Misskeyは、オープンソースの分散型マイクロブログサービスです。\n「ノート」を作成して、いま起こっていることを共有したり、あなたについて皆に発信しよう📡\n「リアクション」機能で、皆のノートに素早く反応を追加することもできます👍\n新しい世界を探検しよう🚀"
|
introMisskey: "ようこそ!Misskeyは、オープンソースの分散型マイクロブログサービスです。\n「ノート」を作成して、いま起こっていることを共有したり、あなたについて皆に発信しよう📡\n「リアクション」機能で、皆のノートに素早く反応を追加することもできます👍\n新しい世界を探検しよう🚀"
|
||||||
monthAndDay: "{month}月 {day}日"
|
monthAndDay: "{month}月 {day}日"
|
||||||
@ -400,6 +384,25 @@ passwordNotMatched: "一致していません"
|
|||||||
signinWith: "{x}でログイン"
|
signinWith: "{x}でログイン"
|
||||||
tapSecurityKey: "セキュリティーキーにタッチ"
|
tapSecurityKey: "セキュリティーキーにタッチ"
|
||||||
or: "もしくは"
|
or: "もしくは"
|
||||||
|
uiLanguage: "UIの表示言語"
|
||||||
|
|
||||||
|
_ago:
|
||||||
|
unknown: "謎"
|
||||||
|
future: "未来"
|
||||||
|
justNow: "たった今"
|
||||||
|
secondsAgo: "{n}秒前"
|
||||||
|
minutesAgo: "{n}分前"
|
||||||
|
hoursAgo: "{n}時間前"
|
||||||
|
daysAgo: "{n}日前"
|
||||||
|
weeksAgo: "{n}週間前"
|
||||||
|
monthsAgo: "{n}ヶ月前"
|
||||||
|
yearsAgo: "{n}年前"
|
||||||
|
|
||||||
|
_time:
|
||||||
|
second: "秒"
|
||||||
|
minute: "分"
|
||||||
|
hour: "時間"
|
||||||
|
day: "日"
|
||||||
|
|
||||||
_tutorial:
|
_tutorial:
|
||||||
title: "Misskeyの使い方"
|
title: "Misskeyの使い方"
|
||||||
|
@ -61,20 +61,22 @@ if (localStorage.getItem('theme') == null) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//#region Detect the user language
|
//#region Detect the user language
|
||||||
let lang = null;
|
let lang = localStorage.getItem('lang');
|
||||||
|
|
||||||
if (langs.map(x => x[0]).includes(navigator.language)) {
|
if (lang == null) {
|
||||||
lang = navigator.language;
|
if (langs.map(x => x[0]).includes(navigator.language)) {
|
||||||
} else {
|
lang = navigator.language;
|
||||||
lang = langs.map(x => x[0]).find(x => x.split('-')[0] == navigator.language);
|
} else {
|
||||||
|
lang = langs.map(x => x[0]).find(x => x.split('-')[0] == navigator.language);
|
||||||
|
|
||||||
if (lang == null) {
|
if (lang == null) {
|
||||||
// Fallback
|
// Fallback
|
||||||
lang = 'en-US';
|
lang = 'en-US';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
localStorage.setItem('lang', lang);
|
localStorage.setItem('lang', lang);
|
||||||
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
// Detect the user agent
|
// Detect the user agent
|
||||||
|
@ -27,6 +27,13 @@
|
|||||||
{{ $t('reduceUiAnimation') }}
|
{{ $t('reduceUiAnimation') }}
|
||||||
</mk-switch>
|
</mk-switch>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="_content">
|
||||||
|
<mk-select v-model="lang">
|
||||||
|
<template #label>{{ $t('uiLanguage') }}</template>
|
||||||
|
|
||||||
|
<option v-for="x in langs" :value="x[0]" :key="x[0]">{{ x[1] }}</option>
|
||||||
|
</mk-select>
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -36,8 +43,9 @@ import { faImage, faCog } from '@fortawesome/free-solid-svg-icons';
|
|||||||
import MkInput from '../../components/ui/input.vue';
|
import MkInput from '../../components/ui/input.vue';
|
||||||
import MkButton from '../../components/ui/button.vue';
|
import MkButton from '../../components/ui/button.vue';
|
||||||
import MkSwitch from '../../components/ui/switch.vue';
|
import MkSwitch from '../../components/ui/switch.vue';
|
||||||
|
import MkSelect from '../../components/ui/select.vue';
|
||||||
import i18n from '../../i18n';
|
import i18n from '../../i18n';
|
||||||
import { apiUrl } from '../../config';
|
import { apiUrl, langs } from '../../config';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
i18n,
|
i18n,
|
||||||
@ -46,10 +54,13 @@ export default Vue.extend({
|
|||||||
MkInput,
|
MkInput,
|
||||||
MkButton,
|
MkButton,
|
||||||
MkSwitch,
|
MkSwitch,
|
||||||
|
MkSelect,
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
langs,
|
||||||
|
lang: localStorage.getItem('lang'),
|
||||||
wallpaperUploading: false,
|
wallpaperUploading: false,
|
||||||
faImage, faCog
|
faImage, faCog
|
||||||
}
|
}
|
||||||
@ -72,6 +83,14 @@ export default Vue.extend({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
lang() {
|
||||||
|
localStorage.setItem('lang', this.lang);
|
||||||
|
localStorage.removeItem('locale');
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
onWallpaperChange([file]) {
|
onWallpaperChange([file]) {
|
||||||
this.wallpaperUploading = true;
|
this.wallpaperUploading = true;
|
||||||
|
@ -124,7 +124,7 @@ module.exports = {
|
|||||||
}),
|
}),
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
_VERSION_: JSON.stringify(meta.version),
|
_VERSION_: JSON.stringify(meta.version),
|
||||||
_LANGS_: JSON.stringify(Object.entries(locales).map(([k, v]: [string, any]) => [k, v && v.meta && v.meta.lang])),
|
_LANGS_: JSON.stringify(Object.entries(locales).map(([k, v]: [string, any]) => [k, v._lang_])),
|
||||||
_ENV_: JSON.stringify(process.env.NODE_ENV)
|
_ENV_: JSON.stringify(process.env.NODE_ENV)
|
||||||
}),
|
}),
|
||||||
new VueLoaderPlugin(),
|
new VueLoaderPlugin(),
|
||||||
|
Loading…
Reference in New Issue
Block a user