feat(langs): Add internacionalization functionality

This commit is contained in:
Alexander Navarro 2024-03-16 18:37:12 -03:00
parent eef9ec9457
commit 45fcc13497
27 changed files with 1330 additions and 390 deletions

View file

@ -1,20 +1,20 @@
---
import type { InferGetStaticPropsType, GetStaticPaths } from 'astro';
import { getCollection } from 'astro:content';
import Layout from '@layouts/Layout.astro';
import Toc from '@components/Toc/Toc';
import { changeLanguage } from "i18next";
import type { InferGetStaticPropsType, GetStaticPaths } from "astro";
import { getCollection } from "astro:content";
import Layout from "@layouts/Layout.astro";
import Toc from "@components/Toc/Toc";
changeLanguage("en");
export const getStaticPaths = (async () => {
const entries = await getCollection('blog');
return entries.map((entry) => ({
params: { slug: entry.slug },
props: entry,
}));
const entries = await getCollection("blog");
return entries.map((entry) => ({
params: { slug: entry.slug },
props: entry,
}));
}) satisfies GetStaticPaths;
type Props = InferGetStaticPropsType<typeof getStaticPaths>;
const entry = Astro.props;
const { Content, headings } = await entry.render();
---