Skip to content

Commit

Permalink
update: playground
Browse files Browse the repository at this point in the history
  • Loading branch information
s00d committed Aug 19, 2024
1 parent ff9f58f commit b73f3ec
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
8 changes: 8 additions & 0 deletions playground/pages/page.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<template>
<div>
<p>{{ $t('key1.key1.key1.key1.key1') }}</p>
<i18n-t
keypath="key1.key1.key1.key1.key1"
tag="h1"
>
<template #default="{ translation }">
<strong>{{ translation.replace('page', 'page replace') }}</strong> <i>!!!</i>
</template>
</i18n-t>
<p>Current Locale: {{ $getLocale() }}</p>

<div>
Expand Down
13 changes: 12 additions & 1 deletion playground/pages/subpage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<p>{{ $t('key2.key2.key2.key2.key2') }}</p>
<p>Current Locale: {{ $getLocale() }}</p>

<div>page translate: {{ $t('greeting') }}</div>

<hr>
<!-- Welcome and general information -->
<div>
{{ $t('welcome', { username: 'Alice', unreadCount: 5 }) }}
Expand Down Expand Up @@ -147,5 +150,13 @@
<script setup>
import { useNuxtApp } from '#imports'
const { $getLocale, $switchLocale, $getLocales, $localeRoute, $t, $tc } = useNuxtApp()
const { $getLocale, $switchLocale, $getLocales, $localeRoute, $t, $tc, $defineI18nRoute } = useNuxtApp()
$defineI18nRoute({
locales: {
en: { greeting: 'Hello', farewell: 'Goodbye' },
ru: { greeting: 'Привет', farewell: 'До свидания' },
de: { greeting: 'Hallo', farewell: 'Auf Wiedersehen' },
},
})
</script>

0 comments on commit b73f3ec

Please sign in to comment.