Skip to content

Commit

Permalink
fluent cleanup + usage of fluent attributes for clearer article keys
Browse files Browse the repository at this point in the history
  • Loading branch information
c-leri committed Jun 8, 2024
1 parent 93c52ad commit fa7d3e5
Show file tree
Hide file tree
Showing 7 changed files with 125 additions and 142 deletions.
103 changes: 47 additions & 56 deletions l10n/en.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -30,72 +30,63 @@ article-not-translated-notice = This article isn't yet translated in { $current_
# $error_code (String) - The status code of the error
error-title = Error { $error_code }
# $page_path (String) - The path to the page, without the locale
not-found-error = No page found at <code data-l10n-name="path">{ $page_path }</code>.
not-found-error = No page found at <code>{ $page_path }</code>.
# $article_path (String) - The path to the article, without the locale
article-not-found-error = No article found at <code data-l10n-name="path">{ $article_path }</code>.
article-not-found-error = No article found at <code>{ $article_path }</code>.
server-error = The server encountered an internal error, please try again.
## Wiki

## Categories

# Blocks
blocks = Blocks
.first-block = Adding a Simple Block
.oriented-block = Adding an Oriented Block
.redstone-interaction = Adding Redstone Functionnality to your Block
# Concepts
concepts = Concepts
.events = Events
.libraries = List of Third Party Libraries
.lifecycles-ticks = Lifecycles and Ticks
.minecraft-code-structure = Minecraft's Code Structure
.mixins = Mixins
.nbt = NBT and Data in Minecraft
.networking = Networking
.qsl-qfapi = QSL and QFAPI Overview
.registries = Registries
.sideness = Server-Side and Client-Side
# Data
data = Data
introduction = Introduction
items = Items
configuration = Configuration
misc = Misc
## Blocks Articles

first-block = Adding a Simple Block
oriented-block = Adding an Oriented Block
redstone-interaction = Adding Redstone Functionnality to your Block
## Concepts Aticles

events = Events
libraries = List of Third Party Libraries
lifecycles-ticks = Lifecycles and Ticks
minecraft-code-structure = Minecraft's Code Structure
mixins = Mixins
nbt = NBT and Data in Minecraft
networking = Networking
qsl-qfapi = QSL and QFAPI Overview
registries = Registries
sideness = Server-Side and Client-Side
.adding-recipes = Adding Recipes
.rea = Using Registry Entry Attachements (REA)
.recipe-api = Recipe API
.recipe-type = Adding a Recipe Type
.resource-loader = Resource Loader
## Data Articles

adding-recipes = Adding Recipes
rea = Using Registry Entry Attachements (REA)
recipe-api = Recipe API
recipe-type = Adding a Recipe Type
resource-loader = Resource Loader
## Introduction Articles

getting-started = Getting Started with Quilt
setting-up = Setting Up a Development Environment
## Items Articles

armor = Adding an Armor Set
first-item = Creating your First Item
food = Adding Food
tools = Adding Custom Tools
# Introduction
introduction = Introduction
.getting-started = Getting Started with Quilt
.setting-up = Setting Up a Development Environment
## Configuration Articles
# Items
items = Items
.armor = Adding an Armor Set
.first-item = Creating your First Item
.food = Adding Food
.tools = Adding Custom Tools
getting-started-config = Getting Started with Quilt Config
advanced-configuring = Advanced Configuring
config-screen = Setting up a Config Screen
metadata = Annotations and Metadata Reference
# Configuration
configuration = Configuration
.getting-started = Getting Started with Quilt Config
.advanced-configuring = Advanced Configuring
.config-screen = Setting up a Config Screen
.metadata = Annotations and Metadata Reference
## Misc Articles
# Misc
misc = Misc
.commands = Adding Commands
.sounds = Adding Sounds
.mappings = Customizing your Mappings
.world_types = Adding World Types
commands = Adding Commands
sounds = Adding Sounds
mappings = Customizing your Mappings
world_types = Adding World Types
104 changes: 47 additions & 57 deletions l10n/fr.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -30,72 +30,62 @@ article-not-translated-notice = Cet article n'est pas encore traduit en { $curre
# $error_code (String) - The status code of the error
error-title = Erreur { $error_code }
# $page_path (String) - The path to the page, without the locale
not-found-error = Aucune page trouvée à l'adresse <code data-l10n-name="path">{ $page_path }</code>.
not-found-error = Aucune page trouvée à l'adresse <code>{ $page_path }</code>.
# $article_path (String) - The path to the article, without the locale
article-not-found-error = Aucun article trouvé à l'adresse <code data-l10n-name="path">{ $article_path }</code>.
article-not-found-error = Aucun article trouvé à l'adresse <code>{ $article_path }</code>.
server-error = Le server a rencontré une erreur, veuillez réessayer.
## Wiki

