diff --git a/frontend/src/lib/components/sessions/chatbox.svelte b/frontend/src/lib/components/sessions/chatbox.svelte index e0c05d3f082cdaf457e00079bcd880983837fa1e..ae8206df8e2518a740678d33c3a84eda4bb0ae6b 100644 --- a/frontend/src/lib/components/sessions/chatbox.svelte +++ b/frontend/src/lib/components/sessions/chatbox.svelte @@ -6,7 +6,7 @@ import { Icon, PaperAirplane } from 'svelte-hero-icons'; import { toastAlert } from '$lib/utils/toasts'; import { get } from 'svelte/store'; - import Message from '$lib/types/message'; + import { _ } from '$lib/services/i18n'; let message = ''; export let session: Session; @@ -36,7 +36,7 @@ const m = await session.sendMessage(user, message); if (m === null) { - toastAlert('Failed to send message'); + toastAlert($_('chatbox.sendError')); return; } @@ -63,7 +63,7 @@ <div class="flex flex-row h-20"> <textarea class="flex-grow border-2 border-gray-300 rounded-md p-2 resize-none overflow-y-hidden" - placeholder="Send a message..." + placeholder={$_('chatbox.placeholder')} bind:value={message} on:keypress={async (e) => { if (e.key === 'Enter' && !e.shiftKey) { diff --git a/frontend/src/lib/components/sessions/editParticipants.svelte b/frontend/src/lib/components/sessions/editParticipants.svelte index e3656d01180cc7dcb7d687e5284f6d156bed3aa4..dd7f3f6903f886dd20da23ef7603e21d8c3edc75 100644 --- a/frontend/src/lib/components/sessions/editParticipants.svelte +++ b/frontend/src/lib/components/sessions/editParticipants.svelte @@ -2,11 +2,11 @@ import type Session from '$lib/types/session'; import type User from '$lib/types/user'; import { users } from '$lib/types/user'; - import TrashIcon from '$lib/components/icons/trashIcon.svelte'; import Select from 'svelte-select'; import { get } from 'svelte/store'; import { onMount } from 'svelte'; import { Icon, XMark } from 'svelte-hero-icons'; + import { _ } from '$lib/services/i18n'; export let session: Session; @@ -59,12 +59,12 @@ <div class="float-right w-8 hover:text-red-500 hover:cursor-pointer" on:click={onClose}> <Icon src={XMark} /> </div> - <h1 class="text-xl font-bold pb-4">Participants</h1> + <h1 class="text-xl font-bold pb-4">{$_('home.participants')}</h1> <table class="w-full shadow-md"> <thead class="bg-gray-200 uppercase text-sm"> <tr> - <th class="py-2 px-6">Username</th> - <th class="py-2 px-6">Actions</th> + <th class="py-2 px-6">{$_('home.username')}</th> + <th class="py-2 px-6">{$_('home.actions')}</th> </tr> </thead> {#each sessionUsers as user (user.id)} @@ -78,9 +78,14 @@ </tr> {/each} <tr class="text-center"> - <!-- <td><input bind:value={newParticipant} placeholder="Add new participant" /></td> --> - <td><Select items={dropDownUsers} bind:value={selected}></Select></td> - <td><button on:click={addParticipant} class="button">Ajouter</button></td> + <td + ><Select + items={dropDownUsers} + bind:value={selected} + placeholder={$_('home.participantPlaceholder')} + ></Select></td + > + <td><button on:click={addParticipant} class="button">{$_('home.add')}</button></td> </tr> </table> </div> diff --git a/frontend/src/lib/utils/date.ts b/frontend/src/lib/utils/date.ts index a51e1976e81ede5d406d0b0cae3634900d83bfa1..07166d79f90877108ed9ad0f49f77502d56a6efe 100644 --- a/frontend/src/lib/utils/date.ts +++ b/frontend/src/lib/utils/date.ts @@ -1,29 +1,32 @@ +import { _ } from '$lib/services/i18n'; +import { get } from 'svelte/store'; + export function getFullMonth(id: number): string { switch (id) { case 0: - return 'janvier'; + return get(_)('utils.month.january'); case 1: - return 'février'; + return get(_)('utils.month.february'); case 2: - return 'mars'; + return get(_)('utils.month.march'); case 3: - return 'avril'; + return get(_)('utils.month.april'); case 4: - return 'mai'; + return get(_)('utils.month.may'); case 5: - return 'juin'; + return get(_)('utils.month.june'); case 6: - return 'juillet'; + return get(_)('utils.month.july'); case 7: - return 'août'; + return get(_)('utils.month.august'); case 8: - return 'septembre'; + return get(_)('utils.month.september'); case 9: - return 'octobre'; + return get(_)('utils.month.october'); case 10: - return 'novembre'; + return get(_)('utils.month.november'); case 11: - return 'décembre'; + return get(_)('utils.month.december'); default: return '??'; } diff --git a/frontend/src/routes/+page.svelte b/frontend/src/routes/+page.svelte index 9615beaed118567adfd261caf55609edb02b4944..eaf6f1dcefdfa2fcd43bd7b7bd00d91ebf8b54a2 100644 --- a/frontend/src/routes/+page.svelte +++ b/frontend/src/routes/+page.svelte @@ -8,6 +8,7 @@ import { displayDate } from '$lib/utils/date'; import JWTSession from '$lib/stores/JWTSession'; import { Eye, EyeSlash, Icon, Trash, User } from 'svelte-hero-icons'; + import { _ } from '$lib/services/i18n'; let editParticipantsSession: Session | null; let ready = false; @@ -25,8 +26,7 @@ } async function deleteSession(session: Session) { - window.confirm('Are you sure you want to delete this session? All data will be lost!') && - (await session.delete()); + window.confirm($_('home.deleteSessionConirm')) && (await session.delete()); } async function disableSession(session: Session) { @@ -44,17 +44,17 @@ <div class="min-w-fit max-w-3xl m-auto p-0 mt-8"> {#if JWTSession.user()?.is_tutor} <button on:click|preventDefault={createSession} class="button float-end mb-4"> - Créer une nouvelle session + {$_('home.createSession')} </button> {/if} <table class="w-full shadow-md"> <thead class="bg-gray-200 uppercase text-sm"> <tr> <th class="py-2 px-6">#</th> - <th class="py-2 px-6">Date</th> - <th class="py-2 px-6">participants</th> + <th class="py-2 px-6">{$_('home.date')}</th> + <th class="py-2 px-6">{$_('home.participants')}</th> {#if JWTSession.user()?.is_tutor} - <th class="py-2 px-6">Actions</th> + <th class="py-2 px-6">{$_('home.actions')}</th> {/if} </tr> </thead> diff --git a/frontend/static/lang/en.json b/frontend/static/lang/en.json index 0cc241b209650058a3c2e822a71897b84df1179e..138eed36db2a3f643670632ed485fe6704ca34ba 100644 --- a/frontend/static/lang/en.json +++ b/frontend/static/lang/en.json @@ -2,5 +2,35 @@ "header": { "appName": "LanguageLab", "connectedAs": "Connected as" + }, + "chatbox": { + "placeholder": "Type your message here...", + "sendError": "Failed to send message" + }, + "home": { + "date": "Date", + "participants": "Participants", + "username": "Username", + "actions": "Actions", + "add": "Add", + "deleteSessionConfirm": "Are you sure you want to delete this session? This action cannot be undone.", + "createSession": "Create a new session", + "participantPlaceholder": "Please select" + }, + "utils": { + "month": { + "january": "january", + "february": "february", + "march": "march", + "april": "april", + "may": "may", + "june": "june", + "july": "july", + "august": "august", + "september": "september", + "october": "october", + "november": "november", + "december": "december" + } } } diff --git a/frontend/static/lang/fr.json b/frontend/static/lang/fr.json index 76b694acf0a178cebc5acb80d159a4ae65e23c41..7cd0664bc6b8c9894f4b6b9df1a03d4b7a11e004 100644 --- a/frontend/static/lang/fr.json +++ b/frontend/static/lang/fr.json @@ -2,5 +2,35 @@ "header": { "appName": "LanguageLab", "connectedAs": "Connecté en tant que" + }, + "chatbox": { + "placeholder": "Entrez votre message ici...", + "sendError": "Erreur lors de l'envoi du message" + }, + "home": { + "date": "Date", + "participants": "Participants", + "username": "Nom d'utilisateur", + "actions": "Actions", + "add": "Ajouter", + "deleteSessionConfirm": "Êtes-vous sûr de vouloir supprimer cette session ? Cette action est irréversible.", + "createSession": "Créer une nouvelle session", + "participantPlaceholder": "Selectionnez" + }, + "utils": { + "month": { + "january": "janvier", + "february": "février", + "march": "mars", + "april": "avril", + "may": "mai", + "june": "juin", + "july": "juillet", + "august": "août", + "september": "septembre", + "october": "octobre", + "november": "novembre", + "december": "décembre" + } } }