✨ add german translation

This commit is contained in:
anbraten committed 2026-09-24 20:28:05 +02:00
1 parent 99a9f908f1
commit c78920ba6e
15 files changed
+3282 -4101

No files matched your search

+17 -12
View File
@@ -20,6 +20,8 @@ const emit = defineEmits<{
cancel: [];
}>();
const { t } = useI18n();
const description = ref(props.editing?.description ?? '');
const amount = ref(
props.editing ? fromCents(props.editing.amountCents).toString() : '',
@@ -45,15 +47,15 @@ function onSubmit() {
const amountCents = toCents(Number(amount.value));
if (!description.value.trim()) {
error.value = 'Description is required.';
error.value = t('expenseForm.errorDescriptionRequired');
return;
}
if (!Number.isFinite(amountCents) || amountCents <= 0) {
error.value = 'Enter a valid amount.';
error.value = t('expenseForm.errorInvalidAmount');
return;
}
if (selectedIds.value.length === 0) {
error.value = 'Select at least one participant to split with.';
error.value = t('expenseForm.errorSelectParticipant');
return;
}
@@ -75,7 +77,7 @@ function onSubmit() {
<label
for="description"
class="block text-sm font-medium text-stone-700 dark:text-stone-300"
>Description</label
>{{ t('expenseForm.descriptionLabel') }}</label
>
<input
id="description"
@@ -83,7 +85,7 @@ function onSubmit() {
type="text"
required
class="mt-1 block w-full rounded-xl border border-stone-300 bg-white px-3 py-2 text-base text-stone-900 shadow-sm placeholder:text-stone-400 focus:border-orange-400 focus:outline-none focus:ring-2 focus:ring-orange-200 dark:border-stone-700 dark:bg-stone-950 dark:text-stone-100 dark:placeholder:text-stone-500 dark:focus:ring-orange-900"
placeholder="Dinner, taxi, groceries…"
:placeholder="t('expenseForm.descriptionPlaceholder')"
/>
</div>
@@ -92,7 +94,7 @@ function onSubmit() {
for="amount"
class="block text-sm font-medium text-stone-700 dark:text-stone-300"
>
Amount ({{ currency }})
{{ t('expenseForm.amountLabel', { currency }) }}
</label>
<input
id="amount"
@@ -102,7 +104,7 @@ function onSubmit() {
min="0.01"
required
class="mt-1 block w-full rounded-xl border border-stone-300 bg-white px-3 py-2 text-base text-stone-900 shadow-sm placeholder:text-stone-400 focus:border-orange-400 focus:outline-none focus:ring-2 focus:ring-orange-200 dark:border-stone-700 dark:bg-stone-950 dark:text-stone-100 dark:placeholder:text-stone-500 dark:focus:ring-orange-900"
placeholder="0.00"
:placeholder="t('expenseForm.amountPlaceholder')"
/>
</div>
@@ -110,7 +112,7 @@ function onSubmit() {
<label
for="payer"
class="block text-sm font-medium text-stone-700 dark:text-stone-300"
>Paid by</label
>{{ t('expenseForm.paidByLabel') }}</label
>
<select
id="payer"
@@ -128,8 +130,9 @@ function onSubmit() {
</div>
<div>
<span class="block text-sm font-medium text-stone-700 dark:text-stone-300"
>Split equally among</span
<span
class="block text-sm font-medium text-stone-700 dark:text-stone-300"
>{{ t('expenseForm.splitEquallyLabel') }}</span
>
<div class="mt-2 flex flex-wrap gap-2">
<button
@@ -159,13 +162,15 @@ function onSubmit() {
class="flex-1 rounded-xl border border-stone-300 px-4 py-2 font-medium text-stone-700 dark:border-stone-700 dark:text-stone-300"
@click="emit('cancel')"
>
Cancel
{{ t('common.cancel') }}
</button>
<button
type="submit"
class="flex-1 rounded-xl bg-orange-500 px-4 py-2 font-medium text-white shadow-sm transition-colors hover:bg-orange-600 active:bg-orange-600"
>
{{ editing ? 'Save changes' : 'Add expense' }}
{{
editing ? t('expenseForm.saveChanges') : t('expenseForm.addExpense')
}}
</button>
</div>
</form>
+18 -13
View File
@@ -12,6 +12,7 @@ const props = defineProps<{
const emit = defineEmits<{ settled: []; updated: [] }>();
const { t } = useI18n();
const { lastLink, rememberLink } = usePaymentLinkCache();
const showSettlements = ref(false);
@@ -22,7 +23,9 @@ const editError = ref('');
const savingLink = ref(false);
function nameOf(id: number) {
return props.participants.find((p) => p.id === id)?.name ?? 'Unknown';
return (
props.participants.find((p) => p.id === id)?.name ?? t('common.unknown')
);
}
function paymentLinkOf(id: number) {
@@ -51,7 +54,7 @@ function cancelEdit() {
async function saveEdit(participant: ParticipantView) {
const trimmed = editValue.value.trim();
if (trimmed && !isValidPaymentLink(trimmed)) {
editError.value = 'Enter a valid link starting with http:// or https://.';
editError.value = t('balances.invalidLink');
return;
}
savingLink.value = true;
@@ -93,7 +96,7 @@ async function markSettled(settlement: SettlementView) {
v-if="participants.length === 0"
class="rounded-2xl border border-dashed border-stone-300 p-4 text-center text-sm text-stone-500 dark:border-stone-700 dark:text-stone-400"
>
No one's in this Pot yet. Add people from the settings page.
{{ t('balances.empty') }}
</p>
<ul v-else class="space-y-2">
@@ -131,7 +134,7 @@ async function markSettled(settlement: SettlementView) {
class="text-xs font-medium text-orange-600 hover:underline dark:text-orange-400"
@click.stop
>
Payment link
{{ t('balances.paymentLink') }}
</a>
<span
class="text-sm font-semibold"
@@ -145,7 +148,7 @@ async function markSettled(settlement: SettlementView) {
}"
>
<template v-if="(netBalances[participant.id] ?? 0) === 0">
settled up
{{ t('balances.settledUp') }}
</template>
<template v-else>
{{ (netBalances[participant.id] ?? 0) > 0 ? '+' : '−'
@@ -167,13 +170,13 @@ async function markSettled(settlement: SettlementView) {
<label
class="block text-xs font-medium text-stone-500 dark:text-stone-400"
>
Payment link for {{ participant.name }}
{{ t('balances.paymentLinkLabelFor', { name: participant.name }) }}
</label>
<div class="flex gap-2">
<input
v-model="editValue"
type="url"
placeholder="https://paypal.me/yourname"
:placeholder="t('balances.paymentLinkPlaceholder')"
class="block w-full rounded-xl border border-stone-300 bg-white px-3 py-2 text-sm text-stone-900 shadow-sm placeholder:text-stone-400 focus:border-orange-400 focus:outline-none focus:ring-2 focus:ring-orange-200 dark:border-stone-700 dark:bg-stone-950 dark:text-stone-100 dark:placeholder:text-stone-500 dark:focus:ring-orange-900"
@keyup.enter="saveEdit(participant)"
/>
@@ -183,14 +186,14 @@ async function markSettled(settlement: SettlementView) {
class="shrink-0 rounded-xl bg-orange-500 px-3 py-2 text-sm font-medium text-white shadow-sm transition-colors hover:bg-orange-600 disabled:opacity-50"
@click="saveEdit(participant)"
>
{{ savingLink ? 'Saving…' : 'Save' }}
{{ savingLink ? t('common.saving') : t('common.save') }}
</button>
<button
type="button"
class="shrink-0 rounded-xl border border-stone-300 px-3 py-2 text-sm font-medium text-stone-600 transition-colors hover:border-orange-300 hover:text-orange-600 dark:border-stone-700 dark:text-stone-300 dark:hover:border-orange-700 dark:hover:text-orange-400"
@click="cancelEdit"
>
Cancel
{{ t('common.cancel') }}
</button>
</div>
<p v-if="editError" class="text-xs text-rose-600 dark:text-rose-400">
@@ -206,7 +209,7 @@ async function markSettled(settlement: SettlementView) {
class="flex w-full items-center justify-between gap-2 text-sm font-medium text-orange-600 dark:text-orange-400"
@click="showSettlements = !showSettlements"
>
<span>Suggested payments</span>
<span>{{ t('balances.suggestedPayments') }}</span>
<svg
class="h-4 w-4 shrink-0 transition-transform"
:class="{ 'rotate-180': showSettlements }"
@@ -225,7 +228,7 @@ async function markSettled(settlement: SettlementView) {
v-if="showSettlements && settlements.length === 0"
class="text-sm text-stone-500 dark:text-stone-400"
>
Everyone is settled up.
{{ t('balances.allSettled') }}
</p>
<ul v-else-if="showSettlements" class="space-y-2">
<li
@@ -283,7 +286,7 @@ async function markSettled(settlement: SettlementView) {
rel="noopener noreferrer"
class="rounded-full border border-orange-300 px-3 py-1 text-xs font-medium text-orange-700 transition-colors hover:bg-white dark:border-orange-800 dark:text-orange-300 dark:hover:bg-stone-900"
>
Pay now
{{ t('balances.payNow') }}
</a>
<button
type="button"
@@ -292,7 +295,9 @@ async function markSettled(settlement: SettlementView) {
@click="markSettled(settlement)"
>
{{
settlingKey === keyOf(settlement) ? 'Marking…' : 'Mark as paid'
settlingKey === keyOf(settlement)
? t('balances.marking')
: t('balances.markAsPaid')
}}
</button>
</div>
+32 -13
View File
@@ -12,14 +12,22 @@ const emit = defineEmits<{
remove: [id: number];
}>();
const { t } = useI18n();
const expandedId = ref<number | null>(null);
function nameOf(id: number) {
return props.participants.find((p) => p.id === id)?.name ?? 'Unknown';
return (
props.participants.find((p) => p.id === id)?.name ?? t('common.unknown')
);
}
function namesOf(ids: number[]) {
return ids.map(nameOf).join(', ');
function splitOf(expense: ExpenseView) {
const shares = computeSplit(expense.amountCents, expense.participantIds);
return expense.participantIds.map((id) => ({
id,
name: nameOf(id),
amountCents: shares[id]!,
}));
}
function toggle(id: number) {
@@ -37,7 +45,7 @@ const sorted = computed(() =>
v-if="expenses.length === 0"
class="rounded-2xl border border-dashed border-stone-300 p-4 text-center text-sm text-stone-500 dark:border-stone-700 dark:text-stone-400"
>
No expenses yet. Add the first one below.
{{ t('expenses.empty') }}
</p>
<div
@@ -73,8 +81,12 @@ const sorted = computed(() =>
<p
class="truncate font-medium text-emerald-800 dark:text-emerald-300"
>
{{ nameOf(expense.payerId) }} paid
{{ nameOf(expense.participantIds[0]!) }}
{{
t('expenses.paymentDescription', {
payer: nameOf(expense.payerId),
recipient: nameOf(expense.participantIds[0]!),
})
}}
</p>
</div>
<div v-else class="min-w-0">
@@ -82,7 +94,7 @@ const sorted = computed(() =>
{{ expense.description }}
</p>
<p class="text-sm text-stone-500 dark:text-stone-400">
paid by {{ nameOf(expense.payerId) }}
{{ t('expenses.paidBy', { name: nameOf(expense.payerId) }) }}
</p>
</div>
<div class="flex shrink-0 items-center gap-2">
@@ -120,12 +132,19 @@ const sorted = computed(() =>
: 'border-stone-100 dark:border-stone-800'
"
>
<p
<ul
v-if="expense.type === 'expense'"
class="text-xs text-stone-400 dark:text-stone-500"
class="space-y-1 text-xs text-stone-400 dark:text-stone-500"
>
split among {{ namesOf(expense.participantIds) }}
</p>
<li
v-for="share in splitOf(expense)"
:key="share.id"
class="flex justify-between gap-2"
>
<span>{{ share.name }}</span>
<span>{{ formatCurrency(share.amountCents, currency) }}</span>
</li>
</ul>
<div class="flex gap-3">
<button
v-if="expense.type === 'expense'"
@@ -133,14 +152,14 @@ const sorted = computed(() =>
class="text-sm font-medium text-orange-600 dark:text-orange-400"
@click="emit('edit', expense)"
>
Edit
{{ t('expenses.edit') }}
</button>
<button
type="button"
class="text-sm font-medium text-rose-600 dark:text-rose-400"
@click="emit('remove', expense.id)"
>
Delete
{{ t('expenses.delete') }}
</button>
</div>
</div>
+4 -3
View File
@@ -1,6 +1,7 @@
<script setup lang="ts">
const props = defineProps<{ title?: string; buttonLabel?: string }>();
const emit = defineEmits<{ submit: [name: string] }>();
const { t } = useI18n();
const name = ref('');
@@ -17,7 +18,7 @@ function onSubmit() {
for="name"
class="block text-sm font-medium text-stone-700 dark:text-stone-300"
>
{{ props.title ?? "What's your name?" }}
{{ props.title ?? t('nameForm.defaultTitle') }}
</label>
<input
id="name"
@@ -26,14 +27,14 @@ function onSubmit() {
autocomplete="name"
required
class="mt-1 block w-full rounded-xl border border-stone-300 bg-white px-3 py-2 text-base text-stone-900 shadow-sm placeholder:text-stone-400 focus:border-orange-400 focus:outline-none focus:ring-2 focus:ring-orange-200 dark:border-stone-700 dark:bg-stone-900 dark:text-stone-100 dark:placeholder:text-stone-500 dark:focus:ring-orange-900"
placeholder="Your name"
:placeholder="t('nameForm.placeholder')"
/>
</div>
<button
type="submit"
class="w-full rounded-xl bg-orange-500 px-4 py-2 font-medium text-white shadow-sm transition-colors hover:bg-orange-600 active:bg-orange-600"
>
{{ props.buttonLabel ?? 'Continue' }}
{{ props.buttonLabel ?? t('nameForm.continue') }}
</button>
</form>
</template>