mirror of
https://github.com/withastro/astro.git
synced 2025-01-06 22:10:10 -05:00
4 lines
177 B
TypeScript
4 lines
177 B
TypeScript
export function getLanguageFromURL(pathname: string) {
|
|
const langCodeMatch = pathname.match(/\/([a-z]{2}-?[A-Z]{0,2})\//);
|
|
return langCodeMatch ? langCodeMatch[1] : 'en';
|
|
}
|