pythongoslate

Python translation using goslate


i am building a translator that translates user input to french using python. I am however encountering a challenge where my goslate function does not catch user input and translate it. I will appreciate your help.

import goslate
gs = goslate.Goslate()

text = input("please input the word you would like translated:\n")
gs.translate(text,'fr')

Solution

  • You have to print the output or save it to a variable. E.g.

    import goslate
    gs = goslate.Goslate()
    text = input("please input the word you would like translated:\n")
    print(gs.translate(text,'fr'))
    

    Output:

    please input the word you would like translated:
    Hello
    Bonjour
    

    Check the documentation for more details.