add support for 4-letter language codes (ex: zh-TW)
This commit is contained in:
parent
877f9d2702
commit
b3270728c2
1 changed files with 1 additions and 1 deletions
|
@ -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';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue