locked
Is 'From' language parameter reqired for Microsoft Translator? RRS feed

Answers

  • Hi Mara,

    I agree that the error message could be better.

    Recommend something like this:

    For unknown origin content

    try {Translate with source language empty}

    catch (you received invalid source language error)

    {

    if (you can determine the source language from context) {set it from context}

    else {copy source to target}

    }

    Chris Wendt
    Microsoft Translator
    Friday, September 4, 2015 12:49 AM

All replies

  • My picture is not get saved somewhow, so I tried to Translate simple text 'Falso Positivo' to English without providing From parameter and had an error

    'Bad Request; <html><body><h1>Argument Exception</h1><p>Method: Translate()</p><p>Parameter: from</p><p>Message: 'from' must be a valid language&#xD;
    Parameter name: from</p><code></code><p>message id=3427.V2_Rest.Translate.53CA8106</p></body></html> (400)



    Thursday, September 3, 2015 1:28 AM
  • Hi Mara,

    No the from parameter is not required. See here for more details: https://msdn.microsoft.com/en-us/library/ff512421.aspx

    Olivier


    Microsoft Translator team - www.microsoft.com/Translator

    Thursday, September 3, 2015 3:16 PM
  • Hi Mara,

    I agree that the error message could be better.

    Recommend something like this:

    For unknown origin content

    try {Translate with source language empty}

    catch (you received invalid source language error)

    {

    if (you can determine the source language from context) {set it from context}

    else {copy source to target}

    }

    Chris Wendt
    Microsoft Translator
    Friday, September 4, 2015 12:49 AM
  • Thank you, Chris!

    This works!

    -Mara




    Friday, September 4, 2015 3:39 PM