feat: track images with git lfs
This commit is contained in:
@@ -2,11 +2,18 @@
|
||||
import { locales, defaultLocale, getLocale } from "astro-i18n-aut";
|
||||
import { useTranslations } from "../i18n/utils";
|
||||
|
||||
const reg = new RegExp(`^\/(${Object.keys(locales).join("|")})\/`);
|
||||
function translatePath(lang: string) {
|
||||
const p = Astro.url.pathname.replace(reg, "").replace(/^\//, "");
|
||||
if (lang === defaultLocale) return `/${p}`;
|
||||
return `/${lang}/${p}`;
|
||||
const split = Astro.url.pathname.split("/").filter((s) => s.length);
|
||||
|
||||
if (split[0] in locales) {
|
||||
split.shift();
|
||||
}
|
||||
|
||||
if (lang === defaultLocale) {
|
||||
return `/${split.join("/")}`;
|
||||
}
|
||||
|
||||
return `/${[lang, ...split].join("/")}`;
|
||||
}
|
||||
|
||||
const locale = getLocale(Astro.url);
|
||||
|
||||
Reference in New Issue
Block a user