Closed tomasts248 closed 3 years ago
Hi @tomasts248 no you don't add each language element. You add one and provide the language it is in, then you provide a JSON object with the original phrase and the translated phrase. The example /index.html in the repo provides all the info you need on how to use the switcher.
The reason it doesn't work the way you have suggested is because if the page is scanned by googlebot or other search engine, it would read lots of text in different languages repeated over and over instead of just one language. You'd also end up with 3 times the amount of HTML data being transmitted to a client wasting bandwidth.
You could do it the way you have suggested, then it would be very easy to just hide all the language elements that were not the current language on page load, but then you would have a horrible mess on the page until the JS executes to hide them. I guess you could mitigate that by putting a CSS selector in like [lang!="en"] { display: none; }
and ensure the CSS is loaded before render, but this would likely have little effect on search engine indexing.
Hi! Thank you so much for explaining.. understood!! ;-) Have a nice week!!
So can it be used like this?
or even better like this