Skip to content

The translated text has an additional prefix(some irrelevant symbols) #448

@Honghe

Description

@Honghe

Before submitting, please confirm that:

  • I am using async/await syntax (non-sync calls are not supported since 4.0.0)
  • This is not a rate-limiting issue or about exceeding the 15k character limit (Google's rate limits are not a library bug)
  • I have checked the README for basic usage, known limitations, and have searched existing issues

Googletrans version

4.0.1+

Issue Type

Bug Report

Current Behavior

code:

import asyncio
from googletrans import Translator

translator = Translator()

async def main():
    text = 'How `this` works in JavaScript (spoiler: nobody really knows)'
    result = await translator.translate(text, src='en', dest='zh-cn')
    print(result.text)

asyncio.run(main())

output:

````this''在javaScript中起作用(剧透:没人知道)

expected output:

`this`在javaScript中起作用(剧透:没人知道)

That is, The translated text has an additional prefix: "```"

But translate.google.com is ok:

Image

Expected Behavior

expected output:

`this''在javaScript中起作用(剧透:没人知道)

Steps to Reproduce

No response

Related Code

No response

Other Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions