Switch to translatable data

This commit is contained in:
2025-08-20 23:18:40 +02:00
parent c35fb06830
commit cc544322b2
36 changed files with 431 additions and 146 deletions
+6 -2
View File
@@ -1,7 +1,10 @@
<script setup lang="ts">
import { useI18nKey } from '~/composables/useI18nKey';
const props = defineProps<{
quest: {
title: string;
title_de: string;
title_en: string;
textRequired: boolean;
pictureRequired: boolean;
optional: boolean;
@@ -12,12 +15,13 @@ const props = defineProps<{
} | null;
};
}>();
const { tKey } = useI18nKey();
</script>
<template>
<span>{{ quest.pictureRequired ? '📸' : '📷' }}</span>
<span title="aaa">{{ quest.textRequired ? '❓' : '❔' }}</span>
<span class="mx-2">{{ quest.title }}</span>
<span class="mx-2">{{ tKey(quest, 'title') }}</span>
<VaChip v-if="quest.answer?.review?.score" color="success" class="float-right"
>{{ quest.answer?.review?.score || 0 }} / {{ quest.points
}}{{ quest.extraPoints ? `+${quest.extraPoints}` : '' }}</VaChip
+21 -4
View File
@@ -1,7 +1,10 @@
<script setup lang="ts">
import { getFlagEmoji } from '#shared/utils/flag';
import { fullDate } from '~~/server/utils/date';
const { d, t } = useI18n();
const { d, t, locale } = useI18n();
const { tKey } = useI18nKey();
const props = defineProps<{
answer: {
id: number;
@@ -9,6 +12,7 @@ const props = defineProps<{
updatedAt: string;
team: { id: number; name: string };
final: boolean;
lang: string;
review: {
internalNote: string | null;
rankingValue: number | null;
@@ -25,12 +29,14 @@ const props = defineProps<{
} | null;
};
quest: {
title: string;
title_de: string;
title_en: string;
pictureRequired: boolean;
textRequired: boolean;
points: number;
extraPoints: number | null;
extraText: string | null;
extraText_de: string | null;
extraText_en: string | null;
textSolution: string | null;
};
}>();
@@ -139,7 +145,7 @@ async function submit() {
<ClickableImage
v-if="answer.picture?.url"
:src="answer.picture.url"
:title="`${quest.title} ${answer.team.name}`"
:title="`${tKey(quest, 'title')} ${answer.team.name}`"
class="h-48"
/>
<h3 v-if="quest.textSolution">Solution:</h3>
@@ -172,6 +178,17 @@ async function submit() {
messages="Special showcase at the end, before the final leaderboard"
/>
</div>
<p
v-if="answer.lang"
:class="answer.lang !== locale ? 'py-2 text-xl text-red-500' : ''"
>
Users language is {{ t(`locales.${answer.lang}`) }}
{{
getFlagEmoji(
answer.lang.toLowerCase() === 'en' ? 'GB' : answer.lang
)
}}
</p>
<VaTextarea
v-model="formData.cloned.value.review"
label="Review"
+3
View File
@@ -69,6 +69,7 @@ async function kick(member: Team['members'][number]) {
init({
title: 'Error while kicking',
color: 'danger',
// @ts-expect-error weird error stuff
message: e?.message || e?.statusMessage || t(parseError(e))
});
}
@@ -97,6 +98,7 @@ async function addUser() {
init({
title: 'Error while adding',
color: 'danger',
// @ts-expect-error weird error stuff
message: e?.message || e?.statusMessage || t(parseError(e))
});
}
@@ -135,6 +137,7 @@ async function deleteTeam() {
init({
title: 'Error while deleting',
color: 'danger',
// @ts-expect-error weird error stuff
message: e?.message || e?.statusMessage || t(parseError(e))
});
}