Hook for changing the currently active language.

//This is the custom useLang, generated and exported by 
//you sin the src/i18n.tsx filed.
import { useLang } from "i18n";

function MyComponent(){

    const { lang, setLang= useLang();
    return (
            <span>The app is currently in {(()=>{
                    case "en": return "English";
                    case "fr": return "French";
            <button onClick={()=> setLang("en")}>Put the app in English</button>
            <button onClick={()=> setLang("fr")}>Put the app in French</button>

Last updated