Implémentation complète du multilingue FR/EN

- Installation vue-i18n v11 et création des fichiers de traduction (fr.json, en.json)
- Création store locale avec détection hiérarchique (URL > localStorage > navigator)
- Modification des routes avec préfixe /:locale? optionnel
- Toggle FR/EN dans Menu.vue avec synchronisation immédiate
- Traduction de ~200 textes dans 27 composants Vue
- Suppression des labels hardcodés en français côté backend
- Ajout route Kirby catch-all en/(:all?) pour /en/ URLs
- Helper addLocalePrefix() pour préserver locale dans liens dialogs
- Traduction pseudo-élément CSS via data attribute

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
isUnknown 2026-02-02 18:21:11 +01:00
parent 3af95b1d20
commit 82eb8d88cc
49 changed files with 1079 additions and 295 deletions

View file

@ -1,9 +1,10 @@
<template>
<aside id="comments-container" aria-labelledby="comments-label">
<h2 id="comments-label" class="sr-only">Commentaires</h2>
<h2 id="comments-label" class="sr-only">{{ t('comments.title') }}</h2>
<div
class="comments | flow"
:class="{ empty: !comments || comments.length === 0 }"
:data-empty-message="t('comments.emptyMessage')"
>
<template v-if="comments">
<template v-if="!openedComment">
@ -26,7 +27,7 @@
isAddOpen = false;
"
>
<span>Retour à la liste</span>
<span>{{ t('buttons.backToList') }}</span>
</button>
<Comment
:comment="openedComment"
@ -53,7 +54,7 @@
class="btn btn--white-20 | w-full"
@click="toggleCommentPositionMode(true)"
>
Ajouter un commentaire
{{ t('buttons.addComment') }}
</button>
<button
v-else-if="openedComment && !isAddOpen"
@ -61,7 +62,7 @@
class="btn btn--white-20 | justify-start w-full | text-white-50"
@click="isAddOpen = true"
>
Répondre
{{ t('buttons.reply') }}
</button>
<!-- TODO: afficher #new-comment une fois le bouton Ajouter un commentaire cliqué -->
<div
@ -70,11 +71,10 @@
class="bg-primary | text-sm text-white | rounded-lg | p-12"
>
<p class="flex justify-start | mb-12" data-icon="comment">
<strong>Nouveau commentaire</strong>
<strong>{{ t('comments.new') }}</strong>
</p>
<p>
Dans la zone du contenu, cliquez vous souhaitez positionner le
commentaire
{{ t('comments.newInstruction') }}
</p>
</div>
<form
@ -84,13 +84,13 @@
class="flow | p-12 | rounded-xl"
@submit="handleSubmit"
>
<label class="sr-only" for="comment">Votre commentaire</label>
<label class="sr-only" for="comment">{{ t('comments.your') }}</label>
<textarea
v-model="draftComment.text"
:disabled="isSubmitting ? true : undefined"
name="comment"
id="comment"
placeholder="Ajouter un commentaire…"
:placeholder="t('forms.commentPlaceholder')"
rows="5"
class="text-sm | rounded-lg bg-black p-12"
></textarea>
@ -99,11 +99,11 @@
type="submit"
class="btn"
:class="{ submitting: isSubmitting }"
:value="isSubmitting ? 'En cours' : undefined"
:value="isSubmitting ? t('comments.inProgress') : undefined"
:disabled="isSubmitting ? true : undefined"
/>
<button class="btn btn--white-10" @click="isAddOpen = false">
Annuler
{{ t('buttons.cancel') }}
</button>
</footer>
</form>
@ -122,9 +122,11 @@ import { useDialogStore } from '../../stores/dialog';
import Comment from './Comment.vue';
import { storeToRefs } from 'pinia';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
dayjs.locale('fr');
const { t } = useI18n();
const { user } = useUserStore();
const { page } = usePageStore();
const dialog = useDialogStore();