I am developing a website (in Wordpress) that is designed for users who speak different languages. The main content of the site is the same (not divided into languages). But the interface of the site (for example, menus and some other little things) should be in two different languages.
I do not want to use gettext in the PHP level. Instead, I want to bring some things to the JavaScript level.
Of course, I can make an array of words in both languages, mark html elements that require translation (for example: <span translate='true'>Hello world!</span> ), and when the user clicks their language button, the script for match words and replace the contents of the elements.
But I want to ask, is there a better way to achieve this?
source share