Skip to content

Commit 1e77eeb

Browse files
committed
add missing translations
1 parent 9ed28ab commit 1e77eeb

18 files changed

Lines changed: 150 additions & 30 deletions

File tree

src/_common/business/rower.rules.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { v4 } from "uuid";
22
import { forEnum } from "../utils/utils";
33
import { SeriousnessCategoryEnum } from "./seriousness.rules";
44
import { AgeCategoryEnum } from "./ageCategory.rules";
5+
import i18n from "../i18n/config";
56

67
/**
78
* ----- Typing -----
@@ -25,11 +26,11 @@ export const generateRowerId = () => {
2526

2627
export const getRowerTypeLabel = (rowerType: Rower["type"]) => {
2728
if (rowerType === undefined) {
28-
return "Non renseigné";
29+
return i18n.t("session.typeNotSpecified");
2930
}
3031

3132
return forEnum(rowerType, {
32-
competitor: () => "Compétiteur",
33-
recreational: () => "Loisir",
33+
competitor: () => i18n.t("seriousness.competitor"),
34+
recreational: () => i18n.t("seriousness.recreational"),
3435
});
3536
};

src/_common/business/seriousness.rules.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import i18n from "../i18n/config";
2+
13
export const findSeriousnessCategoryOrder = (
24
seriousnessCategory: SeriousnessCategoryEnum | null | undefined
35
) => {
@@ -14,26 +16,28 @@ export enum SeriousnessCategoryEnum {
1416
export const getSeriousnessTypeTranslation = (
1517
type: SeriousnessCategoryEnum | null | undefined
1618
): string | null => {
17-
return (
18-
SERIOUSNESS_CATEGORIES.find((t) => t.type === type)?.label || type || null
19-
);
19+
const category = SERIOUSNESS_CATEGORIES.find((t) => t.type === type);
20+
if (!category?.translationKey) {
21+
return type || null;
22+
}
23+
return i18n.t(category.translationKey);
2024
};
2125

2226
export const SERIOUSNESS_CATEGORIES = [
2327
{
2428
order: 0,
2529
type: null,
26-
label: null,
30+
translationKey: null,
2731
},
2832
{
2933
order: 1,
3034
type: SeriousnessCategoryEnum.RECREATIONAL,
31-
label: "Loisir",
35+
translationKey: "seriousness.recreational",
3236
},
3337
{
3438
order: 2,
3539
type: SeriousnessCategoryEnum.COMPETITOR,
36-
label: "Compétiteur",
40+
translationKey: "seriousness.competitor",
3741
},
3842
] as const;
3943

src/_common/database/database.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import Database from "@tauri-apps/plugin-sql";
22
import { toast } from "sonner";
33
import { applyMigrations } from "./migrations";
44
import { getDrizzle } from "./drizzle";
5+
import i18n from "../i18n/config";
56

67
let db: Database | null = null;
78

@@ -19,7 +20,7 @@ export const getDatabase = async () => {
1920
return { db, drizzle };
2021
} catch (e) {
2122
console.error(e);
22-
toast.error("Failed to load database");
23+
toast.error(i18n.t("database.failedToLoad"));
2324
throw e;
2425
}
2526
};

src/_common/i18n/locales/de-DE.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,16 @@
129129
"invalidRowersLevel_one": "<0>1</0> Ruderer hat nicht das erforderliche Niveau für dieses Boot.",
130130
"invalidRowersLevel_other": "<0>{{count}}</0> Ruderer haben nicht das erforderliche Niveau für dieses Boot.",
131131
"fixInformation": "Informationen korrigieren"
132-
}
132+
},
133+
"noRowersRecorded": "Für diese Sitzung wurden keine Ruderer aufgezeichnet. Wenn dies ein Fehler ist, wenden Sie sich bitte an den Support."
133134
},
134135
"logbook": {
135136
"title": "Logbuch",
136137
"sessions": "Sitzungen",
137138
"incidents": "Vorfälle",
138139
"noSessions": "Noch keine Sitzungen registriert",
139140
"noIncidents": "Noch keine Vorfälle registriert",
141+
"noSessionsFound": "Keine Sitzungen mit diesen Filtern gefunden",
140142
"exportSessions": "Sitzungen exportieren",
141143
"date": "Datum",
142144
"boat": "Boot",
@@ -352,5 +354,20 @@
352354
"hours": "Stunden",
353355
"minutes": "Minuten",
354356
"seconds": "Sekunden"
357+
},
358+
"admin": {
359+
"password": "Admin-Passwort",
360+
"incorrectPassword": "Falsches Passwort"
361+
},
362+
"seriousness": {
363+
"recreational": "Freizeit",
364+
"competitor": "Wettbewerber"
365+
},
366+
"import": {
367+
"invalidFile": "Die Datei enthält keine gültigen Daten. Validierungsfehler:",
368+
"exportError": "Fehler beim Export"
369+
},
370+
"database": {
371+
"failedToLoad": "Fehler beim Laden der Datenbank"
355372
}
356373
}

src/_common/i18n/locales/en-GB.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,16 @@
129129
"invalidRowersLevel_one": "<0>1</0> rower does not have the required level for this boat.",
130130
"invalidRowersLevel_other": "<0>{{count}}</0> rowers do not have the required level for this boat.",
131131
"fixInformation": "Correct information"
132-
}
132+
},
133+
"noRowersRecorded": "No rowers were recorded for this session. If this is an error, please contact support."
133134
},
134135
"logbook": {
135136
"title": "Logbook",
136137
"sessions": "Sessions",
137138
"incidents": "Incidents",
138139
"noSessions": "No sessions registered yet",
139140
"noIncidents": "No incidents registered yet",
141+
"noSessionsFound": "No sessions found with these filters",
140142
"exportSessions": "Export sessions",
141143
"date": "Date",
142144
"boat": "Boat",
@@ -352,5 +354,20 @@
352354
"hours": "hours",
353355
"minutes": "minutes",
354356
"seconds": "seconds"
357+
},
358+
"admin": {
359+
"password": "Admin password",
360+
"incorrectPassword": "Incorrect password"
361+
},
362+
"seriousness": {
363+
"recreational": "Recreational",
364+
"competitor": "Competitor"
365+
},
366+
"import": {
367+
"invalidFile": "The file does not contain valid data. Validation error:",
368+
"exportError": "Error during export"
369+
},
370+
"database": {
371+
"failedToLoad": "Failed to load database"
355372
}
356373
}

src/_common/i18n/locales/en-US.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,16 @@
129129
"invalidRowersLevel_one": "<0>1</0> rower does not have the required level for this boat.",
130130
"invalidRowersLevel_other": "<0>{{count}}</0> rowers do not have the required level for this boat.",
131131
"fixInformation": "Fix information"
132-
}
132+
},
133+
"noRowersRecorded": "No rowers were recorded for this session. If this is an error, please contact support."
133134
},
134135
"logbook": {
135136
"title": "Logbook",
136137
"sessions": "Sessions",
137138
"incidents": "Incidents",
138139
"noSessions": "No sessions registered yet",
139140
"noIncidents": "No incidents registered yet",
141+
"noSessionsFound": "No sessions found with these filters",
140142
"exportSessions": "Export sessions",
141143
"date": "Date",
142144
"boat": "Boat",
@@ -352,5 +354,20 @@
352354
"hours": "hours",
353355
"minutes": "minutes",
354356
"seconds": "seconds"
357+
},
358+
"admin": {
359+
"password": "Admin password",
360+
"incorrectPassword": "Incorrect password"
361+
},
362+
"seriousness": {
363+
"recreational": "Recreational",
364+
"competitor": "Competitor"
365+
},
366+
"import": {
367+
"invalidFile": "The file does not contain valid data. Validation error:",
368+
"exportError": "Error during export"
369+
},
370+
"database": {
371+
"failedToLoad": "Failed to load database"
355372
}
356373
}

src/_common/i18n/locales/fr-FR.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,16 @@
129129
"invalidRowersLevel_one": "<0>1</0> rameur n'a pas le niveau requis pour ce bateau.",
130130
"invalidRowersLevel_other": "<0>{{count}}</0> rameurs n'ont pas le niveau requis pour ce bateau.",
131131
"fixInformation": "Corriger les informations"
132-
}
132+
},
133+
"noRowersRecorded": "Aucun rameur n'a été enregistré pour cette session. Si c'est une erreur, veuillez contacter le support."
133134
},
134135
"logbook": {
135136
"title": "Journal de bord",
136137
"sessions": "Sessions",
137138
"incidents": "Incidents",
138139
"noSessions": "Aucune session enregistrée pour le moment",
139140
"noIncidents": "Aucun incident enregistré pour le moment",
141+
"noSessionsFound": "Aucune session trouvée avec ces filtres",
140142
"exportSessions": "Exporter les sessions",
141143
"date": "Date",
142144
"boat": "Bateau",
@@ -352,5 +354,20 @@
352354
"hours": "heures",
353355
"minutes": "minutes",
354356
"seconds": "secondes"
357+
},
358+
"admin": {
359+
"password": "Mot de passe admin",
360+
"incorrectPassword": "Mot de passe incorrect"
361+
},
362+
"seriousness": {
363+
"recreational": "Loisir",
364+
"competitor": "Compétiteur"
365+
},
366+
"import": {
367+
"invalidFile": "Le fichier ne contient pas de données valides. Erreur de validation :",
368+
"exportError": "Erreur lors de l'export"
369+
},
370+
"database": {
371+
"failedToLoad": "Échec du chargement de la base de données"
355372
}
356373
}

src/_common/i18n/locales/it-IT.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,16 @@
129129
"invalidRowersLevel_one": "<0>1</0> vogatore non ha il livello richiesto per questa barca.",
130130
"invalidRowersLevel_other": "<0>{{count}}</0> vogatori non hanno il livello richiesto per questa barca.",
131131
"fixInformation": "Correggi informazioni"
132-
}
132+
},
133+
"noRowersRecorded": "Nessun vogatore è stato registrato per questa sessione. Se questo è un errore, contattare il supporto."
133134
},
134135
"logbook": {
135136
"title": "Giornale di bordo",
136137
"sessions": "Sessioni",
137138
"incidents": "Incidenti",
138139
"noSessions": "Ancora nessuna sessione registrata",
139140
"noIncidents": "Ancora nessun incidente registrato",
141+
"noSessionsFound": "Nessuna sessione trovata con questi filtri",
140142
"exportSessions": "Esporta sessioni",
141143
"date": "Data",
142144
"boat": "Barca",
@@ -352,5 +354,20 @@
352354
"hours": "ore",
353355
"minutes": "minuti",
354356
"seconds": "secondi"
357+
},
358+
"admin": {
359+
"password": "Password amministratore",
360+
"incorrectPassword": "Password errata"
361+
},
362+
"seriousness": {
363+
"recreational": "Ricreativo",
364+
"competitor": "Competitore"
365+
},
366+
"import": {
367+
"invalidFile": "Il file non contiene dati validi. Errore di validazione:",
368+
"exportError": "Errore durante l'esportazione"
369+
},
370+
"database": {
371+
"failedToLoad": "Impossibile caricare il database"
355372
}
356373
}

src/_common/i18n/locales/nl-NL.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,16 @@
129129
"invalidRowersLevel_one": "<0>1</0> roeier heeft niet het vereiste niveau voor deze boot.",
130130
"invalidRowersLevel_other": "<0>{{count}}</0> roeiers hebben niet het vereiste niveau voor deze boot.",
131131
"fixInformation": "Informatie corrigeren"
132-
}
132+
},
133+
"noRowersRecorded": "Er zijn geen roeiers geregistreerd voor deze sessie. Als dit een fout is, neem dan contact op met de ondersteuning."
133134
},
134135
"logbook": {
135136
"title": "Logboek",
136137
"sessions": "Sessies",
137138
"incidents": "Incidenten",
138139
"noSessions": "Nog geen sessies geregistreerd",
139140
"noIncidents": "Nog geen incidenten geregistreerd",
141+
"noSessionsFound": "Geen sessies gevonden met deze filters",
140142
"exportSessions": "Sessies exporteren",
141143
"date": "Datum",
142144
"boat": "Boot",
@@ -352,5 +354,20 @@
352354
"hours": "uren",
353355
"minutes": "minuten",
354356
"seconds": "seconden"
357+
},
358+
"admin": {
359+
"password": "Beheerderswachtwoord",
360+
"incorrectPassword": "Onjuist wachtwoord"
361+
},
362+
"seriousness": {
363+
"recreational": "Recreatief",
364+
"competitor": "Wedstrijdroeier"
365+
},
366+
"import": {
367+
"invalidFile": "Het bestand bevat geen geldige gegevens. Validatiefout:",
368+
"exportError": "Fout tijdens exporteren"
369+
},
370+
"database": {
371+
"failedToLoad": "Kan database niet laden"
355372
}
356373
}

src/_common/store/adminEditMode.system.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { adminEditModeStore } from "./adminEditMode.store";
33
import { useClubOverviewStore } from "./clubOverview.store";
44
import { closeApp, windowPrompt } from "../utils/window.utils";
55
import { hashPassword, verifyPassword } from "../utils/password";
6+
import i18n from "../i18n/config";
67

78
export const useAdminEditModeSystem = () => {
89
const store = adminEditModeStore();
@@ -45,7 +46,7 @@ export const useAdminEditModeSystem = () => {
4546
};
4647

4748
const wrongAdminPassword = () => {
48-
toast.error("Mot de passe incorrect");
49+
toast.error(i18n.t("admin.incorrectPassword"));
4950
};
5051

5152
const askForAdminAccess = async (pswd?: string | null): Promise<boolean> => {
@@ -77,5 +78,5 @@ export const useAdminEditModeSystem = () => {
7778
};
7879

7980
export const askForAdminPassword = () => {
80-
return windowPrompt("Mot de passe admin");
81+
return windowPrompt(i18n.t("admin.password"));
8182
};

0 commit comments

Comments
 (0)