Home  >  Article  >  Software Tutorial  >  How to solve the problem that Chrome cannot translate this webpage

How to solve the problem that Chrome cannot translate this webpage

PHPz
PHPzOriginal
2024-07-22 12:13:13671browse

Google Chrome is an easy-to-use browsing software with powerful functions and a built-in translation function to facilitate users to browse foreign language pages. However, recently some users have reported that the built-in translation function cannot be used and they don’t know what’s going on. , in response to this problem, this article brings a detailed solution, share it with everyone, let’s take a look. How to solve the problem that Chrome cannot translate this web page? Method 1: Install a third-party translation plug-in for the Chrome browser (such as Tencent Translate, etc., you can search for which translation plug-in is better), search for the relevant plug-in in the Chrome browser's app store, and then install it. Method 2: Modify the computer’s hosts file (highly recommended). The IP addresses used by Google’s relevant websites operating in China are all shared, including the Google Translate business. Therefore, after finding the Google server IP address that is still available in China, Add it to the hosts file of the operating system so that it maps to the domain name used by the Google Translate API, and the Chrome translation function can be used normally. The specific operation method is as follows: The first step is to obtain the Google server IP address. Click the magnifying glass icon in the lower left corner of the computer to bring up the search function, then enter "Command Prompt" in the search bar, search for the "Command Prompt" application and click to open it.

Chrome谷歌浏览器无法翻译此网页怎么解决

Open the "Command Prompt", enter the following command and press Enter: nslookup google.cn can obtain information similar to the picture below, in which the last line is the available IP address:

Chrome谷歌浏览器无法翻译此网页怎么解决

Step 2: Modify the Hosts file

Do you need to modify the Hosts file on your computer, but are troubled by system permission restrictions? In Windows operating systems, the Hosts file is a system file, so you need to be a system administrator to edit or modify it. PHP editor Xiaoxin will guide you here on how to obtain system administrator permissions, easily enable editing permissions on the Hosts file, and solve your problem. The following content will detail the steps to obtain system administrator rights and edit the Hosts file to help you solve the problem efficiently.

Specific steps:

  1. Click the Windows icon in the lower right corner to open all programs.
  2. Find "Notepad" in "Windows Accessories".
  3. Right-click and select "More" > "Run as administrator".

    Chrome谷歌浏览器无法翻译此网页怎么解决

    Open the hosts file in Notepad. The steps are as follows: "File" - "Open" at the top of Notepad to open the hosts file according to the path. hosts file path C: WindowsSystem32driversetchosts

    Chrome谷歌浏览器无法翻译此网页怎么解决

    Note: The Notepad program only displays text files by default. You need to select "File Type" as All to see the hosts file.

    Chrome谷歌浏览器无法翻译此网页怎么解决

    Combine the IP you obtained and the domain name of the Google Translate API into a hosts rule, and add it to the last line of the hosts file. After saving the file, restart the computer and restart the Chrome translation function to resume normal use.

hosts rules (copy these 2 rules to the last line in the hosts file)

  1. 203.208.41.34 translate.google.com
  2. 203.208.41.34 translate.googleapis.com

    Chrome谷歌浏览器无法翻译此网页怎么解决

    Note: The IP may change in the future If it fails, you just need to follow the above method to get the modification again.

macOS system

The method to obtain available IP in macOS system is to open "Terminal", enter the following command and press Enter:

<code>nslookup google.cn</code>

If the Internet connection is normal, you can obtain information similar to the following, where the last One line is the available IP addresses:

<code>Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
Name: google.cn
Address: 180.163.151.34</code>

Since the hosts file is a system file, editing it requires administrator status. It is recommended to open the hosts file as an administrator through the vim editor that comes with the system. The specific method is to run the following command on the terminal and press Enter. After the password prompt appears, enter the login password you set for the current account and press Enter to open it.

<code>sudo vim /etc/hosts</code>

Finally, as shown below, combine the IP you obtained and the domain name of the Google Translate API into a hosts rule, and add it to the last line of the hosts file. After saving the file, the Chrome translation function can resume normal use. .

<code>180.163.151.34 translate.googleapis.com</code>

添加的具体方法为,先按住【Shift】键,然后双击字母【G】键,将文本光标定位到最后一行,然后按字母【O】键进入插入模式,将上述规则输入(或粘贴)进来。最后按【Esc】键退出插入模式,输入 :x 保存并退出 vim 编辑器。文件保存成功后,Chrome 翻译功能即可恢复正常。

如果今后想要删掉添加的这条规则,和添加时的操作一样,打开 hosts 文件将其删除即可。

The above is the detailed content of How to solve the problem that Chrome cannot translate this webpage. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn