How to change language (i18n)


#1

Hi everyone, How to change current language when app is running?

for example:
How to change my current language from pt_PT to en_GB?

const i18next =   require('i18next');

const Backend =  require('i18next-sync-fs-backend');

i18next
.use(Backend)
.init({
    debug: true,
    lng: 'pt',
    ns:['pt_PT', 'en_GB'],
    defaultsNS: 'pt_PT',
    initImmediate: false,
    backend: {
        // path where resources get loaded from 
        loadPath: 
            __dirname + '/../../locales/{{ns}}.json',
        }
});