summaryrefslogtreecommitdiff
path: root/docs/src/util.ts
diff options
context:
space:
mode:
Diffstat (limited to 'docs/src/util.ts')
-rw-r--r--docs/src/util.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/docs/src/util.ts b/docs/src/util.ts
new file mode 100644
index 000000000..ba4f4fb3d
--- /dev/null
+++ b/docs/src/util.ts
@@ -0,0 +1,4 @@
+export function getLanguageFromURL(pathname:string) {
+ const langCodeMatch = pathname.match(/\/([a-z]{2})\//);
+ return langCodeMatch ? langCodeMatch[1] : 'en';
+} \ No newline at end of file