English translation on the project after line problem solving

The author is currently experiencing both cases, respectively, have carried out their solutions, if you meet the other words on your browser for the project due to translation problems can comment below. It will be the first time and you solve them together.

One problem: Google browser will help customers automatically translate English websites

Solution:
If you are a single-page application, then please take a look at your outermost html lang attribute whether the zh-CN. If the default is en Please change it to "zh-CN". In this way Google browser will not automatically translate your project.
If it is not one-page application, then it should be in every one of your html tags are added lang = "zh-CN"

Question two: part of the project to be translated in English, some do not require translation.

Solution 1:
Do not operate your html lang attribute, let him continue to "en". The code then you do not want to let him part with the translation of "<code> </ code> tag wrapped up." The contents of this code tag that is not translated. [Currently I use code label is no problem. There are other labels can also be treated. Interested friends can look at study share to more friends in the comments below ~]

Solution 2:
Give your elements plus class = "notranslate" so this will not be translated.
When the next major browsers began to support translate the elements can be added directly to: translate = "no"

example:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
    </style>
</head>
<body>
    <div>
        test
        width
        height
        border
    </div>
    <div class="notranslate">
        madam
    </div>
    father
</body>
</html>

effect:
Here Insert Picture Description

If my friends have any other questions please comment below Oh, we solve them together -

Published 293 original articles · won praise 2381 · Views 3.14 million +

Guess you like

Origin blog.csdn.net/weixin_43606158/article/details/104480648