Added a bunch of translations on calendar components

This commit is contained in:
Alexis
2024-09-03 22:19:07 +02:00
parent 6fee4c7158
commit 6cfcde3b58
11 changed files with 155 additions and 52 deletions

View File

@@ -87,8 +87,14 @@ function deployDeleteModal() {
</template> </template>
<template v-else> <template v-else>
<p class="font-semibold"> <p class="font-semibold">
Du {{ getFormattedDateTitle(event.startDate, true) }} au {{
{{ getFormattedDateTitle(event.endDate, true) }} $t('entity.calendar.date.fromTo',
{
startDate: getFormattedDateTitle(event.startDate, true),
endDate: getFormattedDateTitle(event.endDate, true)
}
)
}}
</p> </p>
</template> </template>
</div> </div>
@@ -105,7 +111,8 @@ function deployDeleteModal() {
</p> </p>
<template v-if="dateDuration"> <template v-if="dateDuration">
<p class="text-sm italic dark:opacity-75 flex items-center gap-1"> <p class="text-sm italic dark:opacity-75 flex items-center gap-1">
<PhHourglassMedium size="16" weight="fill" /> Pendant {{ dateDuration }} <PhHourglassMedium size="16" weight="fill" />
{{ $t('entity.calendar.date.while', { duration: dateDuration } )}}
</p> </p>
</template> </template>
</div> </div>
@@ -146,8 +153,8 @@ function deployDeleteModal() {
<UiCommand> <UiCommand>
<UiCommandList> <UiCommandList>
<UiCommandGroup> <UiCommandGroup>
<UiCommandItem value="edit-event" @select="deployEditModal"> Modifier </UiCommandItem> <UiCommandItem value="edit-event" @select="deployEditModal"> {{ $t('ui.action.edit') }} </UiCommandItem>
<UiCommandItem value="delete-event" @select="deployDeleteModal"> Supprimer </UiCommandItem> <UiCommandItem value="delete-event" @select="deployDeleteModal"> {{ $t('ui.action.delete') }} </UiCommandItem>
</UiCommandGroup> </UiCommandGroup>
</UiCommandList> </UiCommandList>
</UiCommand> </UiCommand>
@@ -162,7 +169,7 @@ function deployDeleteModal() {
title="Naviguer au début" title="Naviguer au début"
@click="handleJumpToDate(event.startDate!)" @click="handleJumpToDate(event.startDate!)"
> >
<PhHourglassHigh size="16" weight="fill" /> Début <PhHourglassHigh size="16" weight="fill" /> {{ $t('entity.calendar.event.isStart') }}
</button> </button>
</UiBadge> </UiBadge>
<UiBadge class="hover:bg-indigo-400 dark:hover:bg-slate-300" as-child title="Naviguer à la fin"> <UiBadge class="hover:bg-indigo-400 dark:hover:bg-slate-300" as-child title="Naviguer à la fin">
@@ -171,7 +178,7 @@ function deployDeleteModal() {
title="Naviguer à la fin" title="Naviguer à la fin"
@click="handleJumpToDate(event.endDate!)" @click="handleJumpToDate(event.endDate!)"
> >
<PhHourglassLow size="16" weight="fill" /> Fin <PhHourglassLow size="16" weight="fill" /> {{ $t('entity.calendar.event.isEnd') }}
</button> </button>
</UiBadge> </UiBadge>
</nav> </nav>
@@ -180,11 +187,13 @@ function deployDeleteModal() {
<UiTooltip> <UiTooltip>
<UiTooltipTrigger as-child> <UiTooltipTrigger as-child>
<UiBadge class="absolute -top-2 right-2 flex gap-1"> <UiBadge class="absolute -top-2 right-2 flex gap-1">
<PhEye size="16" weight="fill" /> Évènement privé <PhEye size="16" weight="fill" /> {{ $t('entity.calendar.event.isHidden') }}
</UiBadge> </UiBadge>
</UiTooltipTrigger> </UiTooltipTrigger>
<UiTooltipContent> <UiTooltipContent>
<p>Cet évènement est uniquement visible pour vous</p> <p>
{{ $t('entity.calendar.event.hiddenTooltip') }}
</p>
</UiTooltipContent> </UiTooltipContent>
</UiTooltip> </UiTooltip>
</UiTooltipProvider> </UiTooltipProvider>

View File

@@ -25,7 +25,7 @@ const { revealAdvancedSearch } = useCalendar()
<li> <li>
<UiButton search-slash @click="revealAdvancedSearch()"> <UiButton search-slash @click="revealAdvancedSearch()">
<PhMagnifyingGlass size="20" weight="light" /> <PhMagnifyingGlass size="20" weight="light" />
Recherche avancée {{ $t('entity.advancedSearch.title') }}
</UiButton> </UiButton>
</li> </li>
<li> <li>

View File

@@ -14,17 +14,9 @@ const isDefaultDate: ComputedRef<boolean> = computed<boolean>(() => areDatesIden
<UiTooltipProvider :delay-duration="250"> <UiTooltipProvider :delay-duration="250">
<UiTooltip> <UiTooltip>
<UiTooltipTrigger as-child> <UiTooltipTrigger as-child>
<ClientOnly>
<UiButton size="sm" :disabled="isDefaultDate" @click="jumpToDefaultDate"> <UiButton size="sm" :disabled="isDefaultDate" @click="jumpToDefaultDate">
Aujourd'hui {{ $t('entity.calendar.date.today') }}
</UiButton> </UiButton>
<template #fallback>
<UiButton size="sm">
Aujourd'hui
</UiButton>
</template>
</ClientOnly>
</UiTooltipTrigger> </UiTooltipTrigger>
<UiTooltipContent> <UiTooltipContent>
<p>{{ defaultDateFormatted }}</p> <p>{{ defaultDateFormatted }}</p>

View File

@@ -70,10 +70,12 @@ function handleCancel() {
@pointer-down-outside="(e) => e.preventDefault()" @pointer-down-outside="(e) => e.preventDefault()"
> >
<header class="pl-8 grid gap-y-2"> <header class="pl-8 grid gap-y-2">
<UiDialogTitle> Modifier l'évènement</UiDialogTitle> <UiDialogTitle>
{{ $t('entity.calendar.event.editDialog.title') }}
</UiDialogTitle>
<UiDialogDescription> <UiDialogDescription>
Mettre à jour les données de l'évènement {{ $t('entity.calendar.event.editDialog.subtitle') }}
</UiDialogDescription> </UiDialogDescription>
</header> </header>
@@ -89,7 +91,7 @@ function handleCancel() {
type="text" type="text"
name="new-event-title" name="new-event-title"
required 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" 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"
> >
</div> </div>
@@ -100,7 +102,7 @@ function handleCancel() {
id="new-event-description" id="new-event-description"
v-model="eventSkeleton.description" v-model="eventSkeleton.description"
name="new-event-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" 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"
/> />
</div> </div>
@@ -111,7 +113,7 @@ function handleCancel() {
<CalendarInputRPGDate <CalendarInputRPGDate
v-model:model-value="eventSkeleton.startDate" v-model:model-value="eventSkeleton.startDate"
placeholder="Date de début" :placeholder="$t('entity.calendar.date.start')"
:initial-date="lastActiveEvent?.startDate" :initial-date="lastActiveEvent?.startDate"
:required="true" :required="true"
/> />
@@ -120,7 +122,7 @@ function handleCancel() {
<CalendarInputRPGDate <CalendarInputRPGDate
v-model:model-value="eventSkeleton.endDate" v-model:model-value="eventSkeleton.endDate"
placeholder="Date de fin" :placeholder="$t('entity.calendar.date.end')"
:initial-date="lastActiveEvent?.endDate" :initial-date="lastActiveEvent?.endDate"
/> />
</div> </div>
@@ -155,7 +157,7 @@ function handleCancel() {
v-model="eventSkeleton.location" v-model="eventSkeleton.location"
type="text" type="text"
name="new-event-location" 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"> 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">
</div> </div>
</div> </div>
@@ -169,10 +171,10 @@ function handleCancel() {
<UiSwitch id="new-event-visibility" v-model:checked="eventSkeleton.hidden" /> <UiSwitch id="new-event-visibility" v-model:checked="eventSkeleton.hidden" />
<UiLabel for="new-event-visibility"> <UiLabel for="new-event-visibility">
<template v-if="!eventSkeleton.hidden"> <template v-if="!eventSkeleton.hidden">
Évènement visible par tous {{ $t('entity.calendar.event.isPublic') }}
</template> </template>
<template v-else> <template v-else>
Évènement caché {{ $t('entity.calendar.event.isHidden') }}
</template> </template>
</UiLabel> </UiLabel>
</div> </div>
@@ -189,7 +191,7 @@ function handleCancel() {
<footer class="flex gap-2 justify-end"> <footer class="flex gap-2 justify-end">
<Transition name="fade-delay"> <Transition name="fade-delay">
<UiButton v-if="isLoading" type="button" size="sm" variant="destructive" @click.prevent="handleCancel"> <UiButton v-if="isLoading" type="button" size="sm" variant="destructive" @click.prevent="handleCancel">
Annuler {{ $t('ui.action.cancel') }}
</UiButton> </UiButton>
</Transition> </Transition>
@@ -198,7 +200,7 @@ function handleCancel() {
<PhCircleNotch v-if="isLoading" size="20" class="animate-spin"/> <PhCircleNotch v-if="isLoading" size="20" class="animate-spin"/>
</Transition> </Transition>
Enregistrer {{ $t('ui.action.save') }}
</UiButton> </UiButton>
</footer> </footer>
</form> </form>

View File

@@ -60,8 +60,8 @@ const filteredCategories = computed(() =>
class="w-fit h-[33vh] p-0" class="w-fit h-[33vh] p-0"
> >
<UiCommand v-model="modelBuffer" v-model:searchTerm="searchTerm" :multiple="true"> <UiCommand v-model="modelBuffer" v-model:searchTerm="searchTerm" :multiple="true">
<UiCommandInput placeholder="Rechercher les catégories" /> <UiCommandInput :placeholder="$t('entity.searchCategories')" />
<UiCommandEmpty>Aucune catégorie trouvée.</UiCommandEmpty> <UiCommandEmpty>{{ $t('entity.noCategoriesFound') }}</UiCommandEmpty>
<UiCommandList> <UiCommandList>
<UiCommandGroup> <UiCommandGroup>
<UiCommandItem <UiCommandItem

View File

@@ -52,8 +52,8 @@ const filteredCategories = computed(() =>
class="w-fit h-[33vh] p-0" class="w-fit h-[33vh] p-0"
> >
<UiCommand v-model="model" v-model:searchTerm="searchTerm"> <UiCommand v-model="model" v-model:searchTerm="searchTerm">
<UiCommandInput placeholder="Rechercher les catégories" /> <UiCommandInput :placeholder="$t('entity.searchCategories')" />
<UiCommandEmpty>Aucune catégorie trouvée.</UiCommandEmpty> <UiCommandEmpty>{{ $t('entity.noCategoriesFound') }}</UiCommandEmpty>
<UiCommandList> <UiCommandList>
<UiCommandGroup> <UiCommandGroup>
<UiCommandItem <UiCommandItem

View File

@@ -241,11 +241,11 @@ function handleCategorySelect(e: (Category)) {
}" }"
> >
<VisuallyHidden> <VisuallyHidden>
<UiDialogTitle> Recherche avancée </UiDialogTitle> <UiDialogTitle> {{ $t('entity.advancedSearch.title') }} </UiDialogTitle>
</VisuallyHidden> </VisuallyHidden>
<VisuallyHidden> <VisuallyHidden>
<UiDialogDescription> <UiDialogDescription>
Rechercher les données disponibles sur le calendrier {{ $t('entity.advancedSearch.title') }}
</UiDialogDescription> </UiDialogDescription>
</VisuallyHidden> </VisuallyHidden>
@@ -256,7 +256,7 @@ function handleCategorySelect(e: (Category)) {
id="search" id="search"
v-model:model-value="searchQuery" v-model:model-value="searchQuery"
type="text" type="text"
placeholder="Rechercher le calendrier" :placeholder="$t('entity.advancedSearch.ctaPlaceholder')"
class="pl-10 py-6 text-lg" class="pl-10 py-6 text-lg"
autocomplete="off" autocomplete="off"
/> />
@@ -274,10 +274,10 @@ function handleCategorySelect(e: (Category)) {
@update:model-value="handleEntitySwitch()" @update:model-value="handleEntitySwitch()"
> >
<UiToggleGroupItem value="events" aria-label="Uniquement les évènements"> <UiToggleGroupItem value="events" aria-label="Uniquement les évènements">
Évènements {{ $t('entity.calendar.event.namePlural') }}
</UiToggleGroupItem> </UiToggleGroupItem>
<UiToggleGroupItem value="characters" aria-label="Uniquement les personnages"> <UiToggleGroupItem value="characters" aria-label="Uniquement les personnages">
Personnages {{ $t('entity.character.namePlural') }}
</UiToggleGroupItem> </UiToggleGroupItem>
</UiToggleGroup> </UiToggleGroup>
</div> </div>
@@ -341,7 +341,7 @@ function handleCategorySelect(e: (Category)) {
</UiButton> </UiButton>
</UiTooltipTrigger> </UiTooltipTrigger>
<UiTooltipContent> <UiTooltipContent>
<p>Plus ancien</p> <p>{{ $t('entity.advancedSearch.older') }}</p>
</UiTooltipContent> </UiTooltipContent>
</UiTooltip> </UiTooltip>
</UiTooltipProvider> </UiTooltipProvider>
@@ -358,7 +358,7 @@ function handleCategorySelect(e: (Category)) {
</UiButton> </UiButton>
</UiTooltipTrigger> </UiTooltipTrigger>
<UiTooltipContent> <UiTooltipContent>
<p>Plus récent</p> <p>{{ $t('entity.advancedSearch.newer') }}</p>
</UiTooltipContent> </UiTooltipContent>
</UiTooltip> </UiTooltip>
</UiTooltipProvider> </UiTooltipProvider>

View File

@@ -53,8 +53,14 @@ const dateDuration: string | null = props.event.endDate
</template> </template>
<template v-else> <template v-else>
<p class="font-semibold text-sm opacity-75"> <p class="font-semibold text-sm opacity-75">
Du {{ getFormattedDateTitle(event.startDate, true) }} au {{
{{ getFormattedDateTitle(event.endDate, true) }} $t('entity.calendar.date.fromTo',
{
startDate: getFormattedDateTitle(event.startDate, true),
endDate: getFormattedDateTitle(event.endDate, true)
}
)
}}
</p> </p>
</template> </template>
<div v-if="event.hidden" class="flex justify-end"> <div v-if="event.hidden" class="flex justify-end">
@@ -62,11 +68,13 @@ const dateDuration: string | null = props.event.endDate
<UiTooltip> <UiTooltip>
<UiTooltipTrigger as-child> <UiTooltipTrigger as-child>
<UiBadge class="flex gap-1"> <UiBadge class="flex gap-1">
<PhEye size="16" weight="fill" /> Évènement privé <PhEye size="16" weight="fill" /> {{ $t('entity.calendar.event.isHidden') }}
</UiBadge> </UiBadge>
</UiTooltipTrigger> </UiTooltipTrigger>
<UiTooltipContent> <UiTooltipContent>
<p>Cet évènement est uniquement visible pour vous</p> <p>
{{ $t('entity.calendar.event.hiddenTooltip') }}
</p>
</UiTooltipContent> </UiTooltipContent>
</UiTooltip> </UiTooltip>
</UiTooltipProvider> </UiTooltipProvider>
@@ -84,7 +92,7 @@ const dateDuration: string | null = props.event.endDate
</p> </p>
<template v-if="dateDuration"> <template v-if="dateDuration">
<p class="w-fit text-sm italic opacity-75 flex items-center gap-1"> <p class="w-fit text-sm italic opacity-75 flex items-center gap-1">
<PhHourglassMedium size="16" weight="fill" /> Pendant {{ dateDuration }} <PhHourglassMedium size="16" weight="fill" /> {{ $t('entity.calendar.date.while', { duration: dateDuration } )}}
</p> </p>
</template> </template>
</div> </div>

View File

@@ -11,7 +11,9 @@ export default defineI18nConfig(() => ({
action: { action: {
back: "Back", back: "Back",
cancel: "Cancel", cancel: "Cancel",
save: "Save" save: "Save",
delete: "Delete",
edit: "Edit",
}, },
greeting: "Connected as {user}", greeting: "Connected as {user}",
sidebarMenu: { sidebarMenu: {
@@ -30,7 +32,17 @@ export default defineI18nConfig(() => ({
title: "Title" title: "Title"
}, },
entity: { entity: {
searchCategories: "Search categories",
noCategoriesFound: "No categories found.",
addDescription: "Add a description",
deleteOne: "Delete \"{entity}\"", deleteOne: "Delete \"{entity}\"",
advancedSearch: {
title: "Advanced search",
subtitle: "Search through calendar and world data",
older: "Older",
newer: "Newer",
ctaPlaceholder: "Search an event, characters…"
},
world: { world: {
nameSingular: "World", nameSingular: "World",
namePlural: "Worlds", namePlural: "Worlds",
@@ -40,6 +52,33 @@ export default defineI18nConfig(() => ({
namePlural: "Calendars", namePlural: "Calendars",
addSingle: "Add a calendar", addSingle: "Add a calendar",
notFoundForWorld: "No calendar for this world… yet !", 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: { createDialog: {
title: "New calendar", title: "New calendar",
tabs: { tabs: {
@@ -73,6 +112,10 @@ export default defineI18nConfig(() => ({
chooseOne: "Choose a month", chooseOne: "Choose a month",
deleteOne: "Remove {month} from this calendar" deleteOne: "Remove {month} from this calendar"
} }
},
character: {
nameSingular: "Character",
namePlural: "Characters",
} }
} }
}, },
@@ -85,7 +128,9 @@ export default defineI18nConfig(() => ({
action: { action: {
back: "Retour", back: "Retour",
cancel: "Annuler", cancel: "Annuler",
save: "Sauvegarder" save: "Sauvegarder",
delete: "Supprimer",
edit: "Modifier",
}, },
greeting: "Connecté en tant que {user}", greeting: "Connecté en tant que {user}",
sidebarMenu: { sidebarMenu: {
@@ -104,7 +149,17 @@ export default defineI18nConfig(() => ({
title: "Titre" title: "Titre"
}, },
entity: { entity: {
searchCategories: "Rechercher les catégories",
noCategoriesFound: "Aucune catégorie trouvée.",
addDescription: "Ajouter une description",
deleteOne: "Supprimer \"{entity}\"", 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: { world: {
nameSingular: "Monde", nameSingular: "Monde",
namePlural: "Mondes", namePlural: "Mondes",
@@ -114,6 +169,33 @@ export default defineI18nConfig(() => ({
namePlural: "Calendrier", namePlural: "Calendrier",
addSingle: "Ajouter un calendrier", addSingle: "Ajouter un calendrier",
notFoundForWorld: "Aucun calendrier pour ce monde… pour l'instant !", 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: { createDialog: {
title: "Nouveau calendrier", title: "Nouveau calendrier",
tabs: { tabs: {
@@ -148,6 +230,10 @@ export default defineI18nConfig(() => ({
chooseOne: "Choisir un mois", chooseOne: "Choisir un mois",
deleteOne: "Supprimer {month} du calendrier" deleteOne: "Supprimer {month} du calendrier"
} }
},
character: {
nameSingular: "Personnage",
namePlural: "Personnages",
} }
} }
} }

View File

@@ -15,7 +15,11 @@ export default defineNuxtConfig({
css: ["~/assets/main.css"], css: ["~/assets/main.css"],
i18n: { i18n: {
vueI18n: "./i18n.config.ts" vueI18n: "./i18n.config.ts",
detectBrowserLanguage: {
useCookie: true,
cookieKey: "tttools_lang"
},
}, },
supabase: { supabase: {

View File

@@ -32,7 +32,9 @@ const categories = computed<Category[]>(() => catData?.value?.data as Category[]
</Head> </Head>
<div class="grid gap-2 justify-items-center opacity-50"> <div class="grid gap-2 justify-items-center opacity-50">
<p>Chargement du calendrier</p> <p>
{{ $t('entity.calendar.isLoading') }}
</p>
<PhCircleNotch size="50" class="animate-spin"/> <PhCircleNotch size="50" class="animate-spin"/>
</div> </div>
</div> </div>