-
+
DevWiki
diff --git a/src/lib/HtmlHead.svelte b/src/lib/HtmlHead.svelte
index 79c6410b..021e1cd4 100644
--- a/src/lib/HtmlHead.svelte
+++ b/src/lib/HtmlHead.svelte
@@ -1,20 +1,30 @@
@@ -53,8 +63,16 @@
/>
-
-
+ {#if $currentDir === "rtl"}
+
+
+ {:else}
+
+
+ {/if}
+
+
+
-
-
diff --git a/src/lib/NavbarLangDropdown.svelte b/src/lib/NavbarLangDropdown.svelte
index 096bf8e5..48965811 100644
--- a/src/lib/NavbarLangDropdown.svelte
+++ b/src/lib/NavbarLangDropdown.svelte
@@ -1,7 +1,10 @@
-
-
- {text}
-
diff --git a/src/lib/translations/en/application.json b/src/lib/translations/en/application.json
deleted file mode 100644
index a8b12a68..00000000
--- a/src/lib/translations/en/application.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "title": "Quilt Developer Wiki :P",
- "dev-notice": "Notice: This website is still under development. Please report any issues at <{{placeholder}}>.",
- "translation-notice": "Please note that the original language of this wiki is english and that translated versions might not be up to date with the [english version]({{placeholder}}).",
- "draft-notice": "You were linked to a page in the wiki that is planned, but not yet implemented. If you want to help building out this wiki, go and take a look at <{{placeholder}}>.",
- "sidebar": {
- "menu": "Menu",
- "articles": "Articles"
- },
- "lang-dropdown": {
- "language": "Language"
- }
-}
diff --git a/src/lib/translations/en/error.json b/src/lib/translations/en/error.json
deleted file mode 100644
index d937e18e..00000000
--- a/src/lib/translations/en/error.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "title": "Error {{placeholder}}",
- "404": "No page found at: `{{placeholder}}`",
- "500": "The server encoutered an internal error, please try again"
-}
diff --git a/src/lib/translations/en/wiki.json b/src/lib/translations/en/wiki.json
deleted file mode 100644
index 057b8dfb..00000000
--- a/src/lib/translations/en/wiki.json
+++ /dev/null
@@ -1,121 +0,0 @@
-{
- "not-translated": "This wiki page isn't yet translated in your language. [Go to the english version]({{placeholder}}).",
- "not-found": "No wiki page found at: `{{placeholder}}`.",
- "blocks": {
- "title": "Blocks",
- "first-block": {
- "title": "Adding a Simple Block"
- },
- "oriented-block": {
- "title": "Adding an Oriented Block"
- },
- "redstone-interaction": {
- "title": "Adding Redstone Functionality to your Block"
- }
- },
- "concepts": {
- "title": "Concepts",
- "events": {
- "title": "Events"
- },
- "libraries": {
- "title": "List of Third Party Libraries"
- },
- "lifecycles-ticks": {
- "title": "Lifecycles and Ticks"
- },
- "minecraft-code-structure": {
- "title": "Minecraft’s Code Structure"
- },
- "mixins": {
- "title": "Mixins"
- },
- "nbt": {
- "title": "NBT and Data in Minecaft"
- },
- "networking": {
- "title": "Networking"
- },
- "qsl-qfapi": {
- "title": "QSL and QFAPI Overview"
- },
- "registries": {
- "title": "Registries"
- },
- "sideness": {
- "title": "Server-Side and Client-Side"
- }
- },
- "data": {
- "title": "Data",
- "adding-recipes": {
- "title": "Adding Recipes"
- },
- "rea": {
- "title": "Using Registry Entry Attachments (REA)"
- },
- "recipe-api": {
- "title": "Recipe API"
- },
- "recipe-type": {
- "title": "Adding a Recipe Type"
- },
- "resource-loader": {
- "title": "Resource Loader"
- }
- },
- "introduction": {
- "title": "Introduction",
- "get-started": {
- "title": "Getting Started with Quilt"
- },
- "setting-up": {
- "title": "Setting Up a Development Environment"
- }
- },
- "items": {
- "title": "Items",
- "armor": {
- "title": "Adding an Armor Set"
- },
- "first-item": {
- "title": "Creating your First Item"
- },
- "food": {
- "title": "Adding Food"
- },
- "tools": {
- "title": "Adding Custom Tools"
- }
- },
- "configuration": {
- "title": "Configuration",
- "getting-started": {
- "title": "Getting Started with Quilt Config"
- },
- "advanced-configuring": {
- "title": "Advanced Configuring"
- },
- "config-screen": {
- "title": "Setting up a Config Screen"
- },
- "metadata": {
- "title": "Annotations and Metadata Reference"
- }
- },
- "misc": {
- "title": "Misc",
- "commands": {
- "title": "Adding Commands"
- },
- "sounds": {
- "title": "Adding Sounds"
- },
- "mappings": {
- "title": "Customizing your Mappings"
- },
- "world_types": {
- "title": "Adding World Types"
- }
- }
-}
diff --git a/src/lib/translations/fr/application.json b/src/lib/translations/fr/application.json
deleted file mode 100644
index d5d1b697..00000000
--- a/src/lib/translations/fr/application.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "title": "Wiki pour Développeur·euse·s Quilt :P",
- "dev-notice": "Attention : Ce site est encore en cours de développement. Veuillez signaler les problèmes (en anglais) ici : <{{placeholder}}>.",
- "translation-notice": "Veuillez noter que la langue originale de ce wiki est l'anglais et que les versions traduites peuvent ne pas être à jour en comparaison à la [version anglaise]({{placeholder}}).",
- "draft-notice": "Cette page du wiki est prévue mais n'a pas encore été implémentée. Vous pouvez participer à la création de ce wiki ici : <{{placeholder}}>.",
- "sidebar": {
- "menu": "Menu",
- "articles": "Articles"
- },
- "lang-dropdown": {
- "language": "Langue"
- }
-}
diff --git a/src/lib/translations/fr/error.json b/src/lib/translations/fr/error.json
deleted file mode 100644
index fbe42383..00000000
--- a/src/lib/translations/fr/error.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "title": "Erreur {{placeholder}}",
- "404": "Aucune page trouvée à l'adresse {{placeholder}}",
- "500": "Le server a rencontré une erreur, veuillez réessayer"
-}
diff --git a/src/lib/translations/fr/wiki.json b/src/lib/translations/fr/wiki.json
deleted file mode 100644
index 5c71dbe2..00000000
--- a/src/lib/translations/fr/wiki.json
+++ /dev/null
@@ -1,115 +0,0 @@
-{
- "not-translated": "Cette page du wiki n'a pas encore été traduite en français. [Accéder à la version anglaise]({{placeholder}}).",
- "not-found": "Aucune page du wiki trouvée à l'adresse : `{{placeholder}}`.",
- "blocks": {
- "title": "Blocs",
- "first-block": {
- "title": "Ajouter un Bloc Simple"
- },
- "oriented-block": {
- "title": "Ajouter un Bloc avec Orientation"
- },
- "redstone-interaction": {
- "title": "Ajouter des fonctionnalités Redstone à votre Bloc"
- }
- },
- "concepts": {
- "title": "Concepts",
- "events": {
- "title": "Les Événements"
- },
- "libraries": {
- "title": "Liste de Librairies Tiers"
- },
- "lifecycles-ticks": {
- "title": "Cycles de Vie et Ticks"
- },
- "minecraft-code-structure": {
- "title": "La Structure du Code de Minecraft"
- },
- "mixins": {
- "title": "Les Mixins"
- },
- "nbt": {
- "title": "Le NBT et la Donnée dans Minecaft"
- },
- "networking": {
- "title": "La Mise en Réseau"
- },
- "qsl-qfapi": {
- "title": "Aperçu des QSL et de la QFAPI"
- },
- "registries": {
- "title": "Les Registres"
- },
- "sideness": {
- "title": "Côté Serveur et Côté Client"
- }
- },
- "data": {
- "title": "Donnée",
- "adding-recipes": {
- "title": "Ajouter des Recettes"
- },
- "rea": {
- "title": "Utiliser le 'Registry Entry Attachments' (REA)"
- },
- "recipe-api": {
- "title": "L'API de Recettes"
- },
- "recipe-type": {
- "title": "Ajouter un Type de Recette"
- },
- "resource-loader": {
- "title": "Le Chargeur de Resources"
- }
- },
- "introduction": {
- "title": "Introduction",
- "get-started": {
- "title": "Débuter avec Quilt"
- },
- "setting-up": {
- "title": "Mettre en place un Environement de Développement"
- }
- },
- "items": {
- "title": "Objets",
- "armor": {
- "title": "Ajouter une Armure"
- },
- "first-item": {
- "title": "Créer votre Premier Item"
- },
- "food": {
- "title": "Ajouter de la Nourriture"
- },
- "tools": {
- "title": "Ajouter des Outils Personnalisés"
- }
- },
- "configuration": {
- "title": "Configuration",
- "getting-started": {
- "title": "Débuter avec Quilt Config"
- },
- "advanced-configuring": {
- "title": "Configuration Avancée"
- },
- "config-screen": {
- "title": "Mettre en place un Écran de Configuration"
- },
- "metadata": {
- "title": "Référence pour les Annotations et les Métadonnées"
- }
- },
- "misc": {
- "title": "Divers",
- "commands": {
- "title": "Ajouter des Commandes"
- },
- "sounds": {
- "title": "Ajouter des Sons"
- }
- }
-}
diff --git a/src/lib/translations/index.ts b/src/lib/translations/index.ts
deleted file mode 100644
index 5e72f922..00000000
--- a/src/lib/translations/index.ts
+++ /dev/null
@@ -1,55 +0,0 @@
-import lang from "./lang.js";
-
-import i18n from "@sveltekit-i18n/base";
-import parser from "@sveltekit-i18n/parser-default";
-
-import type { Config } from "@sveltekit-i18n/parser-default";
-
-import { dev } from "$app/environment";
-
-export const defaultLocale = "en";
-
-export const config: Config<{ placeholder?: string }> = {
- initLocale: defaultLocale,
- fallbackLocale: defaultLocale,
- parser: parser(),
- translations: {
- en: { lang },
- fr: { lang }
- },
- loaders: [
- {
- locale: "en",
- key: "application",
- loader: async () => (await import("./en/application.json")).default
- },
- {
- locale: "en",
- key: "error",
- loader: async () => (await import("./en/error.json")).default
- },
- {
- locale: "en",
- key: "wiki",
- loader: async () => (await import("./en/wiki.json")).default
- },
- {
- locale: "fr",
- key: "application",
- loader: async () => (await import("./fr/application.json")).default
- },
- {
- locale: "fr",
- key: "error",
- loader: async () => (await import("./fr/error.json")).default
- },
- {
- locale: "fr",
- key: "wiki",
- loader: async () => (await import("./fr/wiki.json")).default
- }
- ],
- log: { level: dev ? "warn" : "error" }
-};
-
-export const { t, locale, locales, setLocale, translations } = new i18n(config);
diff --git a/src/lib/translations/lang.js b/src/lib/translations/lang.js
deleted file mode 100644
index 117be2ad..00000000
--- a/src/lib/translations/lang.js
+++ /dev/null
@@ -1,4 +0,0 @@
-export default {
- en: "English",
- fr: "Français"
-};
diff --git a/src/lib/types.d.ts b/src/lib/types.d.ts
index 8fa33bc3..ea5c92ff 100644
--- a/src/lib/types.d.ts
+++ b/src/lib/types.d.ts
@@ -1,14 +1,15 @@
+import type { Locale } from "$l10n";
+
export interface Page {
slug: string;
index: number;
- title: string;
draft: boolean;
+ availableLocales: Locale[];
}
export interface Category {
slug: string;
index: number;
- name: string;
draft: boolean;
pages: Page[];
}
diff --git a/src/params/locale.ts b/src/params/locale.ts
index 65270936..6465d1d2 100644
--- a/src/params/locale.ts
+++ b/src/params/locale.ts
@@ -1,7 +1,7 @@
import type { ParamMatcher } from "@sveltejs/kit";
-import { locales } from "$lib/translations";
+import { isLocale } from "$l10n";
export const match: ParamMatcher = (param) => {
- return locales.get().includes(param);
+ return isLocale(param);
};
diff --git a/src/routes/+error.svelte b/src/routes/+error.svelte
index c035cf81..1aebaa27 100644
--- a/src/routes/+error.svelte
+++ b/src/routes/+error.svelte
@@ -1,41 +1,41 @@
- {$t("error.title", { placeholder: `${$page.status}` })}
+ {$localize("error-title", { error_code: $page.status })}
-
{$t("error.title", { placeholder: `${$page.status}` })}
+
+
+
{#if $page.status === 404}
- {#if locale_in_route}
-
{:else}
-
+
{/if}
{:else}
-
{$t("error.500")}
+
+
+
{/if}
diff --git a/src/routes/+layout.server.ts b/src/routes/+layout.server.ts
index 9e80fca9..48a2face 100644
--- a/src/routes/+layout.server.ts
+++ b/src/routes/+layout.server.ts
@@ -4,6 +4,8 @@ import fs from "fs";
import type { Category, Page } from "$lib/types";
+import { supportedLocales } from "$l10n";
+
export async function load({ params }) {
const wiki_path = `${process.cwd()}/wiki/`;
@@ -25,19 +27,24 @@ export async function load({ params }) {
fs.existsSync(`${wiki_path}${category_slug}/${directory_name}/+page.yml`)
)
.map((page_slug) => {
- // get the metadata of each file from their yaml file
+ // get the metadata of each page from their yaml file
const page_metadata = YAML.parse(
fs.readFileSync(`${wiki_path}${category_slug}/${page_slug}/+page.yml`, "utf-8")
);
+ // get the available locales for each page
+ const available_locales = supportedLocales.filter((locale) =>
+ fs.existsSync(`${wiki_path}${category_slug}/${page_slug}/${locale}.md`)
+ );
+
return {
slug: page_slug,
index:
- page_metadata.index && typeof page_metadata.index === "number"
+ page_metadata?.index && typeof page_metadata.index === "number"
? page_metadata.index
: Number.MAX_SAFE_INTEGER, // Put the pages with no index last
- title: page_metadata.title,
- draft: page_metadata.draft || false
+ draft: page_metadata?.draft ?? false,
+ availableLocales: available_locales
};
})
.sort((a, b) => a.index - b.index);
@@ -50,10 +57,9 @@ export async function load({ params }) {
return {
slug: category_slug,
index:
- category_metadata.index && typeof category_metadata.index === "number"
+ category_metadata?.index && typeof category_metadata.index === "number"
? category_metadata.index
: Number.MAX_SAFE_INTEGER, // Put the categories with no index last
- name: category_metadata.name,
draft: pages.length === pages.filter((page) => page.draft).length,
pages: pages
};
@@ -62,5 +68,9 @@ export async function load({ params }) {
.filter((category) => category.pages.length)
.sort((a, b) => a.index - b.index);
- return { category: params.category, slug: params.slug, categories };
+ return {
+ category: params.category,
+ slug: params.article,
+ categories
+ };
}
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index d707b12a..a576b2f3 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -1,15 +1,14 @@
-
-
+
+
+
+
-
+
-
-
-
+
+
+
-
+
-
-
-
-
-
-
-
-
- {#if $locale !== "en"}
+
- {/if}
-
-
+ {#if $currentLocale !== "en"}
+
+
+
+ {/if}
+
+
-
-
-
+
+
+
+
-
-
+
+
+
diff --git a/src/routes/[[locale=locale]]/+layout.ts b/src/routes/[[locale=locale]]/+layout.ts
index 93766664..9021410f 100644
--- a/src/routes/[[locale=locale]]/+layout.ts
+++ b/src/routes/[[locale=locale]]/+layout.ts
@@ -1,23 +1,21 @@
+import { negotiateLanguages } from "@fluent/langneg";
import { redirect } from "@sveltejs/kit";
import { browser } from "$app/environment";
-import { locales, setLocale } from "$lib/translations/index";
+import { supportedLocales, defaultLocale, currentLocale, type Locale } from "$l10n";
export async function load({ params }) {
// We know that the locale is valid thanks to the
// /src/params/locale matcher
if (params.locale) {
- await setLocale(params.locale);
+ currentLocale.set(params.locale as Locale);
} else if (browser) {
- // Get the first supported locale in the user's browser's selected languages
- const navigator_language = window.navigator.languages.find((navigator_language) =>
- locales.get().includes(navigator_language)
- );
+ // Get the best possible language for the user
+ const navigator_language = negotiateLanguages(window.navigator.languages, supportedLocales, {
+ defaultLocale,
+ strategy: "lookup"
+ })[0];
- if (navigator_language) {
- redirect(308, `/${navigator_language}${window.location.pathname}`);
- } else {
- redirect(308, `/en${window.location.pathname}`);
- }
+ redirect(308, `/${navigator_language}${window.location.pathname}`);
}
}
diff --git a/src/routes/[[locale=locale]]/+page.server.ts b/src/routes/[[locale=locale]]/+page.server.ts
new file mode 100644
index 00000000..3dc9265d
--- /dev/null
+++ b/src/routes/[[locale=locale]]/+page.server.ts
@@ -0,0 +1,16 @@
+import fs from "fs";
+
+import { supportedLocales } from "$l10n";
+
+// Get the available locales for the landing page
+export async function load() {
+ const landing_page_path = `${process.cwd()}/wiki/landing-page/`;
+
+ const available_locales = supportedLocales.filter((locale) =>
+ fs.existsSync(`${landing_page_path}${locale}.md`)
+ );
+
+ return {
+ availableLocales: available_locales
+ };
+}
diff --git a/src/routes/[[locale=locale]]/+page.svelte b/src/routes/[[locale=locale]]/+page.svelte
index 276d4dd5..b888d2d3 100644
--- a/src/routes/[[locale=locale]]/+page.svelte
+++ b/src/routes/[[locale=locale]]/+page.svelte
@@ -1,13 +1,21 @@
- {$t("application.title")}
+ {$localize("application-title")}
{#if data.content}
-
+ {#if !data.translated}
+
+
+
+
+ {:else}
+
+ {/if}
{/if}
diff --git a/src/routes/[[locale=locale]]/+page.ts b/src/routes/[[locale=locale]]/+page.ts
index bbf120f3..ea416951 100644
--- a/src/routes/[[locale=locale]]/+page.ts
+++ b/src/routes/[[locale=locale]]/+page.ts
@@ -1,26 +1,44 @@
+import { negotiateLanguages } from "@fluent/langneg";
+import { get } from "svelte/store";
+
import type { ComponentType, SvelteComponent } from "svelte";
-import { defaultLocale } from "$lib/translations/index.js";
+import { currentLocale, currentLocales, defaultLocale, type Locale } from "$l10n";
+
+export async function load({
+ data,
+ parent
+}): Promise<
+ { content: ComponentType
} & (
+ | { translated: true }
+ | { translated: false; fallbackLocale: Locale }
+ )
+> {
+ // Wait for the current locale to be set by the parent layout
+ await parent();
-export async function load({ params }): Promise<{ content: ComponentType }> {
- try {
- const landing_page = await import(
- `../../../wiki/landing-page/${params.locale || defaultLocale}.md`
- );
+ if (data.availableLocales.includes(get(currentLocale))) {
+ // Load the content of the landing page in the current locale if available
+ const landingPage = await import(`../../../wiki/landing-page/${get(currentLocale)}.md`);
return {
- content: landing_page.default
+ content: landingPage.default,
+ translated: true
};
- } catch (err) {
- if (err instanceof Error && err.message.match(/Unknown variable dynamic import.+/)) {
- // Return the english version if the translated version is missing
- const landing_page = await import(`../../../wiki/landing-page/${defaultLocale}.md`);
+ } else {
+ // Load the content of the landing page in one of the user's fallback locales
+ // (taking the assumptions that the landing page is at least translated in english)
+ const fallbackLocale = negotiateLanguages(get(currentLocales), data.availableLocales, {
+ defaultLocale,
+ strategy: "lookup"
+ })[0] as Locale;
+
+ const landingPage = await import(`../../../wiki/landing-page/${fallbackLocale}.md`);
- return {
- content: landing_page.default
- };
- } else {
- throw err;
- }
+ return {
+ content: landingPage.default,
+ translated: false,
+ fallbackLocale
+ };
}
}
diff --git a/src/routes/[[locale=locale]]/[category]/[[article]]/+page.svelte b/src/routes/[[locale=locale]]/[category]/[[article]]/+page.svelte
new file mode 100644
index 00000000..ed773522
--- /dev/null
+++ b/src/routes/[[locale=locale]]/[category]/[[article]]/+page.svelte
@@ -0,0 +1,54 @@
+
+
+
+ {$localize(data.title)}
+
+
+{#if data.draft}
+
+
+
+{/if}
+
+{#if !data.translated}
+
+
+
+
+
+
+
+{/if}
+
+{#if data.content}
+ {#if !data.translated}
+
+
+
+
+ {:else}
+
+ {/if}
+{/if}
diff --git a/src/routes/[[locale=locale]]/[category]/[[article]]/+page.ts b/src/routes/[[locale=locale]]/[category]/[[article]]/+page.ts
new file mode 100644
index 00000000..d857f2d7
--- /dev/null
+++ b/src/routes/[[locale=locale]]/[category]/[[article]]/+page.ts
@@ -0,0 +1,82 @@
+import { negotiateLanguages } from "@fluent/langneg";
+import { error } from "@sveltejs/kit";
+import { get } from "svelte/store";
+
+import type { ComponentType, SvelteComponent } from "svelte";
+
+import { type Locale, defaultLocale, currentLocales, currentLocale } from "$l10n";
+
+export async function load({ params, parent }): Promise<
+ {
+ content?: ComponentType;
+ title: string;
+ draft: boolean;
+ } & (
+ | { translated: true }
+ | {
+ translated: false;
+ fallbackLocale: Locale;
+ }
+ )
+> {
+ // Get the data loaded in the parent layouts
+ const parent_data = await parent();
+
+ // Get the category from the data loaded in the root `+layout.server.ts`
+ const category = parent_data.categories.find((category) => category.slug === params.category);
+
+ // Category not found
+ if (!category) {
+ error(404);
+ }
+
+ // Get the article from the loaded category
+ const article = category.pages.find((page) => page.slug === params.article);
+
+ // Article not found
+ if (!article) {
+ error(404);
+ }
+
+ if (article.availableLocales.includes(get(currentLocale))) {
+ // Load the content of the article for the current locale if available
+ const content = await import(
+ `../../../../../wiki/${category.slug}/${article.slug}/${get(currentLocale)}.md`
+ );
+
+ return {
+ title: `${category.slug}.${article.slug}`,
+ draft: article.draft,
+ content: content.default,
+ translated: true
+ };
+ } else if (article.availableLocales.length) {
+ // Load the content of the article for one of the user's prefered locales
+ // (taking the assumptions that if the article exists in a locale, it should exist in english)
+ const fallbackLocale = negotiateLanguages(get(currentLocales), article.availableLocales, {
+ defaultLocale,
+ strategy: "lookup"
+ })[0] as Locale;
+
+ const content = await import(
+ `../../../../../wiki/${category.slug}/${article.slug}/${fallbackLocale}.md`
+ );
+
+ return {
+ title: `${category.slug}.${article.slug}`,
+ draft: article.draft,
+ content: content.default,
+ translated: false,
+ fallbackLocale
+ };
+ } else if (article.draft) {
+ // Still display the draft message if the article doesn't have any content yet
+ return {
+ title: `${category.slug}.${article.slug}`,
+ draft: true,
+ translated: true
+ };
+ } else {
+ error(404);
+ }
+}
diff --git a/src/routes/[[locale=locale]]/[category]/[[slug]]/+page.svelte b/src/routes/[[locale=locale]]/[category]/[[slug]]/+page.svelte
deleted file mode 100644
index a7b5ea38..00000000
--- a/src/routes/[[locale=locale]]/[category]/[[slug]]/+page.svelte
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
- {$t(data.title)}
-
-
-{#if data.warningMessage}
-
-
-
-
-
-
-
-{/if}
-
-{#if data.content}
-
-{/if}
diff --git a/src/routes/[[locale=locale]]/[category]/[[slug]]/+page.ts b/src/routes/[[locale=locale]]/[category]/[[slug]]/+page.ts
deleted file mode 100644
index 0b3743a5..00000000
--- a/src/routes/[[locale=locale]]/[category]/[[slug]]/+page.ts
+++ /dev/null
@@ -1,77 +0,0 @@
-import { error } from "@sveltejs/kit";
-import YAML from "yaml";
-
-import type { ComponentType, SvelteComponent } from "svelte";
-
-import { defaultLocale } from "$lib/translations";
-
-export async function load({ params }): Promise<{
- content?: ComponentType;
- title: string;
- warningMessage: { key: string; placeholder: string } | false;
-}> {
- // Throws a 404 error if the route doesn't contain a slug
- if (!params.slug) {
- error(404);
- }
-
- try {
- // get the metadata from the yaml file instead of the makdown file header
- 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
- const post = await import(
- `../../../../../wiki/${params.category}/${params.slug}/${params.locale || defaultLocale}.md`
- );
-
- return {
- content: post.default,
- title: post_metadata.title,
- warningMessage: post_metadata.draft
- ? {
- key: "application.draft-notice",
- placeholder: "https://github.com/QuiltMC/developer-wiki"
- }
- : false
- };
- } catch (err) {
- if (
- !post_metadata.draft &&
- err instanceof Error &&
- err.message.match(/Unknown variable dynamic import.+/)
- ) {
- // Display a warning message if the page isn't
- // translated in the current locale
- return {
- title: post_metadata.title,
- warningMessage: {
- key: "wiki.not-translated",
- placeholder: `/en/${params.category}/${params.slug}`
- }
- };
- } else if (post_metadata.draft) {
- // still displays the draft warning if the markdown file is missing
- return {
- title: post_metadata.title,
- warningMessage: post_metadata.draft
- ? {
- key: "application.draft-notice",
- placeholder: "https://github.com/QuiltMC/developer-wiki"
- }
- : false
- };
- } else {
- throw err;
- }
- }
- } catch (err) {
- if (err instanceof Error && err.message.match(/^Unknown variable dynamic import.+$/)) {
- error(404);
- } else {
- throw err;
- }
- }
-}
diff --git a/svelte.config.js b/svelte.config.js
index 9679b8ce..e8ccb55b 100644
--- a/svelte.config.js
+++ b/svelte.config.js
@@ -1,5 +1,3 @@
-import lang from "./src/lib/translations/lang.js";
-
import sectionize from "@hbsnow/rehype-sectionize";
import toc from "@jsdevtools/rehype-toc";
import adapter from "@sveltejs/adapter-static";
@@ -9,16 +7,16 @@ import rehypeAutolinkHeadings from "rehype-autolink-headings";
import rehypeRewrite from "rehype-rewrite";
import rehypeSlug from "rehype-slug";
-const supportedLocales = Object.keys(lang);
-
export default {
kit: {
adapter: adapter(),
prerender: {
- entries: supportedLocales.reduce((acc, locale) => [...acc, `/${locale}`], ["/"])
+ // Add new locales here
+ entries: ["/", "/en", "/fr"]
},
alias: {
- $wiki: "wiki"
+ $wiki: "wiki",
+ $l10n: "l10n"
}
},
diff --git a/vite.config.ts b/vite.config.ts
index b489e22a..dacb4d95 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -1,3 +1,4 @@
+import svelteFluent from "@nubolab-ffwd/svelte-fluent/rollup-plugin";
import { sveltekit } from "@sveltejs/kit/vite";
import extractorSvelte from "@unocss/extractor-svelte";
import UnoCSS from "unocss/vite";
@@ -8,6 +9,7 @@ export default defineConfig({
UnoCSS({
extractors: [extractorSvelte()]
}),
+ svelteFluent(),
sveltekit()
],
server: {
diff --git a/wiki/blocks/+category.yml b/wiki/blocks/+category.yml
index 3abce379..ea01cee6 100644
--- a/wiki/blocks/+category.yml
+++ b/wiki/blocks/+category.yml
@@ -1,2 +1 @@
-name: wiki.blocks.title
index: 3
diff --git a/wiki/blocks/first-block/+page.yml b/wiki/blocks/first-block/+page.yml
index dab8d640..1f8f1107 100644
--- a/wiki/blocks/first-block/+page.yml
+++ b/wiki/blocks/first-block/+page.yml
@@ -1,2 +1 @@
-title: wiki.blocks.first-block.title
index: 1
diff --git a/wiki/blocks/oriented-block/+page.yml b/wiki/blocks/oriented-block/+page.yml
index 59eea59c..4dbc3dca 100644
--- a/wiki/blocks/oriented-block/+page.yml
+++ b/wiki/blocks/oriented-block/+page.yml
@@ -1,3 +1,2 @@
-title: wiki.blocks.oriented-block.title
index: 2
draft: true
diff --git a/wiki/blocks/redstone-interaction/+page.yml b/wiki/blocks/redstone-interaction/+page.yml
index 0ff86258..cfd7ed14 100644
--- a/wiki/blocks/redstone-interaction/+page.yml
+++ b/wiki/blocks/redstone-interaction/+page.yml
@@ -1,3 +1,2 @@
-title: wiki.blocks.redstone-interaction.title
index: 3
draft: true
diff --git a/wiki/concepts/+category.yml b/wiki/concepts/+category.yml
index 358c26e3..c3d6e512 100644
--- a/wiki/concepts/+category.yml
+++ b/wiki/concepts/+category.yml
@@ -1,2 +1 @@
-name: wiki.concepts.title
index: 4
diff --git a/wiki/concepts/events/+page.yml b/wiki/concepts/events/+page.yml
index be753123..5891fe7b 100644
--- a/wiki/concepts/events/+page.yml
+++ b/wiki/concepts/events/+page.yml
@@ -1,2 +1 @@
-title: wiki.concepts.events.title
draft: true
diff --git a/wiki/concepts/libraries/+page.yml b/wiki/concepts/libraries/+page.yml
index 0dd8c9e1..5891fe7b 100644
--- a/wiki/concepts/libraries/+page.yml
+++ b/wiki/concepts/libraries/+page.yml
@@ -1,2 +1 @@
-title: wiki.concepts.libraries.title
draft: true
diff --git a/wiki/concepts/lifecycles-ticks/+page.yml b/wiki/concepts/lifecycles-ticks/+page.yml
index f98737f2..5891fe7b 100644
--- a/wiki/concepts/lifecycles-ticks/+page.yml
+++ b/wiki/concepts/lifecycles-ticks/+page.yml
@@ -1,2 +1 @@
-title: wiki.concepts.lifecycles-ticks.title
draft: true
diff --git a/wiki/concepts/minecraft-code-structure/+page.yml b/wiki/concepts/minecraft-code-structure/+page.yml
index fa1ae5bb..5891fe7b 100644
--- a/wiki/concepts/minecraft-code-structure/+page.yml
+++ b/wiki/concepts/minecraft-code-structure/+page.yml
@@ -1,2 +1 @@
-title: wiki.concepts.minecraft-code-structure.title
draft: true
diff --git a/wiki/concepts/mixins/+page.yml b/wiki/concepts/mixins/+page.yml
index 3e21cfd4..5891fe7b 100644
--- a/wiki/concepts/mixins/+page.yml
+++ b/wiki/concepts/mixins/+page.yml
@@ -1,2 +1 @@
-title: wiki.concepts.mixins.title
draft: true
diff --git a/wiki/concepts/nbt/+page.yml b/wiki/concepts/nbt/+page.yml
index 75dabb04..5891fe7b 100644
--- a/wiki/concepts/nbt/+page.yml
+++ b/wiki/concepts/nbt/+page.yml
@@ -1,2 +1 @@
-title: wiki.concepts.nbt.title
draft: true
diff --git a/wiki/concepts/networking/+page.yml b/wiki/concepts/networking/+page.yml
index 7a7b03e4..5891fe7b 100644
--- a/wiki/concepts/networking/+page.yml
+++ b/wiki/concepts/networking/+page.yml
@@ -1,2 +1 @@
-title: wiki.concepts.networking.title
draft: true
diff --git a/wiki/concepts/qsl-qfapi/+page.yml b/wiki/concepts/qsl-qfapi/+page.yml
index 2e569e2d..e69de29b 100644
--- a/wiki/concepts/qsl-qfapi/+page.yml
+++ b/wiki/concepts/qsl-qfapi/+page.yml
@@ -1 +0,0 @@
-title: wiki.concepts.qsl-qfapi.title
diff --git a/wiki/concepts/registries/+page.yml b/wiki/concepts/registries/+page.yml
index ff689c9d..5891fe7b 100644
--- a/wiki/concepts/registries/+page.yml
+++ b/wiki/concepts/registries/+page.yml
@@ -1,2 +1 @@
-title: wiki.concepts.registries.title
draft: true
diff --git a/wiki/concepts/sideness/+page.yml b/wiki/concepts/sideness/+page.yml
index 58937454..5891fe7b 100644
--- a/wiki/concepts/sideness/+page.yml
+++ b/wiki/concepts/sideness/+page.yml
@@ -1,2 +1 @@
-title: wiki.concepts.sideness.title
draft: true
diff --git a/wiki/configuration/+category.yml b/wiki/configuration/+category.yml
index 4c4fcea6..bc6c2380 100644
--- a/wiki/configuration/+category.yml
+++ b/wiki/configuration/+category.yml
@@ -1,2 +1 @@
-name: wiki.configuration.title
index: 6
diff --git a/wiki/configuration/advanced-configuring/+page.yml b/wiki/configuration/advanced-configuring/+page.yml
index 42e2404f..02159b03 100644
--- a/wiki/configuration/advanced-configuring/+page.yml
+++ b/wiki/configuration/advanced-configuring/+page.yml
@@ -1,2 +1 @@
-title: wiki.configuration.advanced-configuring.title
index: 2
diff --git a/wiki/configuration/config-screen/+page.yml b/wiki/configuration/config-screen/+page.yml
index cc71d1dc..5891fe7b 100644
--- a/wiki/configuration/config-screen/+page.yml
+++ b/wiki/configuration/config-screen/+page.yml
@@ -1,2 +1 @@
-title: wiki.configuration.config-screen.title
draft: true
diff --git a/wiki/configuration/getting-started/+page.yml b/wiki/configuration/getting-started/+page.yml
index 7d56dbc7..1f8f1107 100644
--- a/wiki/configuration/getting-started/+page.yml
+++ b/wiki/configuration/getting-started/+page.yml
@@ -1,2 +1 @@
-title: wiki.configuration.getting-started.title
index: 1
diff --git a/wiki/configuration/metadata/+page.yml b/wiki/configuration/metadata/+page.yml
index 1b3d167c..ea01cee6 100644
--- a/wiki/configuration/metadata/+page.yml
+++ b/wiki/configuration/metadata/+page.yml
@@ -1,2 +1 @@
-title: wiki.configuration.metadata.title
index: 3
diff --git a/wiki/data/+category.yml b/wiki/data/+category.yml
index 2a7d6b9e..82b13c1a 100644
--- a/wiki/data/+category.yml
+++ b/wiki/data/+category.yml
@@ -1,2 +1 @@
-name: wiki.data.title
index: 5
diff --git a/wiki/data/adding-recipes/+page.yml b/wiki/data/adding-recipes/+page.yml
index a50b73ea..5891fe7b 100644
--- a/wiki/data/adding-recipes/+page.yml
+++ b/wiki/data/adding-recipes/+page.yml
@@ -1,2 +1 @@
-title: wiki.data.adding-recipes.title
draft: true
diff --git a/wiki/data/rea/+page.yml b/wiki/data/rea/+page.yml
index 49c8399d..5891fe7b 100644
--- a/wiki/data/rea/+page.yml
+++ b/wiki/data/rea/+page.yml
@@ -1,2 +1 @@
-title: wiki.data.rea.title
draft: true
diff --git a/wiki/data/recipe-api/+page.yml b/wiki/data/recipe-api/+page.yml
index 5c1b7d3e..5891fe7b 100644
--- a/wiki/data/recipe-api/+page.yml
+++ b/wiki/data/recipe-api/+page.yml
@@ -1,2 +1 @@
-title: wiki.data.recipe-api.title
draft: true
diff --git a/wiki/data/recipe-type/+page.yml b/wiki/data/recipe-type/+page.yml
index 012ae506..5891fe7b 100644
--- a/wiki/data/recipe-type/+page.yml
+++ b/wiki/data/recipe-type/+page.yml
@@ -1,2 +1 @@
-title: wiki.data.recipe-type.title
draft: true
diff --git a/wiki/data/resource-loader/+page.yml b/wiki/data/resource-loader/+page.yml
index fc6ddc47..5891fe7b 100644
--- a/wiki/data/resource-loader/+page.yml
+++ b/wiki/data/resource-loader/+page.yml
@@ -1,2 +1 @@
-title: wiki.data.resource-loader.title
draft: true
diff --git a/wiki/introduction/+category.yml b/wiki/introduction/+category.yml
index 95c3369f..1f8f1107 100644
--- a/wiki/introduction/+category.yml
+++ b/wiki/introduction/+category.yml
@@ -1,2 +1 @@
-name: wiki.introduction.title
index: 1
diff --git a/wiki/introduction/get-started/+page.yml b/wiki/introduction/get-started/+page.yml
deleted file mode 100644
index 465727a0..00000000
--- a/wiki/introduction/get-started/+page.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-title: wiki.introduction.get-started.title
-index: 1
diff --git a/wiki/introduction/getting-started/+page.yml b/wiki/introduction/getting-started/+page.yml
new file mode 100644
index 00000000..1f8f1107
--- /dev/null
+++ b/wiki/introduction/getting-started/+page.yml
@@ -0,0 +1 @@
+index: 1
diff --git a/wiki/introduction/get-started/en.md b/wiki/introduction/getting-started/en.md
similarity index 100%
rename from wiki/introduction/get-started/en.md
rename to wiki/introduction/getting-started/en.md
diff --git a/wiki/introduction/get-started/fr.md b/wiki/introduction/getting-started/fr.md
similarity index 100%
rename from wiki/introduction/get-started/fr.md
rename to wiki/introduction/getting-started/fr.md
diff --git a/wiki/introduction/setting-up/+page.yml b/wiki/introduction/setting-up/+page.yml
index 7f0bd45e..02159b03 100644
--- a/wiki/introduction/setting-up/+page.yml
+++ b/wiki/introduction/setting-up/+page.yml
@@ -1,2 +1 @@
-title: wiki.introduction.setting-up.title
index: 2
diff --git a/wiki/items/+category.yml b/wiki/items/+category.yml
index 9d745334..02159b03 100644
--- a/wiki/items/+category.yml
+++ b/wiki/items/+category.yml
@@ -1,2 +1 @@
-name: wiki.items.title
index: 2
diff --git a/wiki/items/armor/+page.yml b/wiki/items/armor/+page.yml
index 3bd4f094..ea01cee6 100644
--- a/wiki/items/armor/+page.yml
+++ b/wiki/items/armor/+page.yml
@@ -1,2 +1 @@
-title: wiki.items.armor.title
index: 3
diff --git a/wiki/items/first-item/+page.yml b/wiki/items/first-item/+page.yml
index eb32bea1..1f8f1107 100644
--- a/wiki/items/first-item/+page.yml
+++ b/wiki/items/first-item/+page.yml
@@ -1,2 +1 @@
-title: wiki.items.first-item.title
index: 1
diff --git a/wiki/items/food/+page.yml b/wiki/items/food/+page.yml
index 72bf49e7..02159b03 100644
--- a/wiki/items/food/+page.yml
+++ b/wiki/items/food/+page.yml
@@ -1,2 +1 @@
-title: wiki.items.food.title
index: 2
diff --git a/wiki/items/tools/+page.yml b/wiki/items/tools/+page.yml
index a4699dc0..916d8928 100644
--- a/wiki/items/tools/+page.yml
+++ b/wiki/items/tools/+page.yml
@@ -1,3 +1,2 @@
-title: wiki.items.tools.title
index: 4
draft: true
diff --git a/wiki/landing-page/en.md b/wiki/landing-page/en.md
index 729d1c93..a93efb97 100644
--- a/wiki/landing-page/en.md
+++ b/wiki/landing-page/en.md
@@ -1,4 +1,4 @@
-# Quilt Developer Wiki :P
+# Quilt Developer Wiki
This site houses heavily work-in-progress documentation for developing with projects in the Quilt ecosystem.
Check the sidebar to see what articles are currently available!
diff --git a/wiki/landing-page/fr.md b/wiki/landing-page/fr.md
index fd70f163..a418a5ca 100644
--- a/wiki/landing-page/fr.md
+++ b/wiki/landing-page/fr.md
@@ -1,4 +1,4 @@
-# Wiki pour Développeur·euse·s Quilt :P
+# Wiki pour Développeur·euse·s Quilt
Ce contient de la documentation pour le développement de projets dans l'écosystème Quilt très expérimentale.
Vérifiez la barre latérale pour voir quels articles sont actullement disponibles !
diff --git a/wiki/misc/+category.yml b/wiki/misc/+category.yml
index e4cc9949..bc6c2380 100644
--- a/wiki/misc/+category.yml
+++ b/wiki/misc/+category.yml
@@ -1,2 +1 @@
-name: wiki.misc.title
index: 6
diff --git a/wiki/misc/commands/+page.yml b/wiki/misc/commands/+page.yml
index 818f2d11..5891fe7b 100644
--- a/wiki/misc/commands/+page.yml
+++ b/wiki/misc/commands/+page.yml
@@ -1,2 +1 @@
-title: wiki.misc.commands.title
draft: true
diff --git a/wiki/misc/mappings/+page.yml b/wiki/misc/mappings/+page.yml
index 29a1a689..e69de29b 100644
--- a/wiki/misc/mappings/+page.yml
+++ b/wiki/misc/mappings/+page.yml
@@ -1 +0,0 @@
-title: wiki.misc.mappings.title
diff --git a/wiki/misc/sounds/+page.yml b/wiki/misc/sounds/+page.yml
index 51d41b0a..5891fe7b 100644
--- a/wiki/misc/sounds/+page.yml
+++ b/wiki/misc/sounds/+page.yml
@@ -1,2 +1 @@
-title: wiki.misc.sounds.title
draft: true
diff --git a/wiki/misc/world_types/+page.yml b/wiki/misc/world_types/+page.yml
index 11904098..3c835298 100644
--- a/wiki/misc/world_types/+page.yml
+++ b/wiki/misc/world_types/+page.yml
@@ -1,2 +1 @@
-title: wiki.misc.world_types.title
index: 0