Skip to content

Commit

Permalink
fix(docs): Downgraded @nuxtjs/i18n.
Browse files Browse the repository at this point in the history
  • Loading branch information
Skyost committed Dec 28, 2024
1 parent f74012a commit 35f8452
Show file tree
Hide file tree
Showing 5 changed files with 182 additions and 213 deletions.
14 changes: 14 additions & 0 deletions docs/app.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
<script setup lang="ts">
if (import.meta.client) {
onMounted(() => {
const i18n = useI18n()
const browserLocale = i18n.getBrowserLocale()
const locales = i18n.locales
const locale = locales.value.find(({ code }) => code === browserLocale)
if (locale) {
i18n.setLocale(locale.code)
}
})
}
</script>

<template>
<nuxt-layout>
<b-modal-orchestrator />
Expand Down
18 changes: 9 additions & 9 deletions docs/layouts/default.vue
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<script setup lang="ts">
const i18nHead = useLocaleHead()
useHead({
htmlAttrs: {
lang: i18nHead.value.htmlAttrs!.lang,
},
link: [...(i18nHead.value.link || [])],
meta: [...(i18nHead.value.meta || [])],
const head = useLocaleHead({
addDirAttribute: true,
identifierAttribute: 'id',
addSeoAttributes: true,
})
</script>

<template>
<div>
<Html
:lang="head.htmlAttrs?.lang"
:dir="head.htmlAttrs?.dir"
>
<page-navbar />
<slot />
<page-footer />
</div>
</Html>
</template>

<style lang="scss">
Expand Down
2 changes: 1 addition & 1 deletion docs/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default defineNuxtConfig({
vueI18n: 'i18n.config.ts',
baseUrl: siteMeta.url,
locales: availableLocales,
langDir: 'locales',
langDir: './i18n/locales',
defaultLocale: 'en',
strategy: 'no_prefix',
compilation: {
Expand Down
Loading

0 comments on commit 35f8452

Please sign in to comment.