feat: Add base setup for Internationalization(i18n)
This commit is contained in:
15
apps/web/src/i18n/index.ts
Normal file
15
apps/web/src/i18n/index.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import i18n from "i18next";
|
||||
import { initReactI18next } from "react-i18next";
|
||||
import LanguageDetector from "i18next-browser-languagedetector";
|
||||
import Backend from "i18next-http-backend";
|
||||
|
||||
i18n
|
||||
.use(LanguageDetector) // detects browser language
|
||||
.use(initReactI18next)// passes i18n down to react-i18next
|
||||
.use(Backend) // loads translations asynchoronusly from /locales/{{lng}}/{{ns}}.json
|
||||
.init({
|
||||
fallbackLng: "en", // fallback language
|
||||
debug: true,
|
||||
});
|
||||
|
||||
export default i18n;
|
||||
5
apps/web/src/i18n/locales/en/translation.json
Normal file
5
apps/web/src/i18n/locales/en/translation.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"welcome": "Welcome",
|
||||
"login": "Login",
|
||||
"logout": "Logout"
|
||||
}
|
||||
5
apps/web/src/i18n/locales/es/translation.json
Normal file
5
apps/web/src/i18n/locales/es/translation.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"welcome": "Bienvenido",
|
||||
"login": "Iniciar sesión",
|
||||
"logout": "Cerrar sesión"
|
||||
}
|
||||
Reference in New Issue
Block a user