Fix dynamic default locale routing
This commit is contained in:
@@ -17,6 +17,7 @@ const PENDING_TOAST_STORAGE_KEY = "mohfarawati-pending-toast";
|
||||
|
||||
type LocaleToggleProps = {
|
||||
locale: string;
|
||||
defaultLocale?: AppLocale;
|
||||
className?: string;
|
||||
showLabel?: boolean;
|
||||
};
|
||||
@@ -29,6 +30,7 @@ const localeChangedMessages: Record<AppLocale, string> = {
|
||||
|
||||
export function LocaleToggle({
|
||||
locale,
|
||||
defaultLocale = "de",
|
||||
className,
|
||||
showLabel = false,
|
||||
}: LocaleToggleProps) {
|
||||
@@ -82,7 +84,7 @@ export function LocaleToggle({
|
||||
)}
|
||||
>
|
||||
<a
|
||||
href={getLocalizedPath(targetLocale, currentPath)}
|
||||
href={getLocalizedPath(targetLocale, currentPath, defaultLocale)}
|
||||
onClick={() => {
|
||||
const message = localeChangedMessages[targetLocale];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user