Relative Content

Tag Archive for vue.jsvuejs3vue-componentopenweathermap

Re-render a OpenWeatherMap component when switching language in Vue 3

I am a beginner using Vue 3, to learn it I am developing a simple weather webapp using OpenWeatherMap API. I have added multilanguage support using vue-i18n library and everything works fine. But there is only one issue, the weather description language that OWM API returns depends on the lang parameter passed in the request. Hence, even if the app language is fully reactive and changes when I switch the language, that weather description is not updating, that is normal because it would need to re-request the API with the proper lang value. But I can’t figure out how to do that. How can I achieve re-rendering that component in order to get the right language in the description returned by the API?