Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/components/LanguageSwitcher.astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
---
import { getLocalizedPathname, LANGUAGES } from "../i18n/utils";
const flags = {
en: "🇬🇧",
fr: "🇫🇷",
} as const;
interface Props {
lang: string;
}
Expand All @@ -10,9 +14,7 @@ const otherLangs = Object.keys(LANGUAGES).filter((l) => l !== lang);
<div class="lang-switcher">
{
otherLangs.map((l) => (
<a href={getLocalizedPathname(Astro.url.pathname, l)}>
{l.toUpperCase()}
</a>
<a href={getLocalizedPathname(Astro.url.pathname, l)}>{flags[l]}</a>
))
}
</div>
Expand Down
16 changes: 16 additions & 0 deletions src/content/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,17 @@ const blog = defineCollection({
updatedDate: z.coerce.date().optional(),
heroImage: z.string().optional(),
heroGif: z.string().optional(),
slug: z.string().optional(),
lang: z.string(),
isVisible: z.boolean().default(false),
}),
slug: ({ id, data }) =>
data.slug ??
id
.split("/")
.pop()
?.replace(/\.mdx?$/, "")
?.replace(/\.fr$/, "") ?? id,
});

const projects = defineCollection({
Expand All @@ -25,9 +33,17 @@ const projects = defineCollection({
updatedDate: z.coerce.date().optional(),
heroImage: z.string().optional(),
heroGif: z.string().optional(),
slug: z.string().optional(),
lang: z.string(),
isVisible: z.boolean().default(false),
}),
slug: ({ id, data }) =>
data.slug ??
id
.split("/")
.pop()
?.replace(/\.mdx?$/, "")
?.replace(/\.fr$/, "") ?? id,
});

export const collections = {
Expand Down
1 change: 0 additions & 1 deletion src/content/projects/NBodySimulation.fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,4 +237,3 @@ Une piste d'amélioration aurait été d'exploiter la symétrie de la force grav
#### Tolérance aux pannes

Grâce à l'implémentation C++ d'OpenMPI, il était possible de définir une gestion des erreurs avec `MPI_Comm_set_errhandler` pour lever une `MPI::Exception` en cas de défaillance. Cela aurait permis d'identifier un nœud inactif, de l'exclure puis de relancer l'étape précédente. Cette solution n'a pas été mise en œuvre par manque de temps.

20 changes: 10 additions & 10 deletions src/content/projects/Steganography.fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,16 +184,16 @@ remybarranco@MacBook-Pro-de-Remy Projet-Algo %

**Benchmark pour 100 itérations :**

| Taille des données | Opération | Temps (s) |
| ---------------------------------- | --------- | --------- |
| 10 caractères (512×512) | Encodage | 1.520 |
| | Décodage | 0.020 |
| 100 caractères (512×512) | Encodage | 1.360 |
| | Décodage | 0.020 |
| 10 caractères (5184×3456) | Encodage | 1.920 |
| | Décodage | 0.020 |
| 100 caractères (5184×3456) | Encodage | 1.820 |
| | Décodage | 0.020 |
| Taille des données | Opération | Temps (s) |
| -------------------------- | --------- | --------- |
| 10 caractères (512×512) | Encodage | 1.520 |
| | Décodage | 0.020 |
| 100 caractères (512×512) | Encodage | 1.360 |
| | Décodage | 0.020 |
| 10 caractères (5184×3456) | Encodage | 1.920 |
| | Décodage | 0.020 |
| 100 caractères (5184×3456) | Encodage | 1.820 |
| | Décodage | 0.020 |

_Tableau 1.1 : temps d'encodage et de décodage selon la taille des données_

Expand Down
30 changes: 0 additions & 30 deletions src/i18n/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,34 +109,4 @@ export const ui = {
"about.server.title": "Informations serveur",
"about.server.text": "Ce site est hébergé sur <a href=\"https://pulseheberg.com\">pulseheberg</a> et la dernière mise à jour réussie date du {0}.",
},
es: {
"site.title": "Astro Blog",
"site.description": "Bienvenido a mi sitio web!",
"nav.home": "Inicio",
"nav.about": "Quien soy",
"home.welcome": "Bienvenido a mi sitio web",
"about.title": "Sobre mi",
"about.description": "Soy un desarrollador web y me encanta Astro!",
"about.text": `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
labore et dolore magna aliqua. Vitae ultricies leo integer malesuada nunc vel risus commodo
viverra. Adipiscing enim eu turpis egestas pretium. Euismod elementum nisi quis eleifend quam
adipiscing. In hac habitasse platea dictumst vestibulum. Sagittis purus sit amet volutpat. Netus
et malesuada fames ac turpis egestas. Eget magna fermentum iaculis eu non diam phasellus
vestibulum lorem. Varius sit amet mattis vulputate enim. Habitasse platea dictumst quisque
sagittis. Integer quis auctor elit sed vulputate mi. Dictumst quisque sagittis purus sit amet.`,
"home.p1": `Bienvenido a la plantilla de inicio de blog oficial. Esta plantilla sirve como punto de partida ligero y con estilo mínimo para cualquiera que quiera construir un sitio web personal, un blog o un portafolio con Astro.`,
"home.p2": `Esta plantilla viene con algunas integraciones ya configuradas en su archivo <code>astro.config.mjs</code>. Puede personalizar su configuración con <a href="https://astro.build/integrations">Astro Integrations</a> para agregar herramientas como Tailwind, React o Vue a su proyecto.`,
"home.p3":
"Aquí hay algunas ideas sobre cómo comenzar con la plantilla:",
"home.p3.0": "Maneje las traducciones en",
"home.p3.1": "Edite esta página en",
"home.p3.2": "Editar páginas traducidas en",
"home.p3.3": "Edite los elementos de encabezado del sitio en",
"home.p3.4": "Agregue su nombre al pie de página en",
"home.p3.5":
"Consulte las publicaciones de blog incluidas en idiomas ES, EN y FR en",
"home.p3.6": "Personalice el diseño general del sitio en",
"home.p3.7":
"Personalice el diseño de la página de publicación del blog en",
},
} as const;
1 change: 0 additions & 1 deletion src/i18n/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { ui } from "./ui";
export const LANGUAGES = {
en: "English",
fr: "Français",
es: "Español",
};

