What have i done till now
- Create a Dropdown for language selection
- Set Up the Dropdown Options
Label: English, Value: en
Label: Kannada, Value: kn
Label: Hindi, Value: hi - add a Event handlers on change of select1 it will run a query 'change'
- add a text comp text1
- whose value is
{{ i18n.t('key') }}!
the query 'change' content are
i18n.init({
lng: 'en',
resources: {
en: {
translation: {
"key": "hello world"
}
},
kn: {
translation: {
"key": "ಹಲೋ ವರ್ಲ್ಡ್"
}
},
hi: {
translation: {
"key": "हैलो वर्ल्ड"
}
}
},
fallbackLng: 'en',
interpolation: {
escapeValue: false
}
});
const selectedLanguage = select1.value;
i18n.changeLanguage(selectedLanguage);
error t.forEach is not a function debug this error solve this by step by step