feat(routing): shorten language URL prefixes to ISO codes with legacy redirects
All checks were successful
Deploy to Frontend Servers / deploy (push) Successful in 31s

Rename the localized URL prefixes from full English names to short
ISO-style codes:
  /chinese    -> /cn
  /japanese   -> /ja
  /korean     -> /ko
  /vietnamese -> /vi
  /indonesian -> /id
  /malay      -> /ms

Add legacyLanguageRedirects mapping and a LegacyLangRedirect component
in App.tsx so links shared on WeChat (and elsewhere) that still use the
long-form paths keep landing on the right page. The redirect preserves
the sub-path, query string, and hash, e.g.
  /malay/browse?post=42#x -> /ms/browse?post=42#x

Also refresh doc-comment examples in i18n.tsx, FigmaBanner.tsx,
PublicLayout.tsx, and useLocalizedPath.ts so future readers see the new
prefixes.
This commit is contained in:
TerryM
2026-06-04 12:01:38 +08:00
parent 53614189ce
commit 1b52a6d93d
8 changed files with 122 additions and 32 deletions

View File

@@ -305,7 +305,7 @@ export function PublicLayout() {
const nav = useNavigate();
const lp = useLocalizedPath();
// Keep i18n state in sync with URL so deep links (`/malay/browse`) flip the
// Keep i18n state in sync with URL so deep links (`/ms/browse`) flip the
// UI language even if the user navigated via address bar or shared link.
useEffect(() => {
const urlLang = languageFromPathname(pathname);