跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[问与答] 使用 Google Translate 翻译国家名称的时候容易翻译错

发表于

def translate_text(text, target_language='zh-cn', max_retries=3): translation = None retries = 0

translator = Translator(service_urls=['translate.googleapis.com'], user_agent=get_random_user_agent())

while translation is None and retries < max_retries:
    try:
        translation = translator.translate(text, dest=target_language).text
        sleep(1)
    except Exception as e:
        if retries >= 2:
            sleep(5)
            retries += 1
            continue
if translation is None:
    logging.warning(f"Translation <<<{text}>>> failed: {e}, have retry {retries} times, will jump to next line.")
    return text
else:
    logging.info(f"Translation <<<{text}>>> success: {translation}")
    return translation
    
    

2024-06-27 16:17:57 INFO Translation <<<Georgia>>> success: 乔治亚州 2024-06-27 16:17:58 INFO Translation <<<Portugal>>> success: 葡萄牙 2024-06-27 16:17:58 INFO Translated countries: ['乔治亚州', '葡萄牙']

Georgia 没有正确的翻译成格鲁吉亚,而是翻译成了乔治亚州,Turkey 翻译成了火鸡

这个有办法设置吗? Google 了一圈资料,没看到解决办法

Featured Replies

No posts to show

创建帐户或登录来提出意见

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.