This code is useful when you want to use Google Translator which apperas at the top of the page by default. The main idea is totally hide Google Translator from the page and operate languages from custom elements.
To check the code is working run the standalone server from project folder. For example:
php -S localhost:8000Then visit http://localhost:8000
You can click language icons and text will be translated.