1.下载安装SwitchHosts SwitchHosts

官网:https://swh.app/
如果你网络不好,我下载了一份Windows x64版在蓝奏云盘
https://wwm.lanzouw.com/iP7RT0ddlo3a 密码:8hp4

2.添加hosts文件

点击SwitchHosts左上角的+号,添加一个本地hosts,名字自己起 180.163.151.34 translate.googleapis.com

3.修改hosts文件

然后把这行文字复制进去保存:180.163.151.34 translate.googleapis.com

4.SwitchHosts使用方法

找到你刚才起的名字,点击旁边的小开关即可开启,然后就可以顺利使用谷歌翻译插件了

5. QA:无法提示修改hosts没有权限

Windows用户

windows用户修改第一次修改hosts文件可能涉及到修改权限,可以定位到 C:\Windows\System32\drivers\etc\hosts 然后找到hosts文件,右键-属性-安全-点击编辑-在组或者用户选择User这一项(当前登录的用户),把修改和写入的权限勾选,然后点击确定,再弹出来的对话框选择是,然后逐步确定退出即可。

Mac用户

Mac用户比较简单,直接输入电脑密码即可。
当然网上也有一些一键的脚本,不过是针对谷歌翻译的,如果用这个SwitchHosts管理hosts的话,初次修改,Windows小白用户可能麻烦点,不过日后可与使用起来非常方便,可以使用一些hosts加速GitHub或者Google等等奇怪的技巧。

手动改host复活谷歌翻译

Google翻译API突然不能用,其原因是Google重定向了中国的Google翻译网页版,直接把API也重定向了,所以我们通过修改hosts文件来实现谷歌翻译复活。

hosts路径:首先我们要知道我们的系统的hosts文件在哪里。下面给出了win、mac、Linux、Android和IOS的路径

Windows:C:\Windows\System32\drivers\etc\hosts

Mac:/etc/hosts

Linux:/etc/hosts

Android:/system/etc/hosts

iOS:/etc/hosts

找谷歌国内IP :谷歌在国内有很多服务器,我们要找到离自己最近的谷歌服务器IP,可以通过ping的方法,按win键+R,然后输入ping google.cn -t,按确定。

然后就能ping出你目前连得到的谷歌服务器IP地址,我的这里是203.208.40.66,记住这个IP地址。
上面是获取谷歌IP地址最直接的方法,当然你也可以打开下面的网址:https://ping.chinaz.com/translate.google.cn
自己找找离自己近一点的,比如我在广东,找广州的IP地址也可以。

修改hosts:上面找到了hotst所在的地址,用记事本打开hosts文件,把“地址+空格+translate.googleapis.com”输入在最后面。
例如我输入的是:
203.208.40.98 translate.googleapis.com

温馨提示:hosts文件如果是设置为只读了,可能会修改不了,大家右键-属性,然后把“只读”去掉勾即可。

最后保存,保存后再用谷歌即可正常翻译了,来看看我的浏览器,能正常翻译了喔!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
142.250.111.90 translate.googleapis.com
172.217.215.90 translate.googleapis.com
142.250.11.90 translate.googleapis.com
142.251.9.90 translate.googleapis.com
108.177.122.90 translate.googleapis.com
142.250.96.90 translate.googleapis.com
142.250.100.90 translate.googleapis.com
142.250.110.90 translate.googleapis.com
172.217.214.90 translate.googleapis.com
172.217.222.90 translate.googleapis.com
142.250.31.90 translate.googleapis.com
142.250.126.90 translate.googleapis.com
142.250.10.90 translate.googleapis.com
172.217.195.90 translate.googleapis.com
172.253.115.90 translate.googleapis.com
142.251.5.90 translate.googleapis.com
142.250.136.90 translate.googleapis.com
142.250.12.90 translate.googleapis.com
142.250.101.90 translate.googleapis.com
172.217.192.90 translate.googleapis.com
142.250.0.90 translate.googleapis.com
142.250.107.90 translate.googleapis.com
172.217.204.90 translate.googleapis.com
142.250.28.90 translate.googleapis.com
142.250.125.90 translate.googleapis.com
172.253.124.90 translate.googleapis.com
142.250.8.90 translate.googleapis.com
142.250.128.90 translate.googleapis.com
142.250.112.90 translate.googleapis.com
142.250.27.90 translate.googleapis.com
142.250.105.90 translate.googleapis.com
172.253.126.90 translate.googleapis.com
172.253.123.90 translate.googleapis.com
172.253.122.90 translate.googleapis.com
172.253.62.90 translate.googleapis.com
142.250.98.90 translate.googleapis.com
142.250.185.238 translate.googleapis.com
142.251.116.101 translate.googleapis.com
216.58.214.14 translate.googleapis.com
142.250.189.206 translate.googleapis.com
216.58.209.174 translate.googleapis.com
142.250.203.142 translate.googleapis.com
142.250.218.14 translate.googleapis.com
142.251.10.138 translate.googleapis.com
142.251.40.174 translate.googleapis.com
142.250.185.174 translate.googleapis.com
172.217.16.46 translate.googleapis.com
172.217.0.46 translate.googleapis.com
172.217.31.142 translate.googleapis.com
216.58.220.142 translate.googleapis.com
172.217.13.142 translate.googleapis.com
142.250.110.90 translate.googleapis.com
172.217.203.90 translate.googleapis.com
172.253.112.90 translate.googleapis.com