fix(i18n): keep locale on website->dashboard links; dashboard defaults to fa

Marketing-site login/register/dashboard links were locale-less (app.meezi.ir/login), so the dashboard auto-detected locale from the browser Accept-Language (en-US) and redirected Persian users to /en. Links now carry the current locale, and the dashboard sets localeDetection:false so any locale-less entry defaults to fa (Iran-first) instead of guessing from the browser.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-01 23:23:09 +03:30
parent 4c7783884c
commit 35494d8b32
5 changed files with 11 additions and 6 deletions
+5
View File
@@ -4,6 +4,11 @@ import { createNavigation } from "next-intl/navigation";
export const routing = defineRouting({ export const routing = defineRouting({
locales: ["fa", "ar", "en"], locales: ["fa", "ar", "en"],
defaultLocale: "fa", defaultLocale: "fa",
// Iran-first: don't auto-pick the locale from the browser's Accept-Language
// (Persian users often have an en-US browser). A locale-less URL defaults to
// fa; the locale is otherwise taken from the URL prefix or the marketing-site
// link (e.g. app.meezi.ir/fa/login).
localeDetection: false,
}); });
export const { Link, redirect, usePathname, useRouter } = export const { Link, redirect, usePathname, useRouter } =
@@ -41,7 +41,7 @@ const fa = {
desc: "از داشبورد میزی در دسترس است", desc: "از داشبورد میزی در دسترس است",
value: "چت زنده", value: "چت زنده",
cta: "ورود به داشبورد", cta: "ورود به داشبورد",
href: "https://app.meezi.ir", href: "https://app.meezi.ir/fa",
}, },
], ],
officeTitle: "دفتر مرکزی", officeTitle: "دفتر مرکزی",
@@ -79,7 +79,7 @@ const en = {
desc: "Available inside the Meezi dashboard", desc: "Available inside the Meezi dashboard",
value: "Live chat", value: "Live chat",
cta: "Go to dashboard", cta: "Go to dashboard",
href: "https://app.meezi.ir", href: "https://app.meezi.ir/en",
}, },
], ],
officeTitle: "Head Office", officeTitle: "Head Office",
+2 -2
View File
@@ -93,7 +93,7 @@ export function Navbar() {
{locale === "fa" ? "EN" : "فا"} {locale === "fa" ? "EN" : "فا"}
</button> </button>
<a <a
href="https://app.meezi.ir/login" href={`https://app.meezi.ir/${locale}/login`}
className="rounded-lg px-3 py-2 text-sm font-medium text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900" className="rounded-lg px-3 py-2 text-sm font-medium text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900"
> >
{t("login")} {t("login")}
@@ -143,7 +143,7 @@ export function Navbar() {
</ul> </ul>
<div className="mt-3 flex flex-col gap-2 border-t border-gray-100 pt-3"> <div className="mt-3 flex flex-col gap-2 border-t border-gray-100 pt-3">
<a <a
href="https://app.meezi.ir/login" href={`https://app.meezi.ir/${locale}/login`}
className="block rounded-lg px-3 py-2.5 text-center text-sm font-medium text-gray-600 hover:bg-gray-50" className="block rounded-lg px-3 py-2.5 text-center text-sm font-medium text-gray-600 hover:bg-gray-50"
> >
{t("login")} {t("login")}
@@ -101,7 +101,7 @@ export function LaunchCountdownSection() {
</div> </div>
<a <a
href="https://app.meezi.ir/register" href={`https://app.meezi.ir/${locale}/register`}
className={cn( className={cn(
"inline-flex items-center justify-center rounded-xl bg-brand-700 px-6 py-3 text-sm font-semibold text-white", "inline-flex items-center justify-center rounded-xl bg-brand-700 px-6 py-3 text-sm font-semibold text-white",
"transition hover:bg-brand-800 focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-700 focus-visible:ring-offset-2" "transition hover:bg-brand-800 focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-700 focus-visible:ring-offset-2"
@@ -34,7 +34,7 @@ export function PricingSection() {
priceNote: t("freePriceNote"), priceNote: t("freePriceNote"),
desc: t("freeDesc"), desc: t("freeDesc"),
cta: t("ctaFree"), cta: t("ctaFree"),
href: "https://app.meezi.ir/register", href: `https://app.meezi.ir/${locale}/register`,
features: [t("f1"), t("f2"), t("f3"), t("f4"), t("f5")], features: [t("f1"), t("f2"), t("f3"), t("f4"), t("f5")],
popular: false, popular: false,
variant: "outline", variant: "outline",