Start i18n on static texts

This commit is contained in:
2025-08-21 20:52:59 +02:00
parent 5d1a029a54
commit 7948fed103
9 changed files with 225 additions and 85 deletions
+58 -1
View File
@@ -13,7 +13,8 @@
"register": "Registrieren",
"register_instead": "Stattdessen registrieren",
"reset": "Zurücksetzen",
"showPassword": "Passwort einblenden"
"showPassword": "Passwort einblenden",
"old_invalid": "Altes Passwort inkorrekt!"
},
"enums": {
"text_type": {
@@ -42,6 +43,17 @@
"en": "Englisch"
},
"page": {
"common": {
"update_btn": "Updaten",
"back_to_hunt": "Zurück zum Hunt",
"no_pictures": "Es wurden noch keine Bilder abgeschickt :(",
"not_revealed": "Antworten sind noch nicht aufgedeckt, bitte warte bis zum Ende des Hunt!",
"admin": "Admin",
"refresh": "Aktualisieren",
"login_first": "Erst anmelden",
"open": "Öffnen",
"back_home": "Zurück zur Startseite"
},
"home": {
"click_hunt_below_to_join": "Klick auf einen Hunt um ihm beizutreten!",
"end": "Ende: {start}",
@@ -76,6 +88,51 @@
"description": "Beschreibung",
"score": "Punkte"
}
},
"profile": {
"old_password": "Altes Passwort",
"new_password": "Neues Passwort",
"uploaded_pictures": "Hochgeladene Bilder",
"no_pictures": "Noch keine Bilder hochgeladen."
},
"pictures": {
"head": "Bilderwand"
},
"diashow": {
"head": "Diashow"
},
"quest": {
"already_finalized": "Antwort ist bereits finalisiert, keine Änderung erlaubt!",
"conflict": "Konflikt: Bitte aktualisiere",
"extra_points": "Extrapunkte:",
"review": "Bewertung",
"score": "Punkte:",
"reviewed_by": "von {name} am {date}",
"last_update": "Letztes Update: {date} von {name}",
"submission": "Einreichung",
"your_answer": "Deine Antwort",
"required_answer": "Erforderliche Antwort",
"finalize": "Antwort finalisieren",
"already_submitted": "Deine Antwort wurde bereits übermittelt!",
"finalize_explain": "Dies gibt den Admins die Möglichkeit deine Antwort zu bewerten und dir Punkte zu geben. Du kannst deine Antwort anschließend nicht mehr ändern!"
},
"hunt": {
"total_points": "Punktestand: {score}",
"showcase": "Showcase",
"diashow": "Diashow",
"all_pictures": "Bilderwand",
"teams": "Teams",
"team_count": "Keine Team beigetreten, so wie du! | Ein Team ist beigetreten, du noch nicht! | {count} Teams sind beigetreten, du noch nicht!",
"team_count_joined": "Keine Team beigetreten, so wie du! | Ein Team ist beigetreten, du auch! | {count} Teams sind beigetreten, du auch!",
"your_team": "Dein Team:",
"invite": "Einladen:",
"join_this_hunt": "Trete diesem Hunt bei!",
"login_to_join": "Um diesem Hunt beizutreten suche oder erstelle ein Team:",
"hide_answers": "Antworten verstecken",
"no_picture_uploaded": "Kein Bild hochgeladen",
"admin_unreviewed": "Admin ({count} unbewertet)",
"quest_not_revealed": "Quests wurden noch nicht aufgedeckt!",
"quest_soon_reveal": "Bald werden alle {count} Quests aufgedeckt!"
}
},
"validation": {
+58 -1
View File
@@ -13,7 +13,8 @@
"register": "Register",
"register_instead": "Register instead",
"reset": "Reset",
"showPassword": "Show password"
"showPassword": "Show password",
"old_invalid": "Old password incorrect!"
},
"enums": {
"text_type": {
@@ -42,6 +43,17 @@
"en": "English"
},
"page": {
"common": {
"update_btn": "Update",
"back_to_hunt": "Back to Hunt",
"no_pictures": "No pictures has been submitted yet :(",
"not_revealed": "Answers are not revealed yet, please wait until the end!",
"admin": "Admin",
"refresh": "Refresh",
"login_first": "Login first",
"open": "Open",
"back_home": "Back home"
},
"home": {
"click_hunt_below_to_join": "Click on a hunt below and join them!",
"end": "End: {start}",
@@ -76,6 +88,51 @@
"description": "Description",
"score": "Score"
}
},
"profile": {
"old_password": "Old password",
"new_password": "New password",
"uploaded_pictures": "Uploaded pictures",
"no_pictures": "No pictures uploaded yet."
},
"pictures": {
"head": "Picture wall"
},
"diashow": {
"head": "Diashow"
},
"quest": {
"already_finalized": "Answer is already finalized, no update allowed!",
"conflict": "Conflict: Please refresh",
"extra_points": "Extra points:",
"review": "Review",
"score": "Score:",
"reviewed_by": "by {name} at {date}",
"last_update": "Last update: {date} by {name}",
"submission": "Submission",
"your_answer": "Your answer",
"required_answer": "Required Answer",
"finalize": "Finalize answer",
"already_submitted": "Your final answer has already been submitted!",
"finalize_explain": "This allows the admins to review your answer and give you points. You cannot change your answer afterwards!"
},
"hunt": {
"total_points": "Total points: {score}",
"showcase": "Showcase",
"diashow": "Diashow",
"all_pictures": "All pictures",
"teams": "Teams",
"team_count": "No teams joined, just like you! | One team joined, unlike you! | {count} teams joined, unlike you!",
"team_count_joined": "No teams joined, just like you! | One team joined, just like you! | {count} teams joined, just like you!",
"your_team": "Your team:",
"invite": "Invite:",
"join_this_hunt": "Join this hunt!",
"login_to_join": "To join this hunt you need to join or create a team:",
"hide_answers": "Hide answers",
"no_picture_uploaded": "No picture uploaded",
"admin_unreviewed": "Admin ({count} unreviewed)",
"quest_not_revealed": "Quests not revealed yet!",
"quest_soon_reveal": "Soon all {count} quests will be revealed!"
}
},
"validation": {
@@ -45,7 +45,7 @@ titleStore.title = data.value ? tKey(data.value, 'title').value : undefined;
`/hunt/${data ? tSluggy(data.hunt).value : sluggy(huntSlug!)}`
)
"
>Back to Hunt</VaButton
>{{ t('pages.common.back_to_hunt') }}</VaButton
>
<VaButton icon="replay" color="success" @click="refresh"
>Refresh</VaButton
+28 -19
View File
@@ -85,14 +85,14 @@ async function submit() {
newImage.value = undefined;
} catch (e) {
if (e instanceof Error && 'statusCode' in e && e.statusCode === 418) {
submitError.value = 'Answer is already finalized, no update allowed!';
submitError.value = t('page.quest.already_finalized');
await refresh();
} else if (
e instanceof Error &&
'statusCode' in e &&
e.statusCode === 409
) {
submitError.value = 'Conflict: Please refresh';
submitError.value = t('page.quest.conflict');
} else {
submitError.value = parseError(e);
}
@@ -114,7 +114,7 @@ const createImageURL = (file: File) => URL.createObjectURL(file);
`/hunt/${data ? tSluggy(data.hunt).value : sluggy(huntSlug!)}`
)
"
>Back to Hunt</VaButton
>{{ t('pages.common.back_to_hunt') }}</VaButton
>
<VaButton
icon="refresh"
@@ -134,7 +134,7 @@ const createImageURL = (file: File) => URL.createObjectURL(file);
`/hunt/${data?.hunt ? tSluggy(data.hunt).value : sluggy(huntSlug!)}/${data ? tSluggy(data).value : sluggy(questSlug!)}}/admin`
)
"
>Admin</VaButton
>{{ t('pages.common.admin') }}</VaButton
></VaButtonGroup
>
<div v-if="data">
@@ -164,21 +164,27 @@ const createImageURL = (file: File) => URL.createObjectURL(file);
🖋: {{ t(`enums.text_type.${data.textType}`) }}
</p>
<p v-if="hasKey(data, 'extraText')">
<span class="uppercase">Extra points:</span>
<span class="uppercase">{{
t('page.quest.extra_points')
}}</span>
{{ tKey(data, 'extraText') }}
</p>
</div>
</VaCardContent>
</VaCard>
<VaCard v-if="data.answer?.review" color="info">
<VaCardTitle>Review</VaCardTitle>
<VaCardTitle>{{ t('page.quest.review') }}</VaCardTitle>
<VaCardContent>
<p v-if="data.answer.review?.score" class="mb-2">
Score:
{{ t('page.quest.score') }}
<VaChip color="success">{{ data.answer.review.score }}</VaChip>
<span v-if="data.answer.review.reviewer" class="text-sm">
by {{ data.answer.review.reviewer.name }} at
{{ d(data.answer.review.updatedAt, fullDate) }}</span
{{
t('page.quest.reviewed_by', {
name: data.answer.review.reviewer.name,
date: d(data.answer.review.updatedAt, fullDate)
})
}}</span
>
</p>
<div
@@ -200,7 +206,7 @@ const createImageURL = (file: File) => URL.createObjectURL(file);
stripe
:stripe-color="data.answer?.final ? 'success' : 'primary'"
>
<VaCardTitle>Submission</VaCardTitle>
<VaCardTitle>{{ t('page.quest.submission') }}</VaCardTitle>
<VaCardContent>
<div class="flex flex-col gap-4">
<VaInput
@@ -208,7 +214,7 @@ const createImageURL = (file: File) => URL.createObjectURL(file);
v-model="answer"
:label="tKey(data, 'question').value"
:disabled="uploading || data.answer?.final"
placeholder="Your answer"
:placeholder="t('page.quest.your_answer')"
:required-mark="data.textRequired"
:clearable="!!data.answer?.text"
:clear-value="data.answer?.text || ''"
@@ -216,7 +222,7 @@ const createImageURL = (file: File) => URL.createObjectURL(file);
:type="textType[data.textType]"
:messages="[
t(`enums.text_type.${data.textType}`),
data.textRequired ? 'Required Answer' : ''
data.textRequired ? t('page.quest.required_answer') : ''
]"
>
<template v-if="data.textUnit" #appendInner>
@@ -247,15 +253,18 @@ const createImageURL = (file: File) => URL.createObjectURL(file);
file-types="jpg,png,jpeg"
/>
<p v-if="data.answer?.updatedAt">
Last update:
{{ d(data.answer.updatedAt, fullDate) }}
by {{ data.answer.member.name }}
{{
t('page.quest.last_update', {
date: d(data.answer.updatedAt, fullDate),
name: data.answer.member.name
})
}}
</p>
<VaCheckbox
v-model="final"
:disabled="data.answer?.final"
label="Finalize answer"
messages="This allows the admins to review your answer and give you points. You cannot change your answer afterwards!"
:label="t('page.quest.finalize')"
:messages="t('page.quest.already_finalized')"
/>
<VaAlert
@@ -275,10 +284,10 @@ const createImageURL = (file: File) => URL.createObjectURL(file);
"
:loading="uploading"
@click="submit"
>Update</VaButton
>{{ t('page.common.update_btn') }}</VaButton
>
<p v-else class="font-bold">
Your final answer has already been submitted!
{{ t('page.quest.already_submitted') }}
</p>
</div>
</VaCardContent>
+9 -8
View File
@@ -54,7 +54,7 @@ const { data, refresh, error } = await useFetch(`/api/hunt/${id}/diashow`, {
useHead({
title: t('layouts.two_title', {
title: data.value?.name || name,
subtitle: 'Diashow'
subtitle: t('pages.diashow.head')
})
});
@@ -92,28 +92,29 @@ titleStore.title = data.value?.name;
v-else-if="error"
class="flex h-full w-full flex-col items-center justify-center text-center text-2xl"
>
<VaAlert color="danger" class="w-[90%]"
>Answers are not revealed yet, please wait until the end!</VaAlert
>
<VaAlert color="danger" class="w-[90%]">{{
t('pages.common.not_revealed')
}}</VaAlert>
<VaAlert v-if="error.statusCode !== 403" color="danger" class="w-[90%]">{{
error
}}</VaAlert
><VaButton
icon="arrow_back"
:to="$localePath(`/hunt/${sluggy($nuxt.$slugData.huntSlug!)}`)"
>Back to Hunt</VaButton
>{{ t('pages.common.back_to_hunt') }}</VaButton
>
</div>
<div
v-else
class="flex h-full w-full flex-col items-center justify-center text-center text-2xl"
>
<VaAlert color="danger" class="w-[90%]"
>Answers are not revealed yet, please wait until the end!</VaAlert
<VaAlert color="danger" class="w-[90%]">{{
t('pages.common.not_revealed')
}}</VaAlert
><VaButton
icon="arrow_back"
:to="$localePath(`/hunt/${sluggy($nuxt.$slugData.huntSlug!)}`)"
>Back to Hunt</VaButton
>{{ t('pages.common.back_to_hunt') }}</VaButton
>
</div>
</article>
+50 -33
View File
@@ -46,9 +46,9 @@ async function invite() {
<h1 class="text-2xl">
{{ data ? tKey(data, 'name') : name }}
<VaChip v-if="data?.totalScore" class="float-right" color="success"
>Total points: {{ data!!.totalScore }}</VaChip
>
<VaChip v-if="data?.totalScore" class="float-right" color="success">{{
t('page.hunt.total_points', data!!.totalScore)
}}</VaChip>
</h1>
<div class="grid w-full grid-cols-2 gap-2 sm:grid-cols-3 md:grid-cols-6">
<VaButton
@@ -56,7 +56,7 @@ async function invite() {
:disabled="pending"
title="Refresh"
@click="refresh"
>Refresh</VaButton
>{{ t('page.common.refresh') }}</VaButton
>
<VaButton
@@ -64,34 +64,34 @@ async function invite() {
color="success"
icon="leaderboard"
:to="$localePath(`/hunt/${tSluggy(data).value}/showcase`)"
>Showcase</VaButton
>{{ t('page.hunt.showcase') }}</VaButton
>
<VaButton
v-if="(data?.revealAnswers && data?.revealQuests) || data?.isMember"
color="success"
icon="collections"
:to="$localePath(`/hunt/${tSluggy(data).value}/diashow`)"
>Diashow</VaButton
>{{ t('page.hunt.diashow') }}</VaButton
>
<VaButton
v-if="(data?.revealAnswers && data?.revealQuests) || data?.isMember"
color="success"
icon="auto_awesome_mosaic"
:to="$localePath(`/hunt/${tSluggy(data).value}/pictures`)"
>All pictures</VaButton
>{{ t('page.hunt.all_pictures') }}</VaButton
>
<VaButton
v-if="data?.isMember"
color="danger"
icon="edit"
:to="$localePath(`/hunt/${tSluggy(data).value}/admin`)"
>Admin</VaButton
>{{ t('page.common.admin') }}</VaButton
><VaButton
v-if="data?.isMember"
color="danger"
icon="groups"
:to="$localePath(`/hunt/${tSluggy(data).value}/teams`)"
>Teams</VaButton
>{{ t('page.hunt.teams') }}</VaButton
>
</div>
<div v-if="data">
@@ -110,22 +110,34 @@ async function invite() {
:title="data ? tKey(data, 'name').value : name"
/>
<p v-if="data.start">
Start:
{{ d(data.start, fullDate) }}
{{
t('page.home.start', {
start: d(data.start, fullDate)
})
}}
</p>
<p v-if="data.end">
End:
{{ d(data.end, fullDate) }}
{{
t('page.home.end', {
start: d(data.end, fullDate)
})
}}
</p>
<p>
{{ data._count.teams }} teams joined{{
data.ownTeam !== null ? ', just like you' : ', unlike you'
}}!
{{
t(
data.ownTeam !== null
? 'page.hunt.team_count_joined'
: 'page.hunt.team_count',
data._count.teams
)
}}
</p>
<p v-if="data.ownTeam">
Your team: <span class="font-bold">{{ data.ownTeam.name }}</span>
{{ t('page.hunt.your_team') }}
<span class="font-bold">{{ data.ownTeam.name }}</span>
<VaButton size="small" class="ml-2" @click="invite"
>Invite:
>{{ t('page.hunt.invite') }}
<span
class="font-mono font-bold text-white blur transition hover:blur-none active:blur-none"
>
@@ -138,10 +150,10 @@ async function invite() {
color="primary"
class="mb-16 mt-8"
>
<VaCardTitle>Join this hunt!</VaCardTitle>
<VaCardContent class="text-2xl"
>To join this hunt you need to join or create a team:</VaCardContent
>
<VaCardTitle>{{ t('page.hunt.join_this_hunt') }}</VaCardTitle>
<VaCardContent class="text-2xl">{{
t('page.hunt.login_to_join')
}}</VaCardContent>
<VaCardActions v-if="data.loggedIn">
<TeamJoinModal :hunt-id="data.id" @update="refresh" />
<TeamAddModal :hunt-id="data.id" @update="refresh" />
@@ -151,12 +163,14 @@ async function invite() {
color="info"
icon="login"
:to="$localePath(`/login?to=/hunt/${tSluggy(data).value}`)"
>Login first</VaButton
>{{ t('page.common.login_first') }}</VaButton
>
</VaCardActions>
</VaCard>
<div v-else-if="!data.isMember" class="flex flex-row gap-2">
<VaSwitch v-model="hideAnswers" icon="image">Hide answers</VaSwitch>
<VaSwitch v-model="hideAnswers" icon="image">{{
t('page.hunt.hide_answers')
}}</VaSwitch>
</div>
<VaDivider />
<div
@@ -180,7 +194,7 @@ async function invite() {
<VaImage
v-if="!hideAnswers"
:src="quest?.answer?.picture?.url ?? ''"
fallback-text="No picture uploaded"
:fallback-text="t('page.hunt.no_picture_uploaded')"
class="h-32"
fit="cover"
lazy
@@ -205,7 +219,7 @@ async function invite() {
color="primary"
icon="rate_review"
class="flex-grow"
>Open</VaButton
>{{ t('page.common.open') }}</VaButton
>
<VaButton
v-if="data.isMember"
@@ -216,23 +230,26 @@ async function invite() {
`/hunt/${tSluggy(data).value}/${tSluggy(quest).value}/admin`
)
"
>Admin ({{ quest.unreviewed || 0 }} unreviewed)</VaButton
>{{
t('page.hunt.admin_unreviewed', quest.unreviewed || 0)
}}</VaButton
>
</VaCardActions>
</VaCard>
</div>
<VaCard v-else color="warning" class="mt-4"
><VaCardTitle>Quests not revealed yet!</VaCardTitle>
<VaCardContent
>Soon all {{ data._count.quests }} quests will be
revealed!</VaCardContent
>
><VaCardTitle>{{ t('page.hunt.quest_not_revealed') }}</VaCardTitle>
<VaCardContent>{{
t('page.hunt.quest_soon_reveal', data._count.quests)
}}</VaCardContent>
</VaCard>
</div>
<div v-if="error">
<h1 class="mt-8 text-3xl">{{ t(parseError(error)) }}</h1>
<VaButton icon="arrow_back" :to="$localePath(`/`)">Back home</VaButton>
<VaButton icon="arrow_back" :to="$localePath(`/`)">{{
t('page.common.back_home')
}}</VaButton>
</div>
</div>
</template>
+10 -9
View File
@@ -67,7 +67,7 @@ const { data, refresh, error } = await useFetch(`/api/hunt/${id}/diashow`, {
useHead({
title: t('layouts.two_title', {
title: hasKey(data.value, 'name') ? tKey(data.value!, 'name').value : name,
subtitle: 'Diashow'
subtitle: t('pages.pictures.head')
})
});
@@ -95,35 +95,36 @@ titleStore.title = data.value ? tKey(data.value, 'name').value : undefined;
v-if="data.count <= 0"
color="warning"
class="sm:col-span-2 md:col-span-3 lg:col-span-4"
>No pictures has been submitted yet :(</VaAlert
>{{ t('pages.common.no_pictures') }}</VaAlert
>
</div>
<div
v-else-if="error"
class="flex h-full w-full flex-col items-center justify-center text-center text-2xl"
>
<VaAlert color="danger" class="w-[90%]"
>Answers are not revealed yet, please wait until the end!</VaAlert
>
<VaAlert color="danger" class="w-[90%]">{{
t('pages.common.not_revealed')
}}</VaAlert>
<VaAlert v-if="error.statusCode !== 403" color="danger" class="w-[90%]">{{
error
}}</VaAlert
><VaButton
icon="arrow_back"
:to="$localePath(`/hunt/${sluggy($nuxt.$slugData.huntSlug!)}`)"
>Back to Hunt</VaButton
>{{ t('pages.common.back_to_hunt') }}</VaButton
>
</div>
<div
v-else
class="flex h-full w-full flex-col items-center justify-center text-center text-2xl"
>
<VaAlert color="danger" class="w-[90%]"
>Answers are not revealed yet, please wait until the end!</VaAlert
<VaAlert color="danger" class="w-[90%]">{{
t('pages.common.not_revealed')
}}</VaAlert
><VaButton
icon="arrow_back"
:to="$localePath(`/hunt/${sluggy($nuxt.$slugData.huntSlug!)}`)"
>Back to Hunt</VaButton
>{{ t('pages.common.back_to_hunt') }}</VaButton
>
</div>
</article>
+1 -1
View File
@@ -265,7 +265,7 @@ const columns = leaderboardColumns.map((c) =>
><VaButton
icon="arrow_back"
:to="$localePath(`/hunt/${sluggy($nuxt.$slugData.huntSlug!)}`)"
>Back to Hunt</VaButton
>{{ t('pages.common.back_to_hunt') }}</VaButton
>
</article>
</template>
+10 -12
View File
@@ -43,8 +43,7 @@ async function submitProfile() {
await fetch();
} catch (e) {
if (e instanceof Error && 'statusCode' in e && e.statusCode === 409) {
// ToDo: i18n
profileError.value = 'Email already exists!';
profileError.value = t('auth.conflict');
} else {
profileError.value = parseError(e);
}
@@ -72,8 +71,7 @@ async function submitPassword() {
password.old = '';
} catch (e) {
if (e instanceof Error && 'statusCode' in e && e.statusCode === 404) {
// ToDo: i18n
passwordError.value = 'Old password incorrect!';
passwordError.value = t('auth.old_invalid');
} else {
passwordError.value = parseError(e);
}
@@ -91,7 +89,7 @@ async function submitPassword() {
<div class="flex flex-col gap-4">
<VaInput
v-model="form.name"
label="Name"
:label="t('auth.name')"
clearable
:clear-value="data.name"
clearable-icon="replay"
@@ -107,7 +105,7 @@ async function submitPassword() {
/>
<VaInput
v-model="form.email"
label="Email"
:label="t('auth.email')"
type="email"
clearable
:clear-value="data.email"
@@ -129,7 +127,7 @@ async function submitPassword() {
color="success"
:disabled="!changed || pending || uploading"
@click="submitProfile"
>Update</VaButton
>{{ t('page.common.update_btn') }}</VaButton
>
</div>
</VaCardContent>
@@ -143,8 +141,8 @@ async function submitPassword() {
v-model="password.old"
class="w-full"
:type="isPasswordVisible.value ? 'text' : 'password'"
label="Old password"
:placeholder="t('auth.password')"
:label="t('pages.profile.old_password')"
:placeholder="t('pages.profile.old_password')"
autocomplete="current-password"
:minlength="8"
required
@@ -181,7 +179,7 @@ async function submitPassword() {
v-model="password.password"
class="w-full"
:type="isPasswordVisible.value ? 'text' : 'password'"
label="New password"
:label="t('pages.profile.new_password')"
:placeholder="t('auth.password')"
autocomplete="current-password"
:minlength="8"
@@ -236,7 +234,7 @@ async function submitPassword() {
</VaCardContent>
</VaCard>
<VaCard stripe stripe-color="primary">
<VaCardTitle>Uploaded pictures</VaCardTitle>
<VaCardTitle>{{ t('pages.profile.uploaded_pictures') }}</VaCardTitle>
<VaCardContent v-if="data && data.uploadedFiles.length > 0">
<VaCarousel
stateful
@@ -266,7 +264,7 @@ async function submitPassword() {
>
</VaCarousel>
</VaCardContent>
<VaCardContent v-else> No pictures uploaded yet. </VaCardContent>
<VaCardContent v-else>{{ t('pages.profile.no_pictures') }}</VaCardContent>
</VaCard>
</div>
</template>