Skip to content

Commit

Permalink
Merge branch 'injiweb-977-unit-testing-utils' of https://github.com/I…
Browse files Browse the repository at this point in the history
…nfosys/inji-web into injiweb-977-unit-testing-utils
  • Loading branch information
kamlesh012 committed Oct 21, 2024
2 parents d1a1f14 + 580cc93 commit 855ae86
Showing 1 changed file with 69 additions and 1 deletion.
70 changes: 69 additions & 1 deletion inji-web/src/utils/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

import i18n from "i18next";
import {initReactI18next} from "react-i18next";
import en from '../locales/en.json';
Expand Down Expand Up @@ -64,4 +65,71 @@ export const isRTL = (language:string) => {
return language === 'ar';
}

export default i18n;
export default i18n;
// import i18n from "i18next";
// import {initReactI18next} from "react-i18next";
// import en from '../locales/en.json';
// import fr from '../locales/fr.json';
// import ta from '../locales/ta.json';
// import hi from '../locales/hi.json';
// import kn from '../locales/kn.json';
// import ar from '../locales/ar.json';
// import {storage} from "./storage";
// import {DisplayArrayObject, LanguageObject} from "../types/data";

// const resources = {en, ta, kn, hi, fr, ar};

// export const LanguagesSupported: LanguageObject[] = [
// {label: "English", value: 'en'},
// {label: "தமிழ்", value: 'ta'},
// {label: "ಕನ್ನಡ", value: 'kn'},
// {label: "हिंदी", value: 'hi'},
// {label: "Français", value: 'fr'},
// {label: "عربي", value: 'ar'}
// ];

// export const defaultLanguage = window._env_.DEFAULT_LANG;

// export const initializeI18n = () => {
// const selected_language = storage.getItem(storage.SELECTED_LANGUAGE);

// return i18n
// .use(initReactI18next)
// .init({
// resources,
// lng: selected_language || defaultLanguage,
// fallbackLng: defaultLanguage,
// interpolation: {
// escapeValue: false
// },
// });
// };

// initializeI18n();


// export const switchLanguage = async (language: string) => {
// storage.setItem(storage.SELECTED_LANGUAGE, language);
// await i18n.changeLanguage(language);
// }

// export const getObjectForCurrentLanguage = (displayArray: DisplayArrayObject[], language: string = i18n.language) => {
// let resp = displayArray.filter(displayObj => (displayObj.language === language || displayObj.locale === language))[0];
// if (!resp) {
// resp = displayArray.filter(displayObj => (
// displayObj.language === defaultLanguage ||
// displayObj.locale === defaultLanguage
// ))[0];
// }
// return resp;
// }

// export const getDirCurrentLanguage = (language: string) => {
// return isRTL(language) ? 'rtl' : 'ltr';
// }

// export const isRTL = (language:string) => {
// return language === 'ar';
// }

// export default i18n;

0 comments on commit 855ae86

Please sign in to comment.