i18n: automatyczny język + ręczny przełącznik

This commit is contained in:
2026-02-08 16:28:30 +01:00
parent 2d4d03f5d3
commit 40a6725bf1
11 changed files with 253 additions and 42 deletions

View File

@@ -1,6 +1,7 @@
<script setup>
import { onMounted, ref } from 'vue';
import { usePuzzleStore } from './stores/puzzle';
import { useI18n } from './composables/useI18n';
import GameBoard from './components/GameBoard.vue';
import LevelSelector from './components/LevelSelector.vue';
import StatusPanel from './components/StatusPanel.vue';
@@ -12,6 +13,7 @@ import FixedBar from './components/FixedBar.vue';
// Main App Entry
const store = usePuzzleStore();
const { t, locale, setLocale } = useI18n();
const showCustomModal = ref(false);
const showGuide = ref(false);
@@ -27,7 +29,11 @@ onMounted(() => {
<FixedBar />
<header class="game-header">
<h1>NONOGRAMS</h1>
<h1>{{ t('app.title') }}</h1>
<div class="lang-toggle">
<button class="lang-btn" :class="{ active: locale === 'pl' }" @click="setLocale('pl')">PL</button>
<button class="lang-btn" :class="{ active: locale === 'en' }" @click="setLocale('en')">EN</button>
</div>
<div class="underline"></div>
</header>
@@ -96,6 +102,38 @@ h1 {
box-shadow: 0 0 10px var(--primary-accent);
}
.lang-toggle {
display: inline-flex;
gap: 8px;
margin-top: 12px;
padding: 6px 10px;
border-radius: 999px;
background: rgba(255, 255, 255, 0.08);
border: 1px solid rgba(255, 255, 255, 0.2);
box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
}
.lang-btn {
background: transparent;
border: 1px solid rgba(255, 255, 255, 0.2);
color: #fff;
padding: 4px 10px;
border-radius: 999px;
font-size: 0.8rem;
letter-spacing: 1px;
cursor: pointer;
transition: all 0.2s ease;
}
.lang-btn.active {
border-color: var(--primary-accent);
box-shadow: 0 0 10px rgba(0, 242, 255, 0.3);
}
.lang-btn:hover {
border-color: #fff;
}
.game-layout {
display: flex;
flex-direction: column;