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
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:
@@ -70,7 +70,7 @@ function internalPath(linkUrl: string): string | null {
|
||||
/**
|
||||
* Banner link URLs are stored unprefixed (e.g. `/browse?post=123`). When the
|
||||
* viewer is on a non-English locale we must re-prefix them with the active
|
||||
* language path (`/malay/browse?post=123`) so navigation doesn't drop into
|
||||
* language path (`/ms/browse?post=123`) so navigation doesn't drop into
|
||||
* the English version of the post.
|
||||
*/
|
||||
function localizeLinkUrl(linkUrl: string, lang: Lang): string {
|
||||
|
||||
Reference in New Issue
Block a user