BugFix: fixed translation formating

This commit is contained in:
2024-02-17 09:41:35 +01:00
parent 716fda63f1
commit fcd94408fe
8 changed files with 17 additions and 21 deletions

View File

@@ -8,9 +8,9 @@ import { defaultLocale, localeNames, locales } from "../i18n";
export const SelectLanguage: React.FC = () => {
const currentPathname = usePathname();
const locale = useLocale();
const secondLocale = locales.find((l) => l !== locale) as string;
const secondLocalePathname = defaultLocale === locale ? `/${secondLocale}${currentPathname}` : currentPathname.replace(`/${locale}/`, `/${secondLocale}/`);
const currentLocale = useLocale();
const secondLocale = locales.find((l) => l !== currentLocale) as string;
const secondLocalePathname = defaultLocale === currentLocale ? `/${secondLocale}${currentPathname}` : currentPathname.replace(`/${currentLocale}/`, `/${secondLocale}/`);
return (<Link className="btn btn-ghost text-xl self-end" href={secondLocalePathname}>{localeNames[secondLocale]}</Link>);
}