0

I can see a list of examples of how to use react-helmet to change

<html lang='en|es|ti|'>

Below I have public/index.html and please suggest me step-by-step procedure to adopt react-helmet. Since index.html is a static html, outside of react root and so I am kind of misaligned.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charSet='utf-8'></meta>
  <meta http-equiv='x-ua-compatible' content='ie=edge'></meta>
  <meta name='format-detection' content='telephone=no'></meta>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>

If I change

<html lang="es"> 

dynamically, will my page translated to spanish ? Is there a proper way to do ?

kulls
  • 845
  • 2
  • 12
  • 37
  • 1
    Where is your React code? Have you followed the instructions in the react-helmet [README](https://github.com/nfl/react-helmet#readme)? Please edit your question to include the code you've written so far. – Jordan Running Oct 22 '19 at 17:41
  • it's absolutely normal to have it outside of react root. Otherwise you could just use plain React to change the attributes. `react-helmet` works directly on DOM. – marzelin Oct 22 '19 at 17:50
  • Got it. I can see a changes. I have another question. If Someone change the language, I am changing html lang='lang' property. But the page is not translated to the selected one. am i missing anything ? – kulls Oct 22 '19 at 17:58
  • @kulls lang attribute does not translate the page. It is used so that search engines and crawlers can identify the language in which the page is written. see https://developer.paciellogroup.com/blog/2016/06/using-the-html-lang-attribute/ – rupindr Oct 22 '19 at 18:15

0 Answers0