feat: implement internationalization support by updating locale files and adding language switch component

This commit is contained in:
2025-06-08 09:25:38 +03:30
parent 2ae57940f0
commit 12775285ec
19 changed files with 148 additions and 333 deletions
@@ -0,0 +1,28 @@
'use client';
import Link from 'next/link';
import { usePathname } from 'next/navigation';
export default function LanguageSwitch() {
const pathname = usePathname();
const pathWithoutLocale = pathname.replace(/^\/(en|fa)/, '');
return (
<div className="flex items-center justify-center">
<Link
href={`/en${pathWithoutLocale === '/' ? '' : pathWithoutLocale}`}
className="mx-2 text-gray-800 hover:text-blue-500"
>
EN
</Link>
<span className="text-gray-800">|</span>
<Link
href={`/fa${pathWithoutLocale === '/' ? '' : pathWithoutLocale}`}
className="mx-2 text-gray-800 hover:text-blue-500"
>
FA
</Link>
</div>
);
}