wip: RichText & Templating for i18n, refactored & began i18n for Discord Server Rules using the new features

This commit is contained in:
Benjamin Singleton 2026-02-14 22:56:17 -06:00
parent feacb9b754
commit a3adc2526f
25 changed files with 929 additions and 141 deletions

View file

@ -1,13 +1,14 @@
<script setup lang="ts">
import HomeSectionWrapper from "@/components/molecules/HomeSectionWrapper.vue";
import { useLocale } from "@/i18n";
import { useI18n } from "@/i18n";
import { GREETINGS, type Greeting } from "@/i18n/greeting";
import type { Locale } from "@/i18n/locale";
import { VILANTIC_ID_TO_FLAG } from "@/i18n/vilantic";
import { randomElement } from "@/utils/random";
import { computed } from "vue";
const locale = useLocale();
const i18n = useI18n();
const greeting: Greeting = randomElement(GREETINGS);
const SECTION_ORDER = [
@ -17,7 +18,7 @@ const SECTION_ORDER = [
] as const satisfies (keyof Locale["home"]["sections"])[];
const sections = computed(() =>
SECTION_ORDER.map((id) => locale.value.home.sections[id]),
SECTION_ORDER.map((id) => i18n.v(`home.sections.${id}`)),
);
</script>
@ -34,7 +35,7 @@ const sections = computed(() =>
<div
class="subtitle is-size-6 is-flex is-flex-direction-row is-align-items-center is-gap-1 has-text-text-bold">
&mdash; {{ greeting.author }} ({{
locale.vilanticLangs[greeting.lang]
i18n.v("vilanticLangs")[greeting.lang]
}})
<figure class="image is-32x32">
<img :src="VILANTIC_ID_TO_FLAG[greeting.lang]" />