1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Skip specific terms with google tranlsate API

Discussion in 'Programming/Internet' started by Yasen, Sep 12, 2018.

  1. Yasen

    Yasen Guest

    I'm using Google Translate API and I want to know how to make it "skip" some phrases which should not be translated.

    I found that if I surround the phrase with <> it seems to be working:

    client.translate('Hey friend, bring me a <cold beer>.', target_language='it', source_language='en')


    Output:

    {'input': 'Hey friend, bring me a <cold beer>.', 'translatedText': 'Ehi amico, portami un <cold beer> .'}


    While if I remove the <> it's translated:

    {'input': 'Hey friend, bring me a cold beer.', 'translatedText': 'Ehi amico, portami una birra fredda.'}


    It this the right way to do it? I couldn't find it anywhere in the docs

    Login To add answer/comment
     

Share This Page