Add language selection

This commit is contained in:
frost768 2023-04-06 01:46:27 +03:00
parent 1585805d86
commit c2b52d3db8
2 changed files with 1337 additions and 7 deletions

View File

@ -4,7 +4,13 @@ import LanguageDetector from "i18next-browser-languagedetector";
// Languages
import en from "./locales/en/translation.json";
import { captionLanguages } from "./iso6391";
const locales = {
en: {
translation: en,
},
};
i18n
// detect user language
// learn more: https://github.com/i18next/i18next-browser-languageDetector
@ -15,16 +21,14 @@ i18n
// for all options read: https://www.i18next.com/overview/configuration-options
.init({
fallbackLng: "en",
resources: {
en: {
translation: en,
},
},
resources: locales,
interpolation: {
escapeValue: false, // not needed for react as it escapes by default
},
});
export const appLanguageOptions = captionLanguages.filter((x) => {
return Object.keys(locales).includes(x.id);
});
export default i18n;

1326
src/setup/iso6391.ts Normal file

File diff suppressed because it is too large Load Diff