Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Commit

Permalink
Translation (#72)
Browse files Browse the repository at this point in the history
* lisa tutorial

Co-authored-by: lisaress <[email protected]>

* translations costs and trip overview

* translations toasts

* add translations

* translated toast messages

---------

Co-authored-by: zimmerai <[email protected]>
Co-authored-by: Frecherenkel60 <[email protected]>
  • Loading branch information
3 people authored Jul 11, 2023
1 parent dbe4d63 commit b174a2f
Show file tree
Hide file tree
Showing 29 changed files with 281 additions and 84 deletions.
72 changes: 72 additions & 0 deletions languages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -236,5 +236,77 @@
"placeholder": "Was möchtest du uns mitteilen?",
"button": "Senden"
}
},
"tripOverview": {
"errorCode": "404",
"noTripsText": "Du hast noch keine Reisen angelegt",
"noTripsExplanation": "Bitte beginne mit dem Hinzufügen von Reisen, indem du auf die Schaltfläche in der oberen rechten Ecke klickst",
"headerTitle": "Deine Reisen",
"addTripButton": "Neue Reise hinzufügen",
"addTripModal": {
"title": "Neue Reise Anlegen",
"tripDetailsTitle": "Reiseinformationen",
"headline": "",
"nameFieldTitle": "Reisename",
"nameInField": "Gib einen Namen für deine Reise ein...",
"locationFieldTitle": "Reiseziel",
"locationInField": "Gib dein Reiseziel ein...",
"startDateFieldTitle": "Anfangsdatum",
"endDateFieldTitle": "Enddatum",
"backButton": "Zurück",
"nextButton": "Weiter",
"costCategoriesTitle": "Kostenkategorien hinzufügen",
"costCategoriesInField": "Erstelle deine eigenen Kostenkategorien...",
"colorChangeExplanation": "Klicke auf die Kategorie, um die Farbe zu ändern!",
"foodCategory": "Essen",
"mobilityCategory": "Mobilität",
"completeButton": "Abschließen",
"iviteParticitpatsTitle": "Weitere Teilnehmer einladen",
"iviteParticitpatsInField": "E-Mail oder Benutzernamen eingeben...",
"noResultsMessage": "Keine Ergebnisse gefunden."
},
"tripCard": {
"totalCost": "Gesamtkosten: ",
"location": "Reiseziel:",
"nothingToGet": "Nichts zu erhalten.",
"youGet": "Du bekommst noch",
"nothingToPay": "Nichts zu bezahlen.",
"youPay": "Noch zu zahlen sind: ",
"members": "Teilnehmer",
"noAccessMessage": "Kein Datenzugriff"
}
},
"costOverview": {
"headerTitle": "Dein Kostenüberblick",
"noCostsYet": {
"errorCode": "404",
"noCostsText": "Du hast noch keine Kosten",
"noCostsExplanation": "Du kannst mit dem Hinzufügen von Kosten beginnen, indem du eine Reise anlegst und Kosten hinzufügst.",
"createTripButton": "Reise erstellen"
},
"totalCosts": "Gesamtkosten",
"averageCosts": "Durchschnittliche Reisekosten",
"averageContributionToolTip": "Durchschnittlicher Prozentsatz der Ausgaben, den du zu jeder Reise beiträgst, berechnet auf der Grundlage deiner Gesamtbeiträge.",
"across": "bei",
"trip": "Reise",
"ending": "n",
"averageContribution": "Durchschnittlicher Beitragssatz",
"costDistribution": "Gesamtkostenaufteilung",
"tripDistribution": "Kostenverteilung nach Reisen",
"mostExpensiveTrip": "Teuerste Reise",
"leastExpensiveTrip": "Günstigste Reise"
},
"toast": {
"error": "Fehler: ",
"sentMessage": "Deine Nachricht wurde erfolgreich versendet!",
"resetPassword": "Ihr Passwort wurde erfolgreich zurückgesetzt!",
"costItem": "Die Kostenposition ",
"trip": "Die Reise ",
"transaction": "Die Transaktion ",
"deleted": " wurde erfolgreich gelöscht",
"created": " wurde erfolgreich erstellt",
"saved": " wurde erfolgreich gespeichert",
"confirmed": " wurde erfolgreich bestätigt",
"rejected": " wurde erfolgreich abgelehnt"
}
}
72 changes: 72 additions & 0 deletions languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -236,5 +236,77 @@
"placeholder": "Whatever you want to say...",
"button": "Send"
}
},
"tripOverview": {
"errorCode": "404",
"noTripsText": "You don't have any trips yet",
"noTripsExplanation": "Please start adding trips by clicking on the button in the top right corner",
"headerTitle": "Your Trips",
"addTripButton": "Add Trip",
"addTripModal": {
"title": "Add new Trip",
"tripDetailsTitle": "Trip Details",
"headline": "",
"nameFieldTitle": "Name",
"nameInField": "Enter name...",
"locationFieldTitle": "Location",
"locationInField": "Enter location...",
"startDateFieldTitle": "Start Date",
"endDateFieldTitle": "End Date",
"backButton": "Back",
"nextButton": "Next",
"costCategoriesTitle": "Add Cost Categories",
"costCategoriesInField": "Create your own cost category...",
"colorChangeExplanation": "You can change the color by clicking on the category!",
"foodCategory": "Food",
"mobilityCategory": "Mobility",
"completeButton": "Complete",
"iviteParticitpatsTitle": "Invite Participants",
"iviteParticitpatsInField": "Enter email or user name...",
"noResultsMessage": "No Results Found."
},
"tripCard": {
"totalCost": "Total Cost: ",
"location": "Location:",
"nothingToGet": "Nothing to get",
"youGet": "You will get ",
"nothingToPay": "Nothing to pay",
"youPay": "You still need to pay ",
"members": "Members",
"noAccessMessage": "No Access To Data"
}
},
"costOverview": {
"headerTitle": "Your Cost Overview",
"noCostsYet": {
"errorCode": "404",
"noCostsText": "You don't have any costs yet",
"noCostsExplanation": "You can start adding costs by creating a trip and adding costs to it.",
"createTripButton": "Create A Trip"
},
"totalCosts": "Total Costs",
"averageCosts": "Average Trip Costs",
"across": "across",
"averageContributionToolTip": "The average percentage of expenses you contribute to each trip, calculated based on your total contributions.",
"trip": "trip",
"ending": "s",
"averageContribution": "Average Contribution Percentage",
"costDistribution": "Cost Distribution",
"tripDistribution": "Trip Distribution",
"mostExpensiveTrip": "Most Expensive Trip",
"leastExpensiveTrip": "Least Expensive Trip"
},
"toast": {
"error": "Error: ",
"sentMessage": "Your message was sent successfully!",
"resetPassword": "Your password was successfully reset!",
"costItem": "The cost item ",
"trip": "The trip ",
"transaction": "The transaction",
"deleted": " was deleted successfully",
"created": " was created successfully",
"saved": " was saved successfully",
"confirmed": " was confirmed successfully",
"rejected": " was rejected successfully"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts">
import { ProgressRadial, popup, type PopupSettings } from '@skeletonlabs/skeleton';
import { i } from '@inlang/sdk-js';
export let averageContributionPercentage: string;
Expand All @@ -12,15 +13,14 @@

<div class="card p-4 w-64 variant-filled-surface" data-popup="popupHover">
<p>
The average percentage of expenses you contribute to each trip, calculated based on your total
contributions.
{i('costOverview.averageContributionToolTip')}
</p>
<div class="arrow variant-filled-surface" />
</div>

<div class="card rounded-lg shadow-md flex flex-col lg:flex-row-reverse items-center h-full">
<header class="card-header flex [&>*]:pointer-events-none" use:popup={popupHover}>
<h4 class="h4">Average contribution percentage</h4>
<h4 class="h4">{i('costOverview.averageContribution')}</h4>
</header>
<hr class="!border-t-2 mt-2" />
<ProgressRadial class="p-2" value={Number.parseFloat(averageContributionPercentage)}
Expand Down
11 changes: 7 additions & 4 deletions src/components/costOverview/_AverageTripCosts.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { formatCostString } from '$utils';
import { GlobeAmericas } from '@steeze-ui/heroicons';
import { Icon } from '@steeze-ui/svelte-icon';
import { i } from '@inlang/sdk-js';
export let costOverview: CostOverview;
Expand All @@ -11,7 +12,7 @@

<div class="card rounded-lg shadow-md">
<header class="card-header flex justify-center">
<h4 class="h4">Average trip costs</h4>
<h4 class="h4">{i('costOverview.averageCosts')}</h4>
</header>
<hr class="!border-t-2 mt-2" />
<section class="p-4">
Expand All @@ -22,9 +23,11 @@
<span
class="bg-gradient-to-br from-primary-800 to-primary-600 dark:from-primary-400 dark:to-primary-200 bg-clip-text text-transparent box-decoration-clone"
>
{formattedCost} € across {costOverview.tripDistribution.length} trip{costOverview
.tripDistribution.length > 1 || costOverview.tripDistribution.length === 0
? 's'
{formattedCost} € {i('costOverview.across')}
{costOverview.tripDistribution.length}
{i('costOverview.trip')}{costOverview.tripDistribution.length > 1 ||
costOverview.tripDistribution.length === 0
? i('costOverview.ending')
: ''}
</span>
</h5>
Expand Down
5 changes: 4 additions & 1 deletion src/components/costOverview/_TotalCosts.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
import { formatCostString } from '$utils';
import { Banknotes } from '@steeze-ui/heroicons';
import { Icon } from '@steeze-ui/svelte-icon';
import { i } from '@inlang/sdk-js';
export let totalCosts: string;
const formattedCost = formatCostString(totalCosts);
</script>

<div class="card rounded-lg shadow-md">
<header class="card-header flex justify-center"><h4 class="h4">Total costs</h4></header>
<header class="card-header flex justify-center">
<h4 class="h4">{i('costOverview.totalCosts')}</h4>
</header>
<hr class="!border-t-2 mt-2" />
<section class="p-4">
<div class="flex flex-row">
Expand Down
5 changes: 4 additions & 1 deletion src/components/costOverview/_TripAssociation.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { GlobeAsiaAustralia, GlobeEuropeAfrica } from '@steeze-ui/heroicons';
import { Icon } from '@steeze-ui/svelte-icon';
import { formatCostString } from '../../utils/cost/formatCostString';
import { i } from '@inlang/sdk-js';
export let costOverview: CostOverview;
export let leastExpensiveTrip: boolean;
Expand All @@ -11,7 +12,9 @@
? costOverview.leastExpensiveTrip
: costOverview.mostExpensiveTrip;
const title = leastExpensiveTrip ? 'Least expensive trip' : 'Most expensive trip';
const title = leastExpensiveTrip
? i('costOverview.leastExpensiveTrip')
: i('costOverview.mostExpensiveTrip');
const formattedCostString = formatCostString(trip.amount);
const icon = leastExpensiveTrip ? GlobeAsiaAustralia : GlobeEuropeAfrica;
</script>
Expand Down
2 changes: 1 addition & 1 deletion src/components/landingPage/_ContactBox.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
toast = {
background: 'variant-filled-success',
message: 'Your message was sent successfully!',
message: i('toast.sentMessage'),
autohide: true,
timeout: 5000
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
const successToast: ToastSettings = {
background: 'variant-filled-success',
message: 'Your password was successfully reset!',
message: i('toast.resetPassword'),
autohide: true,
timeout: 5000
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { modalStore, toastStore, type ToastSettings } from '@skeletonlabs/skeleton';
import { Check, XCircle } from '@steeze-ui/heroicons';
import { Icon } from '@steeze-ui/svelte-icon';
import { i } from '@inlang/sdk-js';
export let trip: TravelData;
export let currentUserId: string;
Expand Down Expand Up @@ -63,13 +64,13 @@
console.log(newTransaction);
await createTransaction(newTransaction);
let toastMessage = `Transaction created successfully`;
let toastMessage = i('toast.transaction') + i('toast.deleted');
if (!$errorState) {
invalidateAll();
modalStore.close();
} else {
let errorMessage: string = getErrorMessage($errorCode);
toastMessage = `Error: ${errorMessage}`;
toastMessage = i('toast.error') + errorMessage;
}
const t: ToastSettings = {
message: toastMessage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { getErrorMessage } from '$utils';
import { type ToastSettings, toastStore, modalStore } from '@skeletonlabs/skeleton';
import { errorCode, errorState, loading } from '$stores';
import { i } from '@inlang/sdk-js';
export let transaction: Transaction;
export let parent: any;
Expand Down Expand Up @@ -69,12 +70,12 @@
const confirmTransaction = async () => {
await postConfirmTransaction(transaction.trip.tripId, transaction.transactionId);
let toastMessage = `Transaction confirmed successfully`;
let toastMessage = i('toast.transaction') + i('toast.confirmed');
if (!$errorState) {
await invalidateAll();
} else {
let errorMessage: string = getErrorMessage($errorCode);
toastMessage = `Error: ${errorMessage}`;
toastMessage = i('toast.error') + errorMessage;
}
modalStore.close();
const t: ToastSettings = {
Expand All @@ -87,12 +88,12 @@
const rejectTransaction = async () => {
await postRejectTransaction(transaction.trip.tripId, transaction.transactionId);
let toastMessage = `Transaction rejected successfully`;
let toastMessage = i('toast.transaction') + i('toast.rejected');
if (!$errorState) {
await invalidateAll();
} else {
let errorMessage: string = getErrorMessage($errorCode);
toastMessage = `Error: ${errorMessage}`;
toastMessage = i('toast.error') + errorMessage;
}
modalStore.close();
const t: ToastSettings = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import { ArrowLongRight } from '@steeze-ui/heroicons';
import { Icon } from '@steeze-ui/svelte-icon';
import { errorCode, errorState } from '$stores';
import { i } from '@inlang/sdk-js';
export let transaction: Transaction;
export let needsConfirmation: boolean;
Expand Down Expand Up @@ -58,13 +59,13 @@
const onDeleteTransaction = async (transactionId: string, tripId: string) => {
const result = await deleteTransaction(transactionId, tripId);
let toastMessage = `Transaction deleted successfully`;
let toastMessage = i('toast.transaction') + transactionId + i('toast.deleted');
if (!$errorState) {
invalidateAll();
modalStore.close();
} else {
let errorMessage: string = getErrorMessage($errorCode);
toastMessage = `Error: ${errorMessage}`;
toastMessage = i('toast.error') + errorMessage;
}
modalStore.close();
const t: ToastSettings = {
Expand Down
5 changes: 3 additions & 2 deletions src/components/tripDetails/Modal/_AddNewCostItemModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
toastStore,
type ToastSettings
} from '@skeletonlabs/skeleton';
import { i } from '@inlang/sdk-js';
export let trip: TravelData;
Expand Down Expand Up @@ -103,13 +104,13 @@
async function onFormSubmit(): Promise<void> {
await createCost(cost, trip, costPaidForUser);
let toastMessage = `Cost ${cost.name} created successfully`;
let toastMessage = i('toast.costItem') + cost.name + i('toast.created');
if (!$errorState) {
invalidateAll();
modalStore.close();
} else {
let errorMessage: string = getErrorMessage($errorCode);
toastMessage = `Error: ${errorMessage}`;
toastMessage = i('toast.error') + errorMessage;
}
const t: ToastSettings = {
message: toastMessage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import { modalStore, toastStore, type ToastSettings } from '@skeletonlabs/skeleton';
import { Pencil, Trash } from '@steeze-ui/heroicons';
import { Icon } from '@steeze-ui/svelte-icon';
import { i } from '@inlang/sdk-js';
/* export let name: string; */
export let cost: Cost;
Expand Down Expand Up @@ -119,8 +120,8 @@
const result = await updateCost(localeCost, trip, costPaidForUser);
const message = result.error
? `Error: ${getErrorMessage(result.errorCode)}`
: `Cost ${result.data.description} saved successfully`;
? i('toast.error') + getErrorMessage(result.errorCode)
: i('toast.costItem') + result.data.description + i('toast.saved');
const t: ToastSettings = {
message: message,
background: result.error ? 'variant-filled-warning' : 'variant-filled-success'
Expand Down
Loading

0 comments on commit b174a2f

Please sign in to comment.