feat: first shoot on translation
This commit is contained in:
42
src/i18n/i18n.ts
Normal file
42
src/i18n/i18n.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
"use client";
|
||||
|
||||
import i18n from "i18next";
|
||||
import { initReactI18next } from "react-i18next";
|
||||
import LanguageDetector from "i18next-browser-languagedetector";
|
||||
|
||||
// Importation des traductions
|
||||
import frCommon from "./messages/fr/common.json";
|
||||
import enCommon from "./messages/en/common.json";
|
||||
|
||||
// Ne pas initialiser i18next plus d'une fois
|
||||
if (!i18n.isInitialized) {
|
||||
i18n
|
||||
.use(LanguageDetector) // Détecte la langue du navigateur
|
||||
.use(initReactI18next)
|
||||
.init({
|
||||
resources: {
|
||||
fr: {
|
||||
common: frCommon,
|
||||
},
|
||||
en: {
|
||||
common: enCommon,
|
||||
},
|
||||
},
|
||||
defaultNS: "common",
|
||||
fallbackLng: "fr",
|
||||
interpolation: {
|
||||
escapeValue: false, // React gère déjà l'échappement
|
||||
},
|
||||
detection: {
|
||||
order: ["cookie", "localStorage", "navigator"],
|
||||
lookupCookie: "NEXT_LOCALE",
|
||||
caches: ["cookie"],
|
||||
cookieOptions: {
|
||||
path: "/",
|
||||
maxAge: 365 * 24 * 60 * 60, // 1 an
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export default i18n;
|
||||
31
src/i18n/messages/en/common.json
Normal file
31
src/i18n/messages/en/common.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"language": {
|
||||
"select": "Change language",
|
||||
"fr": "French",
|
||||
"en": "English"
|
||||
},
|
||||
"login": {
|
||||
"title": "Welcome to StripStream",
|
||||
"subtitle": "Sign in or create an account to get started",
|
||||
"tabs": {
|
||||
"login": "Sign in",
|
||||
"register": "Sign up"
|
||||
},
|
||||
"description": "Enjoy your favorite comics, manga and graphic novels with a modern and smooth reading experience."
|
||||
},
|
||||
"home": {
|
||||
"hero": {
|
||||
"title": "Welcome to StripStream",
|
||||
"subtitle": "Your digital library to read your favorite comics, manga and graphic novels.",
|
||||
"coverAlt": "Cover of {title}"
|
||||
},
|
||||
"title": "Home",
|
||||
"sections": {
|
||||
"continue_series": "Continue series",
|
||||
"continue_reading": "Continue reading",
|
||||
"up_next": "Up next",
|
||||
"latest_series": "Latest series",
|
||||
"recently_added": "Recently added"
|
||||
}
|
||||
}
|
||||
}
|
||||
31
src/i18n/messages/fr/common.json
Normal file
31
src/i18n/messages/fr/common.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"language": {
|
||||
"select": "Changer la langue",
|
||||
"fr": "Français",
|
||||
"en": "Anglais"
|
||||
},
|
||||
"login": {
|
||||
"title": "Bienvenue sur StripStream",
|
||||
"subtitle": "Connectez-vous ou créez un compte pour commencer",
|
||||
"tabs": {
|
||||
"login": "Connexion",
|
||||
"register": "Inscription"
|
||||
},
|
||||
"description": "Profitez de vos BD, mangas et comics préférés avec une expérience de lecture moderne et fluide."
|
||||
},
|
||||
"home": {
|
||||
"hero": {
|
||||
"title": "Bienvenue sur StripStream",
|
||||
"subtitle": "Votre bibliothèque numérique pour lire vos BD, mangas et comics préférés.",
|
||||
"coverAlt": "Couverture de {title}"
|
||||
},
|
||||
"title": "Accueil",
|
||||
"sections": {
|
||||
"continue_series": "Continuer la série",
|
||||
"continue_reading": "Continuer la lecture",
|
||||
"up_next": "À suivre",
|
||||
"latest_series": "Dernières séries",
|
||||
"recently_added": "Ajouts récents"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user