## Categories

# Blocks
blocks = Blocs
.first-block = Ajouter un Bloc Simple
.oriented-block = Ajouter un Bloc Orienté
.redstone-interaction = Ajouter des fonctionnalités Redstone à votre Bloc
# Concepts
concepts = Concepts
.events = Événements
.libraries = Liste de Librairies Tiers
.lifecycles-ticks = Cycles de Vie et Ticks
.minecraft-code-structure = Structure du Code de Minecraft
.mixins = Mixins
.nbt = NBT et Données dans Minecaft
.networking = Réseau
.qsl-qfapi = Aperçu des QSL et de la QFAPI
.registries = Registres
.sideness = Côté Serveur et Côté Client
# Data
data = Données
introduction = Introduction
items = Items
configuration = Configuration
misc = Divers
## Blocks Articles

first-block = Ajouter un Bloc Simple
oriented-block = Ajouter un Bloc Orienté
redstone-interaction = Ajouter des fonctionnalités Redstone à votre Bloc
## Concepts Aticles

events = Événements
libraries = Liste de Librairies Tiers
lifecycles-ticks = Cycles de Vie et Ticks
minecraft-code-structure = Structure du Code de Minecraft
mixins = Mixins
nbt = NBT et Données dans Minecaft
networking = Réseau
qsl-qfapi = Aperçu des QSL et de la QFAPI
registries = Registres
sideness = Côté Serveur et Côté Client
.adding-recipes = Ajouter des Recettes
.rea = Utiliser le "Registry Entry Attachments" (REA)
.recipe-api = API des Recettes
.recipe-type = Ajouter un Type de Recette
.resource-loader = "Resource Loader"
## Data Articles

adding-recipes = Ajouter des Recettes
rea = Utiliser le "Registry Entry Attachments" (REA)
recipe-api = API des Recettes
recipe-type = Ajouter un Type de Recette
resource-loader = "Resource Loader"
## Introduction Articles

getting-started = Débuter avec Quilt
setting-up = Mettre en place un Environement de Développement
## Items Articles

