basic astro docs

This commit is contained in:
Felix Roos 2022-12-19 23:23:31 +01:00
parent 61657bd1b1
commit bc7a84e462
48 changed files with 14926 additions and 2 deletions

10
website/src/languages.ts Normal file
View file

@ -0,0 +1,10 @@
import { KNOWN_LANGUAGES, KNOWN_LANGUAGE_CODES } from './config';
export { KNOWN_LANGUAGES, KNOWN_LANGUAGE_CODES };
export const langPathRegex = /\/([a-z]{2}-?[A-Z]{0,2})\//;
export function getLanguageFromURL(pathname: string) {
const langCodeMatch = pathname.match(langPathRegex);
const langCode = langCodeMatch ? langCodeMatch[1] : 'en';
return langCode as typeof KNOWN_LANGUAGE_CODES[number];
}