[Python] Python translate module, untranslated text is not displayed

Discussão em 'Python' iniciado por Stack, Abril 19, 2025.

  1. Stack

    Stack Membro Participativo

    In translate, I've found that the text between '< >' isn't translated, it's displayed untranslated, which is what I want. However, it seems that if the text to be translated is too short, '< >' and the text within it aren't displayed. You can see this in the example. If the word 'pretty' is removed, '' isn't displayed. Can this be made to display regardless of the length of the text? If not, what is the minimum length for it to be displayed?

    from translate import Translator
    # pip install translate

    tra = Translator(from_lang='en', to_lang='es')

    untranslated = '<untranslated text>Subscribe to the pretty channel.'
    # untranslated = '<untranslated text>Subscribe to the channel.'

    print(tra.translate(untranslated))

    Continue reading...

Compartilhe esta Página