import { getLocales } from 'expo-localization';
import { I18n } from 'i18n-js';
import moment from 'moment'
import 'moment/min/locales'

I18n.defaultLocale = 'en';
I18n.enableFallback = true;

const messages = {
    en: {
        message: {
            feed: 'Feed',
            events: "Events",
            livestream: "Livestrem",
            search: 'Search',
            invite: 'Invite',
            groups: 'Groups',
            courses: "Courses",
            giving: "Giving",
            profile: "Profile",
            settings: 'Settings',
            logout: "Logout",
            about: 'about',
            statusUpdate: "New Post",
            newsPost: "News Post",
            post: "Post",
            add: 'Add',
            whatIsNew: "What is new?",
            saySomethingTo: "Say something to ",
            follow: "Follow",
            unfollow: "Unfollow",
            subscribe: "Subscribe",
            unsubscribe: 'Unsubscribe',
            pending: "Pending",
            subscribers: "Subscribers",
            loading: "Loading",
            login: 'Login',
            email: "Email",
            cancel: "Cancel",
            password: "Password",
            rpassword: "Repeat Password",
            resetPassword: "Reset password",
            register: "Register",
            name: "Name",
            firstName: "First Name",
            lastName: "Last Name",
            describeYourself: 'Describe Yourself',
            continueWatching: "Continues Watching",
            createCourse: "Create a your own new course!",
            createGroup: "Create a your own new group!",
            title: "Title",
            subtitle: "Subtitle",
            recentlyAdded: "Recently added",
            popularCourses: "Popular Courses",
            privateGroup: "Private Group",
            tithesAndOfferings: "Tithes and Offerings",
            type: "Type",
            description: "Description",
            amount: "Amount",
            tithes: "Tithes",
            offerings: "Offerings",
            event: "Event",
            proceedToPayment: "Proceed to Payment",
            minimumAmount: "The minimum amount is ",
            notifications: "Notifications",
            searchUsers: "Search Users",
            searchCourses: "Search Courses",
            news: "News",
            wrongInformation: "Please review the information.",
            submit: "Submit",
            IKnowThisPerson: "I know this person",
            update: "Update",
            invalidEmail: "Email address is invalid!",
            reviewPassword: "Please review your password.",
            updatePhoto: "Update Photo",
            optional: "Optional",
            birthday: "Birthday",
            localMinistry: "Local Ministry",
            ocupation: "Ocupation",
            country: 'Country',
        },
    },
    es: {
        message: {
            feed: 'Inicio',
            events: 'Eventos',
            livestream: 'Transmisión en vivo',
            search: 'Buscar',
            invite: 'Invitar',
            groups: 'Grupos',
            courses: 'Cursos',
            giving: 'Donaciones',
            profile: 'Perfil',
            settings: 'Configuración',
            logout: 'Cerrar sesión',
            about: 'Acerca de',
            statusUpdate: 'Nueva publicación',
            newsPost: 'Publicación de noticias',
            post: 'Publicar',
            add: 'Agregar',
            whatIsNew: '¿Qué hay de nuevo?',
            saySomethingTo: 'Di algo a ',
            follow: 'Seguir',
            unfollow: 'Dejar de seguir',
            subscribe: 'Suscribirse',
            unsubscribe: 'Cancelar suscripción',
            pending: 'Pendiente',
            subscribers: 'Suscriptores',
            loading: 'Cargando',
            login: 'Iniciar sesión',
            email: 'Correo electrónico',
            cancel: 'Cancelar',
            password: 'Contraseña',
            rpassword: 'Repetir contraseña',
            resetPassword: 'Restablecer contraseña',
            register: 'Registrarse',
            name: 'Nombre',
            firstName: 'Nombre',
            lastName: 'Apellido',
            describeYourself: 'Describirse',
            continueWatching: 'Continuar viendo',
            createCourse: '¡Crea tu propio curso nuevo!',
            createGroup: '¡Crea tu propio grupo nuevo!',
            title: 'Título',
            subtitle: 'Subtítulo',
            recentlyAdded: 'Agregado recientemente',
            popularCourses: 'Cursos populares',
            privateGroup: 'Grupo privado',
            tithesAndOfferings: 'Diezmos y Ofrendas',
            type: 'Tipo',
            description: 'Descripción',
            amount: 'Monto',
            tithes: 'Diezmos',
            offerings: 'Ofrendas',
            event: 'Evento',
            proceedToPayment: 'Continuar al pago',
            minimumAmount: 'El monto mínimo es ',
            notifications: 'Notificaciones',
            searchUsers: 'Buscar usuarios',
            searchCourses: 'Buscar cursos',
            news: 'Noticias',
            wrongInformation: 'Por favor, revisa la información.',
            submit: 'Enviar',
            IKnowThisPerson: 'Conozco a esta persona',
            update: 'Actualizar',
            invalidEmail: '¡La dirección de correo electrónico no es válida!',
            reviewPassword: 'Por favor, revisa tu contraseña.',
            updatePhoto: 'Actualizar foto',
            optional: 'Opcional',
            birthday: 'Cumpleaños',
            localMinistry: 'Ministerio local',
            ocupation: 'Ocupación',
            country: 'País',
        }
    },
    fr: {
        message: {
            feed: 'Fil d\'actualité',
            events: 'Événements',
            livestream: 'Diffusion en direct',
            search: 'Rechercher',
            invite: 'Inviter',
            groups: 'Groupes',
            courses: 'Cours',
            giving: 'Don',
            profile: 'Profil',
            settings: 'Paramètres',
            logout: 'Se déconnecter',
            about: 'À propos',
            statusUpdate: 'Nouvelle publication',
            newsPost: 'Publication de nouvelles',
            post: 'Publier',
            add: 'Ajouter',
            whatIsNew: 'Quoi de neuf ?',
            saySomethingTo: 'Dire quelque chose à ',
            follow: 'Suivre',
            unfollow: 'Ne plus suivre',
            subscribe: 'S\'abonner',
            unsubscribe: 'Se désabonner',
            pending: 'En attente',
            subscribers: 'Abonnés',
            loading: 'Chargement',
            login: 'Connexion',
            email: 'Email',
            cancel: 'Annuler',
            password: 'Mot de passe',
            rpassword: 'Répéter le mot de passe',
            resetPassword: 'Réinitialiser le mot de passe',
            register: 'S\'inscrire',
            name: 'Nom',
            firstName: 'Prénom',
            lastName: 'Nom de famille',
            describeYourself: 'Décrivez-vous',
            continueWatching: 'Continuer à regarder',
            createCourse: 'Créer votre propre nouveau cours !',
            createGroup: 'Créer votre propre nouveau groupe !',
            title: 'Titre',
            subtitle: 'Sous-titre',
            recentlyAdded: 'Récemment ajouté',
            popularCourses: 'Cours populaires',
            privateGroup: 'Groupe privé',
            tithesAndOfferings: 'Dîmes et offrandes',
            type: 'Type',
            description: 'Description',
            amount: 'Montant',
            tithes: 'Dîmes',
            offerings: 'Offrandes',
            event: 'Événement',
            proceedToPayment: 'Procéder au paiement',
            minimumAmount: 'Le montant minimum est de ',
            notifications: 'Notifications',
            searchUsers: 'Rechercher des utilisateurs',
            searchCourses: 'Rechercher des cours',
            news: 'Actualités',
            wrongInformation: 'Veuillez vérifier les informations.',
            submit: 'Soumettre',
            IKnowThisPerson: 'Je connais cette personne',
            update: 'Mettre à jour',
            invalidEmail: 'L\'adresse email est invalide !',
            reviewPassword: 'Veuillez vérifier votre mot de passe.',
            updatePhoto: 'Mettre à jour la photo',
            optional: 'Facultatif',
            birthday: 'Date de naissance',
            localMinistry: 'Ministère local',
            ocupation: 'Occupation',
            country: 'Pays',
        }
    },
    da: {
        message: {
            feed: 'Feed',
            events: "Begivenheder",
            livestream: "Live stream",
            search: 'Søg',
            invite: 'Inviter',
            groups: 'Grupper',
            courses: "Kurser",
            giving: "Donation",
            profile: "Profil",
            settings: 'Indstillinger',
            logout: "Log ud",
            about: 'Om',
            statusUpdate: "Ny opdatering",
            newsPost: "Nyhedsopslag",
            post: "Indlæg",
            add: 'Tilføj',
            whatIsNew: "Hvad er nyt?",
            saySomethingTo: "Sig noget til ",
            follow: "Følg",
            unfollow: "Følg ikke",
            subscribe: "Abonnér",
            unsubscribe: 'Afmeld',
            pending: "Afventer",
            subscribers: "Abonnenter",
            loading: "Indlæser",
            login: 'Log ind',
            email: "E-mail",
            cancel: "Annuller",
            password: "Adgangskode",
            rpassword: "Gentag adgangskode",
            resetPassword: "Nulstil adgangskode",
            register: "Registrer",
            name: "Navn",
            firstName: "Fornavn",
            lastName: "Efternavn",
            describeYourself: 'Beskriv dig selv',
            continueWatching: "Fortsæt med at se",
            createCourse: "Opret din egen nye kursus!",
            createGroup: "Opret din egen nye gruppe!",
            title: "Titel",
            subtitle: "Undertitel",
            recentlyAdded: "Nyligt tilføjet",
            popularCourses: "Populære kurser",
            privateGroup: "Privat gruppe",
            tithesAndOfferings: "Tiende og offer",
            type: "Type",
            description: "Beskrivelse",
            amount: "Beløb",
            tithes: "Tiende",
            offerings: "Offergaver",
            event: "Begivenhed",
            proceedToPayment: "Fortsæt til betaling",
            minimumAmount: "Det mindste beløb er ",
            notifications: "Notifikationer",
            searchUsers: "Søg efter brugere",
            searchCourses: "Søg efter kurser",
            news: "Nyheder",
            wrongInformation: "Gennemse venligst oplysningerne.",
            submit: "Indsend",
            IKnowThisPerson: "Jeg kender denne person",
            update: "Opdater",
            invalidEmail: "E-mailadressen er ugyldig!",
            reviewPassword: "Gennemse venligst din adgangskode.",
            updatePhoto: "Opdater foto",
            optional: "Valgfrit",
            birthday: "Fødselsdag",
            localMinistry: "Lokalt ministerium",
            ocupation: "Beskæftigelse",
            country: 'Land',
        }
    }
}

// Set the key-value pairs for the different languages you want to support.
const i18n = new I18n(messages);

// Set the locale once at the beginning of your app.
// TODO: Check user Lcale
const devideLocale = getLocales()[0].languageCode;
console.log('deviceLocale', devideLocale);
if (messages[devideLocale]) {
    i18n.locale = devideLocale;
} else {
    i18n.locale = 'en';
}
moment.locale(i18n.locale);

export default i18n;