11<script setup lang="ts">
22import type { NuxtError } from ' #app'
3- import type { PageCollections } from ' @nuxt/content'
3+ import type { ContentNavigationItem , PageCollections } from ' @nuxt/content'
44import * as nuxtUiLocales from ' @nuxt/ui/locale'
55
66const props = defineProps <{
@@ -9,8 +9,10 @@ const props = defineProps<{
99
1010const { locale, locales, isEnabled, t, switchLocalePath } = useDocusI18n ()
1111
12- const lang = computed (() => nuxtUiLocales [locale .value as keyof typeof nuxtUiLocales ]?.code || ' en' )
13- const dir = computed (() => nuxtUiLocales [locale .value as keyof typeof nuxtUiLocales ]?.dir || ' ltr' )
12+ const nuxtUiLocale = computed (() => nuxtUiLocales [locale .value as keyof typeof nuxtUiLocales ] || nuxtUiLocales .en )
13+ const lang = computed (() => nuxtUiLocale .value .code )
14+ const dir = computed (() => nuxtUiLocale .value .dir )
15+
1416useHead ({
1517 htmlAttrs: {
1618 lang ,
@@ -22,6 +24,7 @@ const localizedError = computed(() => {
2224 return {
2325 ... props .error ,
2426 statusMessage: t (' common.error.title' ),
27+ message: t (' common.error.description' ),
2528 }
2629})
2730
@@ -44,7 +47,7 @@ if (isEnabled.value) {
4447const collectionName = computed (() => isEnabled .value ? ` docs_${locale .value } ` : ' docs' )
4548
4649const { data : navigation } = await useAsyncData (` navigation_${collectionName .value } ` , () => queryCollectionNavigation (collectionName .value as keyof PageCollections ), {
47- transform : (data ) => {
50+ transform : (data : ContentNavigationItem [] ) => {
4851 const rootResult = data .find (item => item .path === ' /docs' )?.children || data || []
4952
5053 return rootResult .find (item => item .path === ` /${locale .value } ` )?.children || rootResult
@@ -59,7 +62,7 @@ provide('navigation', navigation)
5962 </script >
6063
6164<template >
62- <UApp >
65+ <UApp :locale = " nuxtUiLocale " >
6366 <AppHeader />
6467
6568 <UError :error =" localizedError" />
0 commit comments