forexample I have {moment().locale('en').format('MMMM Do YYYY')} in my App.js. But I want it switch on {moment().locale('fr').format('MMMM Do YYYY')} while I am switching languege in whole website.
Something like this:
import React from 'react'
import {useTranslation} from "react-i18next";
import moment from 'moment';
const {i18n} = useTranslation();
const {languegeswitcher} = i18n;
const languegeswitcher = () =>
{
if (currentLang === "en") {
return {moment().locale('en').format('MMMM Do YYYY')};
} else if (currentLang === "fr"){
return {moment().locale('fr').format('MMMM Do YYYY')};
} else (currentLang === "ru")
return {moment().locale('ru').format('MMMM Do YYYY')};
}
export default languegeswitcher;