From b3270728c2617cd89b3a7f593a5da9841ac68d0e Mon Sep 17 00:00:00 2001 From: "Fred K. Schott" Date: Sun, 1 Aug 2021 23:48:53 -0700 Subject: [PATCH] add support for 4-letter language codes (ex: zh-TW) --- docs/src/util.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/util.ts b/docs/src/util.ts index 53752077e..0ec91bce0 100644 --- a/docs/src/util.ts +++ b/docs/src/util.ts @@ -1,4 +1,4 @@ export function getLanguageFromURL(pathname: string) { - const langCodeMatch = pathname.match(/\/([a-z]{2})\//); + const langCodeMatch = pathname.match(/\/([a-z]{2}-?[A-Z]{0,2})\//); return langCodeMatch ? langCodeMatch[1] : 'en'; }