Client: Full localization, dynamic title
This commit is contained in:
@@ -3,17 +3,41 @@ import detector from "i18next-browser-languagedetector";
|
||||
import Backend from "i18next-xhr-backend";
|
||||
import { initReactI18next } from "react-i18next";
|
||||
|
||||
interface Language {
|
||||
name: string;
|
||||
countryCode: string;
|
||||
fullCode: string;
|
||||
}
|
||||
|
||||
export const languages: { [key: string]: Language } = {
|
||||
["en"]: {
|
||||
name: "English",
|
||||
countryCode: "gb",
|
||||
fullCode: "en-GB",
|
||||
},
|
||||
["sv"]: {
|
||||
name: "Svenska",
|
||||
countryCode: "se",
|
||||
fullCode: "sv-SE",
|
||||
},
|
||||
["de"]: {
|
||||
name: "Deutsch",
|
||||
countryCode: "de",
|
||||
fullCode: "de-DE",
|
||||
},
|
||||
}
|
||||
|
||||
i18n
|
||||
.use(Backend)
|
||||
.use(detector)
|
||||
.use(initReactI18next)
|
||||
.init({
|
||||
supportedLngs: ["en"],
|
||||
supportedLngs: Object.keys(languages),
|
||||
backend: {
|
||||
loadPath: "/locales/{{lng}}/{{ns}}.json",
|
||||
},
|
||||
defaultNS: "common",
|
||||
fallbackLng: ["en"],
|
||||
fallbackLng: Object.keys(languages),
|
||||
});
|
||||
|
||||
export default i18n;
|
||||
|
||||
Reference in New Issue
Block a user