diff --git a/packages/playground/locales/README.md b/packages/playground/locales/README.md deleted file mode 100644 index 4b24ec29..00000000 --- a/packages/playground/locales/README.md +++ /dev/null @@ -1,7 +0,0 @@ -## i18n - -This directory is to serve your locale translation files. YAML under this folder would be loaded automatically and register with their filenames as locale code. - -Check out [`vue-i18n`](https://github.com/intlify/vue-i18n-next) for more details. - -If you are using VS Code, [`i18n Ally`](https://github.com/lokalise/i18n-ally) is recommended to make the i18n experience better. diff --git a/packages/playground/locales/ar.yml b/packages/playground/locales/ar.yml deleted file mode 100644 index 9c1bbb61..00000000 --- a/packages/playground/locales/ar.yml +++ /dev/null @@ -1,14 +0,0 @@ -button: - about: حول - back: رجوع - go: تجربة - home: الرئيسية - toggle_dark: التغيير إلى الوضع المظلم - toggle_langs: تغيير اللغة -intro: - desc: vite مثال لتطبيق - dynamic-route: عرض لتوجيهات ديناميكية - hi: مرحبا {name} - aka: معروف أيضا تحت مسمى - whats-your-name: ما إسمك؟ -not-found: صفحة غير موجودة diff --git a/packages/playground/locales/de.yml b/packages/playground/locales/de.yml deleted file mode 100644 index 621f6cb5..00000000 --- a/packages/playground/locales/de.yml +++ /dev/null @@ -1,14 +0,0 @@ -button: - about: Über - back: Zurück - go: Los - home: Startseite - toggle_dark: Dunkelmodus umschalten - toggle_langs: Sprachen ändern -intro: - desc: Vite Startvorlage mit Vorlieben - dynamic-route: Demo einer dynamischen Route - hi: Hi, {name}! - aka: Auch bekannt als - whats-your-name: Wie heißt du? -not-found: Nicht gefunden diff --git a/packages/playground/locales/id.yml b/packages/playground/locales/id.yml deleted file mode 100644 index 738573f2..00000000 --- a/packages/playground/locales/id.yml +++ /dev/null @@ -1,14 +0,0 @@ -button: - about: Tentang - back: Kembali - go: Pergi - home: Beranda - toggle_dark: Ubah ke mode gelap - toggle_langs: Ubah bahasa -intro: - desc: Template awal vite - dynamic-route: Contoh rute dinamik - hi: Halo, {name}! - aka: Juga diketahui sebagai - whats-your-name: Siapa nama anda? -not-found: Tidak ditemukan diff --git a/packages/playground/locales/it.yml b/packages/playground/locales/it.yml deleted file mode 100644 index fa0d9889..00000000 --- a/packages/playground/locales/it.yml +++ /dev/null @@ -1,13 +0,0 @@ -button: - about: Su di me - back: Indietro - go: Vai - home: Home - toggle_dark: Attiva/disattiva modalità scura - toggle_langs: Cambia lingua -intro: - desc: Modello per una Applicazione Vite - dynamic-route: Demo di rotta dinamica - hi: Ciao, {name}! - whats-your-name: Come ti chiami? -not-found: Non trovato diff --git a/packages/playground/locales/ka.yml b/packages/playground/locales/ka.yml deleted file mode 100644 index 47e273b0..00000000 --- a/packages/playground/locales/ka.yml +++ /dev/null @@ -1,14 +0,0 @@ -button: - about: შესახებ - back: უკან - go: დაწყება - home: მთავარი - toggle_dark: გადართე მუქი რეჟიმი - toggle_langs: ენის შეცვლა -intro: - desc: Opinionated Vite Starter Template - dynamic-route: დინამიური როუტინგის დემო - hi: გამარჯობა, {name}! - aka: ასევე ცნობილი როგორც - whats-your-name: რა გქვია? -not-found: ვერ მოიძებნა diff --git a/packages/playground/locales/ko.yml b/packages/playground/locales/ko.yml deleted file mode 100644 index 780f88ec..00000000 --- a/packages/playground/locales/ko.yml +++ /dev/null @@ -1,13 +0,0 @@ -button: - about: 소개 - back: 뒤로가기 - go: 이동 - home: 홈 - toggle_dark: 다크모드 토글 - toggle_langs: 언어 변경 -intro: - desc: Vite 애플리케이션 템플릿 - dynamic-route: 다이나믹 라우트 데모 - hi: 안녕, {name}! - whats-your-name: 이름이 뭐예요? -not-found: 찾을 수 없습니다 diff --git a/packages/playground/locales/pl.yml b/packages/playground/locales/pl.yml deleted file mode 100644 index 7929c340..00000000 --- a/packages/playground/locales/pl.yml +++ /dev/null @@ -1,14 +0,0 @@ -button: - about: O nas - back: Wróć - go: WEJDŹ - home: Strona główna - toggle_dark: Ustaw tryb nocny - toggle_langs: Zmień język -intro: - desc: Opiniowany szablon startowy Vite - dynamic-route: Demonstracja dynamicznego route - hi: Cześć, {name}! - aka: Znany też jako - whats-your-name: Jak masz na imię? -not-found: Nie znaleziono diff --git a/packages/playground/locales/pt-BR.yml b/packages/playground/locales/pt-BR.yml deleted file mode 100644 index bd99e3bf..00000000 --- a/packages/playground/locales/pt-BR.yml +++ /dev/null @@ -1,14 +0,0 @@ -button: - about: Sobre - back: Voltar - go: Ir - home: Início - toggle_dark: Alternar modo escuro - toggle_langs: Mudar de idioma -intro: - desc: Modelo Opinativo de Partida de Vite - dynamic-route: Demonstração de rota dinâmica - hi: Olá, {name}! - aka: Também conhecido como - whats-your-name: Qual é o seu nome? -not-found: Não encontrado diff --git a/packages/playground/locales/ru.yml b/packages/playground/locales/ru.yml deleted file mode 100644 index 32398f1d..00000000 --- a/packages/playground/locales/ru.yml +++ /dev/null @@ -1,13 +0,0 @@ -button: - about: О шаблоне - back: Назад - go: Перейти - home: Главная - toggle_dark: Включить темный режим - toggle_langs: Сменить язык -intro: - desc: Самостоятельный начальный шаблон Vite - dynamic-route: Демо динамического маршрута - hi: Привет, {name}! - whats-your-name: Как тебя зовут? -not-found: Не найден diff --git a/packages/playground/locales/tr.yml b/packages/playground/locales/tr.yml deleted file mode 100644 index b969b2c4..00000000 --- a/packages/playground/locales/tr.yml +++ /dev/null @@ -1,14 +0,0 @@ -button: - about: Hakkımda - back: Geri - go: İLERİ - home: Anasayfa - toggle_dark: Karanlık modu değiştir - toggle_langs: Dilleri değiştir -intro: - desc: Görüşlü Vite Başlangıç Şablonu - dynamic-route: Dinamik rota demosu - hi: Merhaba, {name}! - aka: Ayrıca şöyle bilinir - whats-your-name: Adınız nedir? -not-found: Bulunamadı diff --git a/packages/playground/locales/uk.yml b/packages/playground/locales/uk.yml deleted file mode 100644 index 280eecaf..00000000 --- a/packages/playground/locales/uk.yml +++ /dev/null @@ -1,13 +0,0 @@ -button: - about: Про шаблон - back: Назад - go: Перейти - home: Головна - toggle_dark: Переключити темний режим - toggle_langs: Змінити мову -intro: - desc: Самостійний початковий шаблон Vite - dynamic-route: Демо динамічного маршруту - hi: Привіт, {name}! - whats-your-name: Як тебе звати? -not-found: Не знайдено diff --git a/packages/playground/locales/uz.yml b/packages/playground/locales/uz.yml deleted file mode 100644 index 53e0044b..00000000 --- a/packages/playground/locales/uz.yml +++ /dev/null @@ -1,14 +0,0 @@ -button: - about: Haqida - back: Orqaga - go: Kettik - home: Bosh sahifa - toggle_dark: Qorong‘i rejimga o‘tish - toggle_langs: Tilni o‘zgartirish -intro: - desc: O‘ylangan boshlang‘ich Vite shabloni - dynamic-route: Dynamic route demo'si - hi: Assalomu alaykum, {name}! - aka: shuningdek - whats-your-name: Ismingiz nima? -not-found: Topilmadi diff --git a/packages/playground/locales/vi.yml b/packages/playground/locales/vi.yml deleted file mode 100644 index ba2322ed..00000000 --- a/packages/playground/locales/vi.yml +++ /dev/null @@ -1,13 +0,0 @@ -button: - about: Về - back: Quay lại - go: Đi - home: Khởi đầu - toggle_dark: Chuyển đổi chế độ tối - toggle_langs: Thay đổi ngôn ngữ -intro: - desc: Ý kiến cá nhân Vite Template để bắt đầu - dynamic-route: Bản giới thiệu về dynamic route - hi: Hi, {name}! - whats-your-name: Tên bạn là gì? -not-found: Không tìm thấy diff --git a/packages/playground/src/App.preview.vue b/packages/playground/src/App.preview.vue index 5ea1a62a..d964b7ad 100644 --- a/packages/playground/src/App.preview.vue +++ b/packages/playground/src/App.preview.vue @@ -4,10 +4,20 @@ import { useI18n } from 'vue-i18n' import STC from './components/ScrollToComponent.vue' import { useAppStore } from './stores' -const { t } = useI18n() +import { availableLocales, loadLanguageAsync } from './modules/i18n' const age = ref(10) const app = useAppStore() + +const { t, locale } = useI18n() + +async function toggleLocales() { + // change to some real logic + const locales = availableLocales + const newLocale = locales[(locales.indexOf(locale.value) + 1) % locales.length] + await loadLanguageAsync(newLocale) + locale.value = newLocale +}