1 parent ed4a090 commit 1260f48Copy full SHA for 1260f48
1 file changed
packages/stats/app/src/app.tsx
@@ -4,32 +4,9 @@ import { FileRoutes } from "@solidjs/start/router"
4
import { Suspense } from "solid-js"
5
import "./app.css"
6
7
-const localePrefixes = new Set([
8
- "ar",
9
- "br",
10
- "da",
11
- "de",
12
- "es",
13
- "fr",
14
- "it",
15
- "ja",
16
- "ko",
17
- "no",
18
- "pl",
19
- "ru",
20
- "th",
21
- "tr",
22
- "uk",
23
- "zh",
24
- "zht",
25
-])
26
-
27
function stripLocaleDataPrefix(pathname: string) {
28
const value = pathname.startsWith("/") ? pathname : `/${pathname}`
29
- const segments = value.split("/")
30
- if (segments[2] !== "data") return value
31
- if (!localePrefixes.has(segments[1] ?? "")) return value
32
- return value.slice((segments[1]?.length ?? 0) + 1) || "/"
+ return value.replace(/^\/[^/]+(?=\/data(?:\/|$))/, "")
33
}
34
35
function AppMeta() {
0 commit comments