This commit is contained in:
2023-12-15 16:11:33 +01:00
parent a72dd2124d
commit 643db90b15
10 changed files with 408 additions and 385 deletions

View File

@ -1,5 +1,5 @@
import type { AstroIntegration } from "astro";
import { mkdir, access, constants, copyFile } from 'node:fs/promises'
import { mkdir, access, constants, copyFile, rename } from 'node:fs/promises'
const locales = ["de"];
@ -20,8 +20,11 @@ export default function configureI18n(): AstroIntegration {
await mkdir(cutPrefix(newPath), {recursive: true});
}
await copyFile(`${cutPrefix(oldPath)}index.html`, `${cutPrefix(newPath)}index.${locale}.html`)
logger.info(`Copied ${oldPath}index.html to ${newPath}index.${locale}.html`)
await copyFile(`${cutPrefix(oldPath)}index.html`, `${cutPrefix(newPath)}index.html.${locale}`)
logger.info(`Copied ${oldPath}index.html to ${newPath}index.html.${locale}`)
} else {
let oldPath = cutPrefix(`${dir.pathname}${page.pathname}`)
await rename(`${oldPath}index.html`, `${oldPath}index.html.en`)
}
}
}