working i18n conf
This commit is contained in:
parent
15b825bd5d
commit
1ab35db47d
19 changed files with 479 additions and 369 deletions
|
@ -1,14 +1,12 @@
|
|||
---
|
||||
title: "My First Blog Post"
|
||||
lang: en
|
||||
pubDate: 2022-07-01
|
||||
description: "This is the first post of my new Astro blog."
|
||||
author: "Astro Learner"
|
||||
tags: ["astro", "blogging", "learning in public"]
|
||||
---
|
||||
|
||||
import MarkdownPostLayout from "../../layouts/MarkdownPostLayout.astro";
|
||||
|
||||
export const published = new Date("2022-07-01");
|
||||
export const image = {
|
||||
url: "/oui.jpg",
|
||||
alt: "oui oui oui",
|
||||
|
@ -16,7 +14,6 @@ export const image = {
|
|||
height: "512",
|
||||
};
|
||||
|
||||
<MarkdownPostLayout pageTitle={frontmatter.title} published={published} image={image}>
|
||||
Welcome to my _new blog_ about learning Astro! Here, I will share my learning journey as I build a new website.
|
||||
|
||||
## What I've accomplished
|
||||
|
@ -30,5 +27,3 @@ Welcome to my _new blog_ about learning Astro! Here, I will share my learning jo
|
|||
## What's next
|
||||
|
||||
I will finish the Astro tutorial, and then keep adding more posts. Watch this space for more to come.
|
||||
|
||||
</MarkdownPostLayout>
|
17
src/pages/articles/fr/post-0.mdx
Normal file
17
src/pages/articles/fr/post-0.mdx
Normal file
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
title: "Mon premier article"
|
||||
lang: fr
|
||||
pubDate: 2022-07-01
|
||||
description: "youpi"
|
||||
author: "Astro Learner"
|
||||
tags: ["astro", "blogging", "learning in public"]
|
||||
---
|
||||
|
||||
export const image = {
|
||||
url: "/oui.jpg",
|
||||
alt: "oui oui oui",
|
||||
width: "394",
|
||||
height: "512",
|
||||
};
|
||||
|
||||
Bienvenue les men in black
|
|
@ -1,25 +1,27 @@
|
|||
---
|
||||
import { t, l } from "astro-i18n";
|
||||
import { l, t, astroI18n } from "astro-i18n";
|
||||
|
||||
const currentLocale = astroI18n.langCode;
|
||||
|
||||
import "../../styles/style.css";
|
||||
|
||||
import BaseLayout from "../../layouts/BaseLayout.astro";
|
||||
import ContentPost from "../../components/ContentPost.astro";
|
||||
|
||||
const allPosts = await Astro.glob("./*.mdx");
|
||||
|
||||
console.log(t("index.articles.pageName", { cool: "yes" }));
|
||||
const allPosts = await Astro.glob(`./**/*.mdx`);
|
||||
const localizedPost = allPosts.filter((post) => {
|
||||
return post.frontmatter.lang === currentLocale;
|
||||
});
|
||||
|
||||
const pageTitle = t("index.articles.pageName");
|
||||
const titleColor = "hotpink";
|
||||
---
|
||||
|
||||
<BaseLayout pageTitle={pageTitle} titleColor={titleColor}>
|
||||
<BaseLayout pageTitle={pageTitle}>
|
||||
<h2>{t("index.articles.pageName", { cool: "yes" }, "fr")}</h2>
|
||||
<p>{t("index.articles.trad")}</p>
|
||||
<ul>
|
||||
{
|
||||
allPosts.map((post) => (
|
||||
localizedPost.map((post) => (
|
||||
<li>
|
||||
<ContentPost url={post.url} title={post.frontmatter.title} />
|
||||
</li>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue