关于我们

质量为本、客户为根、勇于拼搏、务实创新

< 返回新闻公共列表

最新谷歌浏览器修复谷歌翻译方法

发布时间:2023-06-27 14:01:03

谷歌浏览器网页翻译修复BAT脚本

由于谷歌翻译退出了中国市场,下边使用BAT脚本的方式也因为调整无法使用了。好在Github上有大佬开发了一个程序,可以自动选择离你最近的翻译IP地址,让谷歌翻译重获新生。下载资源如下

https://download.csdn.net/download/qq_35921773/87432536

注意要以管理员方式运行

1. 脚本功能

谷歌浏览器因为翻译所需的服务需要翻墙才能请求到,所以这里使用脚本

修改谷歌翻译的host和刷新dns。让谷歌翻译重新可用。

2. 脚本内容

@setlocal enabledelayedexpansion @echo off  set "source_domain=google.cn" set "target_domain=translate.googleapis.com"  set "hosts_file=C:\Windows\System32\drivers\etc\hosts"  ::for /f "skip=4 tokens=2" %%a in ('"nslookup %source_domain% 2>NUL"') do set ip=%%a set "ip=172.253.124.90" set "old_rule=null" set "new_rule=%ip% %target_domain%"  for /f "tokens=*" %%i in ('type %hosts_file%') do (  set "line=%%i"  :: Retrieve the rule If the target domain has been exists in the line.  if not "!line:%target_domain%=!"=="%%i" set "old_rule=%%i" )  if not "%old_rule%"=="null" (  if not "%old_rule%"=="%new_rule%" (  echo Deleting the rule "%old_rule%"  echo Adding the rule "%new_rule%"  for /f "tokens=*" %%i in ('type "%hosts_file%" ^| find /v /n "" ^& break ^> "%hosts_file%"') do (  set "rule=%%i"  set "rule=!rule:*]=!"  if "%old_rule%"=="!rule!" set "rule=%new_rule%"  >>%hosts_file% echo(!rule!  )  ) else (  echo The rule already exists, nothing to do.  ) ) else (  echo Adding the rule "%new_rule%"  echo.>>%hosts_file%  echo.>>%hosts_file%  echo # Fix Google Translate CN>>%hosts_file%  echo %new_rule%>>%hosts_file% )  @ipconfig /flushdns @echo "修改谷歌翻译和刷新dns完成,请关闭!" echo Done. pause

   

3. 使用方式

  1. 新建repireGoogle.bat文件。
  2. 编辑,把上面的脚本内容粘贴进去。
  3. 然后双击执行repireGoogle.bat。
  4. 重启谷歌浏览器

/template/Home/leiyu/PC/Static