Updates and more

This commit is contained in:
2023-11-03 20:31:27 +01:00
parent b5a54d087b
commit e97e86f9ac
22 changed files with 363 additions and 80 deletions

View File

@ -1,14 +1,18 @@
import { l as proxyL } from 'astro-i18n'
import { randomBytes } from 'crypto'
const locales = ["de"];
const usedIds = new Set<string>()
export const l = (route: string) => {
const transPath = proxyL(route)
export const getRandomId = () => {
while (true) {
const id = randomBytes(4).toString('hex')
if (!usedIds.has(id)) {
usedIds.add(id)
return id
}
if(import.meta.env.DEV) {
return transPath;
}
let [empty, locale, ...rest] = transPath.split("/");
if (locales.includes(locale)) {
return "/" + rest.join("/");
}
return transPath;
}