From 6cfcde3b584fe426f6d9a335f55b7108e11e761c Mon Sep 17 00:00:00 2001 From: Alexis <35.alexis.pele@gmail.com> Date: Tue, 3 Sep 2024 22:19:07 +0200 Subject: [PATCH] Added a bunch of translations on calendar components --- components/calendar/CalendarEventDetails.vue | 27 ++++-- components/calendar/CalendarMenu.vue | 2 +- components/calendar/CalendarMenuToday.vue | 14 +-- components/calendar/form/UpdateEvent.vue | 24 ++--- components/calendar/input/EventCategories.vue | 4 +- components/calendar/input/EventCategory.vue | 4 +- components/calendar/search/CalendarSearch.vue | 14 +-- .../calendar/search/lists/EventCallout.vue | 18 ++-- i18n.config.ts | 90 ++++++++++++++++++- nuxt.config.ts | 6 +- pages/my/calendars/[id].vue | 4 +- 11 files changed, 155 insertions(+), 52 deletions(-) diff --git a/components/calendar/CalendarEventDetails.vue b/components/calendar/CalendarEventDetails.vue index c09d045..5445968 100644 --- a/components/calendar/CalendarEventDetails.vue +++ b/components/calendar/CalendarEventDetails.vue @@ -87,8 +87,14 @@ function deployDeleteModal() { @@ -105,7 +111,8 @@ function deployDeleteModal() {

@@ -146,8 +153,8 @@ function deployDeleteModal() { - Modifier - Supprimer + {{ $t('ui.action.edit') }} + {{ $t('ui.action.delete') }} @@ -162,7 +169,7 @@ function deployDeleteModal() { title="Naviguer au début" @click="handleJumpToDate(event.startDate!)" > - Début + {{ $t('entity.calendar.event.isStart') }} @@ -171,7 +178,7 @@ function deployDeleteModal() { title="Naviguer à la fin" @click="handleJumpToDate(event.endDate!)" > - Fin + {{ $t('entity.calendar.event.isEnd') }} @@ -180,11 +187,13 @@ function deployDeleteModal() { - Évènement privé + {{ $t('entity.calendar.event.isHidden') }} -

Cet évènement est uniquement visible pour vous

+

+ {{ $t('entity.calendar.event.hiddenTooltip') }} +

diff --git a/components/calendar/CalendarMenu.vue b/components/calendar/CalendarMenu.vue index a606a76..ce2b3da 100644 --- a/components/calendar/CalendarMenu.vue +++ b/components/calendar/CalendarMenu.vue @@ -25,7 +25,7 @@ const { revealAdvancedSearch } = useCalendar()
  • - Recherche avancée + {{ $t('entity.advancedSearch.title') }}
  • diff --git a/components/calendar/CalendarMenuToday.vue b/components/calendar/CalendarMenuToday.vue index 855ef3b..b5a5d87 100644 --- a/components/calendar/CalendarMenuToday.vue +++ b/components/calendar/CalendarMenuToday.vue @@ -14,17 +14,9 @@ const isDefaultDate: ComputedRef = computed(() => areDatesIden - - - Aujourd'hui - - - - + + {{ $t('entity.calendar.date.today') }} +

    {{ defaultDateFormatted }}

    diff --git a/components/calendar/form/UpdateEvent.vue b/components/calendar/form/UpdateEvent.vue index 732e9e9..3e99007 100644 --- a/components/calendar/form/UpdateEvent.vue +++ b/components/calendar/form/UpdateEvent.vue @@ -70,10 +70,12 @@ function handleCancel() { @pointer-down-outside="(e) => e.preventDefault()" >
    - Modifier l'évènement + + {{ $t('entity.calendar.event.editDialog.title') }} + - Mettre à jour les données de l'évènement + {{ $t('entity.calendar.event.editDialog.subtitle') }}
    @@ -89,7 +91,7 @@ function handleCancel() { type="text" name="new-event-title" required - placeholder="Titre de l'évènement" + :placeholder="$t('entity.calendar.event.title')" class="w-full -my-1 py-1 -mx-1 px-1 text-lg border-b-[1px] bg-transparent focus-visible:outline-none focus-visible:border-blue-600" > @@ -100,7 +102,7 @@ function handleCancel() { id="new-event-description" v-model="eventSkeleton.description" name="new-event-description" - placeholder="Ajouter une description" + :placeholder="$t('entity.addDescription')" class="w-full -my-1 py-1 -mx-1 px-1 min-h-24 max-h-36 text-sm border-b-[1px] bg-transparent focus-visible:outline-none focus-visible:border-blue-600" /> @@ -111,7 +113,7 @@ function handleCancel() { @@ -120,7 +122,7 @@ function handleCancel() { @@ -155,7 +157,7 @@ function handleCancel() { v-model="eventSkeleton.location" type="text" name="new-event-location" - placeholder="Ajouter un endroit" + :placeholder="$t('entity.calendar.event.addLocation')" class="w-full -my-1 py-2 px-2 text-sm border-b-[1px] bg-transparent focus-visible:outline-none focus-visible:border-blue-600"> @@ -169,10 +171,10 @@ function handleCancel() { @@ -189,7 +191,7 @@ function handleCancel() {
    - Annuler + {{ $t('ui.action.cancel') }} @@ -198,7 +200,7 @@ function handleCancel() { - Enregistrer + {{ $t('ui.action.save') }}
    diff --git a/components/calendar/input/EventCategories.vue b/components/calendar/input/EventCategories.vue index 60792e4..32cee2d 100644 --- a/components/calendar/input/EventCategories.vue +++ b/components/calendar/input/EventCategories.vue @@ -60,8 +60,8 @@ const filteredCategories = computed(() => class="w-fit h-[33vh] p-0" > - - Aucune catégorie trouvée. + + {{ $t('entity.noCategoriesFound') }} class="w-fit h-[33vh] p-0" > - - Aucune catégorie trouvée. + + {{ $t('entity.noCategoriesFound') }} - Recherche avancée + {{ $t('entity.advancedSearch.title') }} - Rechercher les données disponibles sur le calendrier + {{ $t('entity.advancedSearch.title') }} @@ -256,7 +256,7 @@ function handleCategorySelect(e: (Category)) { id="search" v-model:model-value="searchQuery" type="text" - placeholder="Rechercher le calendrier" + :placeholder="$t('entity.advancedSearch.ctaPlaceholder')" class="pl-10 py-6 text-lg" autocomplete="off" /> @@ -274,10 +274,10 @@ function handleCategorySelect(e: (Category)) { @update:model-value="handleEntitySwitch()" > - Évènements + {{ $t('entity.calendar.event.namePlural') }} - Personnages + {{ $t('entity.character.namePlural') }} @@ -341,7 +341,7 @@ function handleCategorySelect(e: (Category)) { -

    Plus ancien

    +

    {{ $t('entity.advancedSearch.older') }}

    @@ -358,7 +358,7 @@ function handleCategorySelect(e: (Category)) { -

    Plus récent

    +

    {{ $t('entity.advancedSearch.newer') }}

    diff --git a/components/calendar/search/lists/EventCallout.vue b/components/calendar/search/lists/EventCallout.vue index 9c7e6cb..2d3965d 100644 --- a/components/calendar/search/lists/EventCallout.vue +++ b/components/calendar/search/lists/EventCallout.vue @@ -53,8 +53,14 @@ const dateDuration: string | null = props.event.endDate
    @@ -62,11 +68,13 @@ const dateDuration: string | null = props.event.endDate - Évènement privé + {{ $t('entity.calendar.event.isHidden') }} -

    Cet évènement est uniquement visible pour vous

    +

    + {{ $t('entity.calendar.event.hiddenTooltip') }} +

    @@ -84,7 +92,7 @@ const dateDuration: string | null = props.event.endDate

    diff --git a/i18n.config.ts b/i18n.config.ts index ff0400a..22cfb6f 100644 --- a/i18n.config.ts +++ b/i18n.config.ts @@ -11,7 +11,9 @@ export default defineI18nConfig(() => ({ action: { back: "Back", cancel: "Cancel", - save: "Save" + save: "Save", + delete: "Delete", + edit: "Edit", }, greeting: "Connected as {user}", sidebarMenu: { @@ -30,7 +32,17 @@ export default defineI18nConfig(() => ({ title: "Title" }, entity: { + searchCategories: "Search categories", + noCategoriesFound: "No categories found.", + addDescription: "Add a description", deleteOne: "Delete \"{entity}\"", + advancedSearch: { + title: "Advanced search", + subtitle: "Search through calendar and world data", + older: "Older", + newer: "Newer", + ctaPlaceholder: "Search an event, characters…" + }, world: { nameSingular: "World", namePlural: "Worlds", @@ -40,6 +52,33 @@ export default defineI18nConfig(() => ({ namePlural: "Calendars", addSingle: "Add a calendar", notFoundForWorld: "No calendar for this world… yet !", + isLoading: "Calendar is loading…", + date: { + start: "Start date", + end: "End date", + today: "Today", + fromTo: "From {startDate} to {endDate}", + while: "During {duration}", + }, + event: { + nameSingular: "Event", + namePlural: "Events", + title: "Event title", + isStart: "Start", + isEnd: "End", + isHidden: "Hidden event", + isPublic: "Public event", + hiddenTooltip: "This event is visible only to game masters.", + addLocation: "Add a place", + editDialog: { + title: "Edit event", + subtitle: "Update event data", + }, + deleteDialog: { + title: "Delete this event", + subtitle: "Data associated with this event will be lost and you won't be able to retrieve it !", + } + }, createDialog: { title: "New calendar", tabs: { @@ -73,6 +112,10 @@ export default defineI18nConfig(() => ({ chooseOne: "Choose a month", deleteOne: "Remove {month} from this calendar" } + }, + character: { + nameSingular: "Character", + namePlural: "Characters", } } }, @@ -85,7 +128,9 @@ export default defineI18nConfig(() => ({ action: { back: "Retour", cancel: "Annuler", - save: "Sauvegarder" + save: "Sauvegarder", + delete: "Supprimer", + edit: "Modifier", }, greeting: "Connecté en tant que {user}", sidebarMenu: { @@ -104,7 +149,17 @@ export default defineI18nConfig(() => ({ title: "Titre" }, entity: { + searchCategories: "Rechercher les catégories", + noCategoriesFound: "Aucune catégorie trouvée.", + addDescription: "Ajouter une description", deleteOne: "Supprimer \"{entity}\"", + advancedSearch: { + title: "Recherche avancée", + subtitle: "Rechercher les données disponibles sur le calendrier", + older: "Plus ancien", + newer: "Plus récent", + ctaPlaceholder: "Rechercher un évènement, personnage…" + }, world: { nameSingular: "Monde", namePlural: "Mondes", @@ -114,6 +169,33 @@ export default defineI18nConfig(() => ({ namePlural: "Calendrier", addSingle: "Ajouter un calendrier", notFoundForWorld: "Aucun calendrier pour ce monde… pour l'instant !", + isLoading: "Chargement du calendrier…", + date: { + start: "Date de début", + end: "Date de fin", + today: "Aujourd'hui", + fromTo: "Du {startDate} au {endDate}", + while: "Pendant {duration}", + }, + event: { + nameSingular: "Évènement", + namePlural: "Évènements", + title: "Titre de l'évènement", + isStart: "Début", + isEnd: "Fin", + isHidden: "Évènement privé", + isPublic: "Évènement public", + hiddenTooltip: "Cet évènement est uniquement visible pour les maîtres du jeu.", + addLocation: "Ajouter un endroit", + editDialog: { + title: "Modifier l'évènement", + subtitle: "Mettre à jour les données de l'évènement", + }, + deleteDialog: { + title: "Supprimer l'évènement", + subtitle: "Les données associés à cet évènement seront supprimées et vous ne pourrez plus les récupérer !", + } + }, createDialog: { title: "Nouveau calendrier", tabs: { @@ -148,6 +230,10 @@ export default defineI18nConfig(() => ({ chooseOne: "Choisir un mois", deleteOne: "Supprimer {month} du calendrier" } + }, + character: { + nameSingular: "Personnage", + namePlural: "Personnages", } } } diff --git a/nuxt.config.ts b/nuxt.config.ts index 69d1019..c825ff5 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -15,7 +15,11 @@ export default defineNuxtConfig({ css: ["~/assets/main.css"], i18n: { - vueI18n: "./i18n.config.ts" + vueI18n: "./i18n.config.ts", + detectBrowserLanguage: { + useCookie: true, + cookieKey: "tttools_lang" + }, }, supabase: { diff --git a/pages/my/calendars/[id].vue b/pages/my/calendars/[id].vue index cb2e603..4e7c657 100644 --- a/pages/my/calendars/[id].vue +++ b/pages/my/calendars/[id].vue @@ -32,7 +32,9 @@ const categories = computed(() => catData?.value?.data as Category[]
    -

    Chargement du calendrier

    +

    + {{ $t('entity.calendar.isLoading') }} +