@frigear-nu/base 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  const { data: config } = await useConfig()
3
3
  const { data: navigation } = useMenu('main')
4
+ const multiLocale = useRuntimeConfig().public.multiLocale === true
4
5
  </script>
5
6
 
6
7
  <template>
@@ -16,7 +17,7 @@ const { data: navigation } = useMenu('main')
16
17
  <AppHeaderCenter />
17
18
  <template #right>
18
19
  <AppHeaderCTA />
19
- <LanguageSelect v-if="typeof $i18n !== 'undefined' && $i18n.locales && $i18n.locales.value && $i18n.locales.value.length > 1" />
20
+ <LanguageSelect v-if="multiLocale" />
20
21
  <UColorModeButton />
21
22
  <AppHeaderRight />
22
23
  </template>
@@ -2,6 +2,7 @@
2
2
  import type { DropdownMenuItem } from '@nuxt/ui'
3
3
 
4
4
  const { locale, locales } = useI18n()
5
+ const multiLocale = useRuntimeConfig().public.multiLocale === true
5
6
  const route = useRoute()
6
7
  const { localizePath } = useContentLocale()
7
8
 
@@ -41,6 +42,7 @@ const currentLabel = computed(() =>
41
42
 
42
43
  <template>
43
44
  <UDropdownMenu
45
+ v-if="multiLocale"
44
46
  :items="items"
45
47
  :content="{ align: 'end' }"
46
48
  :ui="{ content: 'w-44' }"
@@ -35,6 +35,11 @@ export default defineNuxtModule({
35
35
  const isI18nEnabled = !!i18nOptions?.locales
36
36
  const routeNameSeparator = i18nOptions?.routesNameSeparator || DEFAULT_ROUTE_NAME_SEPARATOR
37
37
 
38
+ // Derived from the build-time config so the server and client always agree (reading the runtime i18n
39
+ // state made the language picker render on the server and disappear after hydration).
40
+ const publicConfig = nuxt.options.runtimeConfig.public as Record<string, unknown>
41
+ publicConfig.multiLocale = getAvailableLocales(nuxt.options as typeof nuxt.options & { i18n?: LayerI18nOptions }).length > 1
42
+
38
43
  // Only add the landing route if the consuming app doesn't already
39
44
  // define its own `index.vue` (which takes precedence over the layer's).
40
45
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frigear-nu/base",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "Shared Nuxt layer for Frigear websites - bundled modules, UI defaults, content collections, layouts and routing.",
5
5
  "homepage": "https://docs.frigear.dev/layers/base",
6
6
  "repository": {
@@ -24,7 +24,7 @@
24
24
  ],
25
25
  "dependencies": {
26
26
  "@comark/nuxt": "0.6.2",
27
- "@frigear-nu/menu": "0.0.9",
27
+ "@frigear-nu/menu": "0.0.10",
28
28
  "@iconify-json/lucide": "^1.2.127",
29
29
  "@iconify-json/simple-icons": "^1.2.94",
30
30
  "@nuxt/content": "3.16.0",