Commit 4565452b authored by Lorenzo Trujillo Rojas's avatar Lorenzo Trujillo Rojas
Browse files

Se cambiaron las librerias para hacer la aplicación multilenguaje

parent 04a89a59
Loading
Loading
Loading
Loading
+31 −13
Original line number Diff line number Diff line
import { ENGLISH_LANG } from "./english_lang";
import { SPANISH_LANG } from "./spanish_lang";
import { I18n } from 'i18n-js';
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import * as Localization from 'expo-localization';
import { SPANISH_LANG } from './spanish_lang';
import { ENGLISH_LANG } from './english_lang';

const translations = {
    en : ENGLISH_LANG,
    es : SPANISH_LANG
i18n.use(initReactI18next).init({
  compatibilityJSON: 'v3', // Necesario para compatibilidad con Expo
  fallbackLng: 'en', // Idioma de respaldo
  resources: {
    es: {
      translation: SPANISH_LANG
    },
    en: {
      translation: ENGLISH_LANG
    }
  },
  interpolation: {
    escapeValue: false // React ya hace el escape de valores
  }
});

const LANG = new I18n(translations);

LANG.locale = 'es';

LANG.enableFallback = true;
export const AvailableLanguages = [
  {
    key: 'en',
    value: 'English'
  },
  {
    key: 'es',
    value: 'Español'
  }
]

export { LANG };
export default i18n;