admin管理员组

文章数量:1665486

各位大佬们,别说不可以了,是你自己搞不定。请解压后,管理员运行

20221107更新
国内的360,QQ等大部分浏览器由于都是使用的谷歌翻译,所以本方法对绝大部分浏览器都有效。

https://wws.lanzoub/b00w5kbti

值得一提的是,软件支持不仅支持 Windows,还提供了对 Mac,Linux 的支持,操作是一样的。

由于 Github 下载速度实在太慢,一旦发现 Chrome 右键翻译失效,只需要再运行一次就好了

// 旧方法失效

9月30日发现 Chrome 的右键网页翻译突然失效了,遇到其他语言的网站,Chrome 右键的网页翻译真乃神器。

然而国庆假期都要结束了,翻译服务仍然不能正常使用。具体如下图:

原来,Google 发言人称因“使用率太低”谷歌翻译服务已正式退出中国。

这就导致了两个问题:

  1. Chrome 浏览器的右键网页翻译功能无法使用,同时受影响的还有国内大部分套壳浏览器。
  2. translate.google 已废弃,不再可用。

一步恢复 Chrome 右键网页翻译功能。

新建一个bat文件,内容如下:

:: Copyright (c)2022 https://bookfere
:: This is a batch script for fixing Google Translate and making it available
:: in the Chinese mainland. If you experience any problem, visit the page below:
:: https://bookfere/post/1020.html

@setlocal enabledelayedexpansion
@echo off

set "source_domain=google"
set "target_domain=translate.googleapis"

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 "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%
)

echo Done.
pause

在批处理文件上点击右键,在弹出的菜单中点击【以管理员身份运行】即可。

原理十分简单,就是获取谷歌翻译国内的地址,然后将该地址加入系统的 hosts 文件中。
220.181.174.162 translate.googleapis
脚本已自动为大家完成了上述操作,同时智能选择了最快的翻译服务器。

添加完成后,重启 Chrome 浏览器再试试看。

本文标签: 右键歌网chrome