We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d168778 commit 817b4a9Copy full SHA for 817b4a9
1 file changed
app/app.vue
@@ -1,15 +1,29 @@
1
<script setup lang="ts">
2
+import type { Directions } from '@nuxtjs/i18n'
3
import { useEventListener } from '@vueuse/core'
4
5
const route = useRoute()
6
const router = useRouter()
7
+const { locale, locales } = useI18n()
8
9
// Initialize accent color before hydration to prevent flash
10
initAccentOnPrehydrate()
11
12
const isHomepage = computed(() => route.name === 'index')
13
14
+const localeMap = locales.value.reduce(
15
+ (acc, l) => {
16
+ acc[l.code] = l.dir ?? 'ltr'
17
+ return acc
18
+ },
19
+ {} as Record<string, Directions>,
20
+)
21
+
22
useHead({
23
+ htmlAttrs: {
24
+ lang: () => locale.value,
25
+ dir: () => localeMap[locale.value] ?? 'ltr',
26
27
titleTemplate: titleChunk => {
28
return titleChunk ? titleChunk : 'npmx - Better npm Package Browser'
29
},
0 commit comments