armor = Ajouter une Armure
first-item = Créer votre Premier Ite
food = Ajouter de la Nourriture
tools = Ajouter des Outils Personnalisés
## Configuration Articles
# Introduction
introduction = Introduction
.getting-started = Débuter avec Quilt
.setting-up = Mettre en place un Environement de Développement
getting-started-config = Débuter avec Quilt Config
advanced-configuring = Configuration Avancée
config-screen = Mettre en place un Écran de Configuration
metadata = Référence pour les Annotations et les Métadonnées
# Items
items = Items
.armor = Ajouter une Armure
.first-item = Créer votre Premier Ite
.food = Ajouter de la Nourriture
.tools = Ajouter des Outils Personnalisés
## Misc Articles
# Configuration
configuration = Configuration
.getting-started = Débuter avec Quilt Config
.advanced-configuring = Configuration Avancée
.config-screen = Mettre en place un Écran de Configuration
.metadata = Référence pour les Annotations et les Métadonnées
commands = Ajouter des Commandes
sounds = Ajouter des Sons
mappings = Personnaliser vos Mappings
world_types = Ajouter des Types de Monde
# Misc
misc = Divers
.commands = Ajouter des Commandes
.sounds = Ajouter des Sons
.mappings = Personnaliser vos Mappings
.world_types = Ajouter des Types de Monde
36 changes: 19 additions & 17 deletions src/lib/Sidebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,25 @@
<ul class="menu-list">
{#each categories as category}
<li class:is-hidden={category.draft}>
<Localized id={category.name} />
<ul>
{#each category.pages as page}
<li class:is-hidden={page.draft}>
<a
href={`/${$currentLocale}/${category.slug}/${page.slug}`}
class:is-active={url === `/${$currentLocale}${category.slug}/${page.slug}`}
>
<Localized id={page.title} />
</a>
<!-- Needed to tell SvelteKit to generate the wiki page with no locale set (with the default locale) -->
<a class="is-hidden" href={`/${category.slug}/${page.slug}`}>
<Localized id={page.title} />
</a>
</li>
{/each}
</ul>
<Localized id={category.name} let:text let:attrs>
{text}
<ul>
{#each category.pages as page}
<li class:is-hidden={page.draft}>
<a
href={`/${$currentLocale}/${category.slug}/${page.slug}`}
class:is-active={url === `${category.slug}/${page.slug}`}
>
{attrs[page.title]}
</a>
<!-- Needed to tell SvelteKit to generate the wiki page with no locale set (with the default locale) -->
<a class="is-hidden" href={`/${category.slug}/${page.slug}`}>
{attrs[page.title]}
</a>
</li>
{/each}
</ul>
</Localized>
</li>
{/each}
</ul>
Expand Down
8 changes: 2 additions & 6 deletions src/routes/+error.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,9 @@
<Overlay
id="article-not-found-error"
args={{ article_path: $page.url.pathname.replace(`/${$currentLocale}`, "") }}
>
<code data-l10n-name="path" />
</Overlay>
/>
{:else}
<Overlay id="not-found-error" args={{ page_path: $page.url.pathname }}>
<code data-l10n-name="path" />
</Overlay>
<Overlay id="not-found-error" args={{ page_path: $page.url.pathname }} />
{/if}
{:else}
<p>
Expand Down
1 change: 0 additions & 1 deletion src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import { Overlay } from "@nubolab-ffwd/svelte-fluent";
import { onMount } from "svelte";
import { currentLocale, currentBundle } from "$l10n";
import Footer from "$lib/Footer.svelte";
import Header from "$lib/Header.svelte";
Expand Down
13 changes: 9 additions & 4 deletions src/routes/[[locale=locale]]/[category]/[[slug]]/+page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,25 @@ export async function load({ params }): Promise<
}

try {
// get the metadata from the yaml file instead of the makdown file header
// Get the metadata of the category (for the article's title)
const category_metadata = YAML.parse(
(await import(`../../../../../wiki/${params.category}/+category.yml?raw`)).default
);

// Get the metadata of the article
const post_metadata = YAML.parse(
(await import(`../../../../../wiki/${params.category}/${params.slug}/+page.yml?raw`)).default
);

try {
// the makrdown file only contains the content of the page
// Get the content of the article
const post = await import(
`../../../../../wiki/${params.category}/${params.slug}/${params.locale || defaultLocale}.md`
);

return {
content: post.default,
title: post_metadata.title,
title: `${category_metadata.name}.${post_metadata.title}`,
draft: post_metadata.draft,
translated: true
};
Expand Down Expand Up @@ -76,7 +81,7 @@ export async function load({ params }): Promise<
// current locale
return {
content: post.default,
title: post_metadata.title,
title: `${category_metadata.name}.${post_metadata.title}`,
draft: post_metadata.draft,
translated: false,
selectedFallbackLocale: selected_locale
Expand Down
2 changes: 1 addition & 1 deletion wiki/configuration/getting-started/+page.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
title: getting-started-config
title: getting-started
index: 1

0 comments on commit fa7d3e5

Please sign in to comment.