export const DEFAULT_LANG = "en";
Expand Down
10 changes: 5 additions & 5 deletions src/pages/[lang]/about.astro
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ const formattedDate: string = originalDate.toLocaleString("fr-FR", {
heroImage=""
>
<h4>{t("about.academic.title")}</h4>
<p set:html={t("about.academic.text")}></p>
<p set:html={t("about.academic.text")} />

<h5>{t("about.bts.title")}</h5>
<p set:html={t("about.bts.text")}></p>
<p set:html={t("about.bts.text")} />

<h5>{t("about.lp.title")}</h5>
<p set:html={t("about.lp.text")}></p>
<p set:html={t("about.lp.text")} />

<h5>{t("about.master.title")}</h5>
<p set:html={t("about.master.text")}></p>
<p set:html={t("about.master.text")} />

<h4>{t("about.server.title")}</h4>
<p set:html={t("about.server.text", formattedDate)}></p>
<p set:html={t("about.server.text", formattedDate)} />
</Layout>
2 changes: 1 addition & 1 deletion src/pages/[lang]/blog/[...slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Post from "../../../layouts/Post.astro";
export async function getStaticPaths() {
const posts = await getCollection("blog");
return posts.map((post) => ({
params: { lang: post.data.lang, slug: post.data.slug },
params: { lang: post.data.lang, slug: post.slug },
props: post,
}));
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/[lang]/blog/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const posts = (await getCollection("blog"))
{
posts.map((post) => (
<li>
<a href={`/${lang}/blog/${post.data.slug}/`}>
<a href={`/${lang}/blog/${post.slug}/`}>
<Image
width={720}
height={360}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/[lang]/projects/[...slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Post from "../../../layouts/Post.astro";
export async function getStaticPaths() {
const posts = await getCollection("projects");
return posts.map((post) => ({
params: { lang: post.data.lang, slug: post.data.slug },
params: { lang: post.data.lang, slug: post.slug },
props: post,
}));
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/[lang]/projects/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const posts = (await getCollection("projects"))
{
posts.map((post) => (
<li>
<a href={`/${lang}/projects/${post.data.slug}/`}>
<a href={`/${lang}/projects/${post.slug}/`}>
<Image
width={720}
height={360}
Expand Down
15 changes: 15 additions & 0 deletions src/pages/index.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
import { DEFAULT_LANG } from "../i18n/utils";
const redirectUrl = `/${DEFAULT_LANG}/`;
---

<html>
<head>
<meta http-equiv="refresh" content={`0; url=${redirectUrl}`} />
<link rel="canonical" href={redirectUrl} />
<title>Redirecting...</title>
</head>
<body>
<p>Redirecting to <a href={redirectUrl}>{redirectUrl}</a></p>
</body>
</html>
2 changes: 1 addition & 1 deletion src/pages/rss.xml.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export async function GET(context) {
site: context.site,
items: posts.map((post) => ({
...post.data,
link: `/${DEFAULT_LANG}/blog/${post.data.slug}/`,
link: `/${DEFAULT_LANG}/blog/${post.slug}/`,
})),
});
}