To achieve a multi-language website, I have attached the below code in the HTML.
reference: https://www.w3schools.com/howto/howto_google_translate.asp
<div id="google_translate_element"></div>
<script>
function googleTranslateElementInit() {
new google.translate.TranslateElement(
{pageLanguage: 'en'},
'google_translate_element'
);
}
</script>
<script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script
But translation does not work with dynamic rendering content. if I refresh the page then it will work.
anyone could help? how can I achieve translation without refreshing the page?
Please try the following html/css/js sample code, for Google Translate, that works fine on my website. In fact, this code can be used by any website designers / programmers, to make their websites fully support multi languages via translations.
Usage: Just copy and save this code, for example, to a test.html file and then view it on the internet browser. That's all.