setup i18n

This commit is contained in:
Lyn Fugmann 2024-09-14 10:59:22 +02:00
parent 5dff188fa4
commit 61415ce5a7
23 changed files with 71 additions and 4 deletions

View file

@ -2,7 +2,7 @@
<div> <div>
<div>[language switcher]</div> <div>[language switcher]</div>
<nav> <nav>
{{ collections.footerNav | eleventyNavigation | eleventyNavigationToHtml | safe }} {{ collections.footerNav | pageLang | eleventyNavigation | eleventyNavigationToHtml | safe }}
</nav> </nav>
</div> </div>
<div> <div>

View file

@ -1,6 +1,6 @@
<header> <header>
<a href="/" title="home">ESE Logo</a> <a href="{{ "/" | locale_url }}" title="home">ESE Logo</a>
<nav> <nav>
{{ collections.mainNav | eleventyNavigation | eleventyNavigationToHtml | safe }} {{ collections.mainNav | pageLang | eleventyNavigation | eleventyNavigationToHtml | safe }}
</nav> </nav>
</header> </header>

View file

@ -0,0 +1,6 @@
---
layout: page.njk
title: Barrierefreiheit
tags: footerNav
---
# Barrierefreiheit

7
content/de/campus.md Normal file
View file

@ -0,0 +1,7 @@
---
layout: page.njk
title: Campus & Fakultät
tags: mainNav
---
# Campus & Fakultät

3
content/de/de.json Normal file
View file

@ -0,0 +1,3 @@
{
"lang": "de"
}

6
content/de/faq.md Normal file
View file

@ -0,0 +1,6 @@
---
layout: page.njk
title: FAQ
tags: mainNav
---
# Häufig gestellte Fragen

View file

@ -0,0 +1,7 @@
---
layout: page.njk
title: Erste Schritte
tags: mainNav
---
# Erste Schritte

6
content/de/guidelines.md Normal file
View file

@ -0,0 +1,6 @@
---
layout: page.njk
title: Community-Leitlinien
tags: footerNav
---
# Community-Leitlinien

6
content/de/imprint.md Normal file
View file

@ -0,0 +1,6 @@
---
layout: page.njk
title: Impressum
tags: footerNav
---
# Impressum

4
content/de/index.md Normal file
View file

@ -0,0 +1,4 @@
---
layout: page.njk
---
# Hallo Welt :)

6
content/de/privacy.md Normal file
View file

@ -0,0 +1,6 @@
---
layout: page.njk
title: Datenschutz
tags: footerNav
---
# Datenschutz

6
content/de/program.md Normal file
View file

@ -0,0 +1,6 @@
---
layout: page.njk
title: Programm
tags: mainNav
---
# Programm

3
content/en/en.json Normal file
View file

@ -0,0 +1,3 @@
{
"lang": "en"
}

View file

@ -1,4 +1,4 @@
const { EleventyHtmlBasePlugin } = require("@11ty/eleventy"); const { EleventyHtmlBasePlugin, EleventyI18nPlugin } = require("@11ty/eleventy");
const eleventyNavigationPlugin = require("@11ty/eleventy-navigation"); const eleventyNavigationPlugin = require("@11ty/eleventy-navigation");
// update this :) // update this :)
@ -7,9 +7,16 @@ const year = 2024;
module.exports = function(eleventyConfig) { module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(EleventyHtmlBasePlugin); eleventyConfig.addPlugin(EleventyHtmlBasePlugin);
eleventyConfig.addPlugin(eleventyNavigationPlugin); eleventyConfig.addPlugin(eleventyNavigationPlugin);
eleventyConfig.addPlugin(EleventyI18nPlugin, {
defaultLanguage: "de",
});
eleventyConfig.addGlobalData("year", year); eleventyConfig.addGlobalData("year", year);
eleventyConfig.addFilter("pageLang", function(value) {
return value.filter(item => item.page.lang === this.page.lang)
});
return { return {
dir: { dir: {
input: "content", input: "content",