mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-30 14:09:51 +01:00
Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f478a08bd9 | ||
|
|
115fa5acad | ||
|
|
c24a2989fa | ||
|
|
a6cfb522b3 | ||
|
|
12e645f6e2 | ||
|
|
9a3f64fcd6 |
No files matched your search
@@ -493,7 +493,7 @@
|
||||
"description": "Search clans",
|
||||
"options": {
|
||||
"limit": {
|
||||
"name": "limit",
|
||||
"name": "",
|
||||
"description": "The max number of clan results (default: {limit})"
|
||||
}
|
||||
},
|
||||
@@ -507,7 +507,7 @@
|
||||
"description": "Search players",
|
||||
"options": {
|
||||
"limit": {
|
||||
"name": "limit",
|
||||
"name": "",
|
||||
"description": "The max number of player results (default: {limit})"
|
||||
}
|
||||
},
|
||||
@@ -531,7 +531,7 @@
|
||||
},
|
||||
"options": {
|
||||
"limit": {
|
||||
"name": "limit",
|
||||
"name": "",
|
||||
"description": "How many neighbors to display (default: {count})"
|
||||
},
|
||||
"season": {
|
||||
@@ -675,7 +675,7 @@
|
||||
"active": "{name} (Active)",
|
||||
"no_tanks_found": {
|
||||
"body": "No tanks found.",
|
||||
"search_again": "Try searching again.",
|
||||
"search_again": "",
|
||||
"clear_filters": "Try clearing filters."
|
||||
},
|
||||
"sort": {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
"shells": {
|
||||
"ap": "ББ",
|
||||
"ap_cr": "БП",
|
||||
"hc": "ОФ",
|
||||
"hc": "КС",
|
||||
"he": "ОФ"
|
||||
},
|
||||
"player_count_period": {
|
||||
@@ -39,7 +39,7 @@
|
||||
"branches": {
|
||||
"local": "dev",
|
||||
"dev": "бета",
|
||||
"opentest": "открытый тест",
|
||||
"opentest": "общий тест",
|
||||
"preview": "превью"
|
||||
},
|
||||
"locales": {
|
||||
|
||||
@@ -1,26 +1,3 @@
|
||||
<script>
|
||||
import locales from "@blitzkit/i18n/locales.json";
|
||||
import { getBestLocale } from "../core/i18n/getBestLocale";
|
||||
|
||||
const isAPI = window.location.pathname.startsWith("/api");
|
||||
const isI18nPath = locales.supported.some(({ locale }) =>
|
||||
window.location.pathname.startsWith(`/${locale}/`)
|
||||
);
|
||||
const bestLocale = getBestLocale();
|
||||
const currentPath = locales.supported.find(({ locale }) =>
|
||||
window.location.pathname.startsWith(`/${locale}/`)
|
||||
);
|
||||
|
||||
if (
|
||||
!isAPI && // not an api, duh!
|
||||
localStorage.getItem("preferred-locale") !== null && // no preference, so probably google's crawler
|
||||
bestLocale !== currentPath?.locale // we need to redirect
|
||||
) {
|
||||
window.location.pathname = isI18nPath
|
||||
? window.location.pathname.replace(
|
||||
`/${currentPath?.locale}`,
|
||||
bestLocale === undefined ? "" : `/${bestLocale}`
|
||||
)
|
||||
: `/${bestLocale}${window.location.pathname}`;
|
||||
}
|
||||
</script>
|
||||
@@ -5,11 +5,11 @@ export function getBestLocale() {
|
||||
localStorage.getItem("preferred-locale") ??
|
||||
navigator.language.split("-")[0];
|
||||
const isSupported = locales.supported.some(
|
||||
({ locale }) => locale === desiredLocale
|
||||
({ locale }) => locale === desiredLocale,
|
||||
);
|
||||
const isDefault = desiredLocale === locales.default;
|
||||
|
||||
if (!isSupported || isDefault) return undefined;
|
||||
if (!isSupported || isDefault) return locales.default;
|
||||
|
||||
return desiredLocale;
|
||||
}
|
||||
@@ -12,7 +12,8 @@ export const getStaticPaths = (async () => {
|
||||
.map((tank) =>
|
||||
parentPaths.map((parent) => ({
|
||||
params: { ...parent.params, id: tank.id },
|
||||
}))
|
||||
props: parent.props,
|
||||
})),
|
||||
)
|
||||
.flat();
|
||||
}) satisfies GetStaticPaths;
|
||||
|
||||
Reference in new issue
Block a user