wip: fixed issues with i18n fallbacking for value-type objects/arrays, removed i18n integration and replaced with proprietary implementation again

This commit is contained in:
Benjamin Singleton 2026-02-15 23:33:35 -06:00
parent 771a8cc4bf
commit d2020cafec
19 changed files with 529 additions and 420 deletions

View file

@ -1,12 +1,12 @@
<script setup lang="ts">
import DiscordRuleOverview from "@/components/molecules/DiscordRuleOverview.vue";
import DiscordRuleSection from "@/components/molecules/DiscordRuleSection.vue";
import { useI18n } from "@/i18n";
import { useLocale } from "@/i18n";
import { computed } from "vue";
const i18n = useI18n();
const locale = useLocale();
const pageI18n = computed(() => i18n.v("discord.rulesPage"));
const pageI18n = computed(() => locale.value.discord.rulesPage);
const rules = computed(() => pageI18n.value.rules);
const RULE_ORDER = [
@ -18,31 +18,6 @@ const RULE_ORDER = [
"respectStaff",
"controversialTopics",
] as const satisfies (keyof typeof pageI18n.value.rules)[];
function unwrapProxy<T extends object>(
value: T,
maxDepth: number,
depth: number = 0,
): T {
if (depth > maxDepth) {
return value;
}
const entries = Object.entries(value);
const unwrappedEntries = entries.map(
([key, value]) =>
[
key,
value !== null && typeof value === "object" ?
unwrapProxy(value, maxDepth, depth + 1)
: value,
] as const,
);
return Object.fromEntries(unwrappedEntries) as T;
}
console.log(unwrapProxy(rules.value, 5));
</script>
<template>