x
This commit is contained in:
1 parent
f7aa4d099f
commit
ab3e53c4da
33 files changed
+290
-69
No files matched your search
@@ -14,7 +14,7 @@ export function useLang(): string {
|
||||
return useMemo(() => {
|
||||
// 1. Try to get it from route params
|
||||
if (params?.lang && typeof params.lang === 'string') {
|
||||
if (SUPPORTED_LOCALES.includes(params.lang as any)) {
|
||||
if ((SUPPORTED_LOCALES as readonly string[]).includes(params.lang)) {
|
||||
return params.lang;
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ export function useLang(): string {
|
||||
// 2. Fallback: extract from pathname if params are not available yet
|
||||
if (pathname) {
|
||||
const segments = pathname.split('/').filter(Boolean);
|
||||
if (segments.length > 0 && SUPPORTED_LOCALES.includes(segments[0] as any)) {
|
||||
if (segments.length > 0 && (SUPPORTED_LOCALES as readonly string[]).includes(segments[0])) {
|
||||
return segments[0];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user