✨ add german translation
This commit is contained in:
15 files changed
+3282
-4101
No files matched your search
@@ -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>
|
||||
|
||||
Reference in new issue
Block a user