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 02d058c commit 56387e7Copy full SHA for 56387e7
tools/helper/src/client/composables/useLocaleConfig.ts
@@ -18,7 +18,18 @@ export const useLocaleConfig = <T extends LocaleData>(
18
): ComputedRef<T> => {
19
const routeLocale = useRouteLocale()
20
21
- return computed(() => toValue(localesConfig)[routeLocale.value] ?? {})
+ return computed(() => {
22
+ const config = toValue(localesConfig)
23
+
24
+ return (
25
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
26
+ config[routeLocale.value] ??
27
+ // fallback to root locale config
28
+ config['/'] ??
29
+ // falling back to first locale config that exists
30
+ Object.values(config)[0]
31
+ )
32
+ })
33
}
34
35
/**
0 commit comments