mirror of
https://github.com/grey-cat-1908/metro.git
synced 2024-09-22 19:22:00 +03:00
fixed lang
This commit is contained in:
parent
e409934407
commit
5e06fdb122
3 changed files with 14 additions and 4 deletions
13
src/App.vue
13
src/App.vue
|
@ -33,7 +33,12 @@ let settings: Settings = new Settings(store.width, store.height);
|
|||
|
||||
let map: Map;
|
||||
|
||||
import { useI18n } from "vue-i18n";
|
||||
const t = useI18n();
|
||||
|
||||
onMounted(() => {
|
||||
t.locale.value = localStorage.getItem('locale') || 'en';
|
||||
|
||||
store.stations = [
|
||||
{'name': 'Начало', 'up': true, 'connectedStations': [], 'step': 0},
|
||||
{'name': 'Конец', 'up': true, 'connectedStations': [], 'step': store.width - 400}
|
||||
|
@ -46,6 +51,10 @@ onMounted(() => {
|
|||
build();
|
||||
})
|
||||
|
||||
function setStorage(val) {
|
||||
localStorage.setItem('locale', val);
|
||||
}
|
||||
|
||||
function exportFile() {
|
||||
build();
|
||||
|
||||
|
@ -168,8 +177,8 @@ store.$subscribe((mutation, state) => {
|
|||
<hr>
|
||||
<br>
|
||||
<h2>{{ $t("app.cursor") }}: ({{ xcord }}; {{ ycord }}) | <a class="text-right" style="text-decoration: none" href="https://arbuz.icu/blog/metro-line/">{{ $t("app.about") }}</a> |
|
||||
<a v-if="$i18n.locale == 'ru'" @click="$i18n.locale = 'en'; window.localStorage.setItem('locale', 'en');" style="color: red; cursor: pointer;">English</a>
|
||||
<a v-else @click="$i18n.locale = 'ru'; window.localStorage.setItem('locale', 'ru');" style="color: red; cursor: pointer;">Русский</a>
|
||||
<a v-if="$i18n.locale == 'ru'" @click="$i18n.locale = 'en'; setStorage('en');" style="color: red; cursor: pointer;">English</a>
|
||||
<a v-else @click="$i18n.locale = 'ru'; setStorage('ru')" style="color: red; cursor: pointer;">Русский</a>
|
||||
</h2>
|
||||
</div>
|
||||
</v-col>
|
||||
|
|
|
@ -20,6 +20,6 @@ const pinia = createPinia()
|
|||
const vuetify = createVuetify({
|
||||
components,
|
||||
directives
|
||||
})
|
||||
});
|
||||
|
||||
createApp(App).use(vuetify).use(pinia).use(i18n).mount('#app')
|
|
@ -107,7 +107,8 @@ const messages = {
|
|||
|
||||
// 2. Create i18n instance with options
|
||||
export const i18n = createI18n({
|
||||
locale: window.localStorage.getItem("locale") | 'ru',
|
||||
legacy: false,
|
||||
locale: 'ru',
|
||||
fallbackLocale: 'ru',
|
||||
messages
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue