Capitalized text with "notranslate" MS Translator Text

Martin Sommer 21 Reputation points
2020-12-09T09:56:05.393+00:00

Hi there,

I've an issue with the "notranslate" annotation for HTML translation.

Some background: We've an icon font which uses the CSS class "my-icon". During translation the icon has to be excluded from translation to not alter the icon. Thus we add the CSS class "notranslate" like in the documentation.

Here the doc: https://learn.microsoft.com/en-us/azure/cognitive-services/translator/reference/v3-0-translate#translate-content-with-markup-and-decide-whats-translated

The problem: For some target languages the text inside the "notranslate" container is capitalized and for some target languages it's not.

Minimal example:

curl -X POST -v "https://api-eur.cognitive.microsofttranslator.com/translate?api-version=3.0&from=de&to=en&textType=html" -H "Ocp-Apim-Subscription-Key: XXXXXX" -H "Content-Type: application/json; charset=UTF-8" -d "[{'Text':'<span class=\"my-icon notranslate\">m</span>'}]"

Response with upper case "M" instead of "m":

[
{
"translations": [
{
"text": "<span class=\"my-icon notranslate\">M</span>",
"to": "en"
}
]
}
]

When changing the target language to "fr" it remains lower case. Thus I guess it's not indented.

Does anyone has a clue if this is "correct" behavior or not?

Azure Translator
Azure Translator
An Azure service to easily conduct machine translation with a simple REST API call.
392 questions
0 comments No comments
{count} votes

Accepted answer
  1. romungi-MSFT 45,731 Reputation points Microsoft Employee
    2020-12-11T06:32:20.537+00:00

    @Martin Sommer I have tried the same request through postman for my resource with the global endpoint api.cognitive.microsofttranslator.com and the one above. In both scenarios the case of the text did not change to upper. The behavior seen in your case might be intermittent, you could raise a support issue for your issue from Azure portal if a similar behavior is seen consistently.

    47268-image.png

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Martin Sommer 21 Reputation points
    2020-12-14T07:37:35.43+00:00

    @romungi-MSFT Thanks you for your answer.

    I've re-tested this a couple of days later and now the EU endpoint also returns the expected result. So now all content in "notranslate" tags stay lower case.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.