You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If anyone is wondering how to translate pages as .md files, here is a solution (example with a privacy policy page) :
Create where you want the .md files, located in their respective language folders. E.g. :
(you can use any folder structure as long as the files have the same name and are located in their language folder.)
Create an astro page that will be the entry point (e.g. privacy-policy.astro)
In this page, make use of the Astro.glob function to retreive the .md page content :
---
import i18next, { t, changeLanguage } from "i18next";
import { localizePath } from "astro-i18next";
changeLanguage("fr");
const pages = await Astro.glob("../i18n/**/privacy-policy.md");
let Content;
for (const page of pages) {
if (page.file.includes(`/${i18next.language}/`))
Content = page.Content;
}
---
Now you can make use of the <Content /> into your .astro file
If anyone is wondering how to translate pages as .md files, here is a solution (example with a privacy policy page) :
.md
files, located in their respective language folders. E.g. :(you can use any folder structure as long as the files have the same name and are located in their language folder.)
privacy-policy.astro
).md
page content :<Content />
into your .astro fileThe text was updated successfully, but these errors were encountered: