WeblateOrg / weblate

Web based localization tool with tight version control integration.
https://weblate.org/
GNU General Public License v3.0
4.64k stars 1.02k forks source link

Microsoft automatic translation fails for Serbian ("sr") #9565

Closed derkoe closed 1 year ago

derkoe commented 1 year ago

Describe the issue

For the locale Serbian - "sr" the automatic translation with Microsoft Translator does not work. There are no "Automatic suggestions" and the "Automatic translation" tool does not get any texts.

I already tried

Steps to reproduce the behavior

  1. Add Microsoft Translator to Weblate
  2. Create a project and component with the language "Serbian" - "sr"
  3. Go to /translate/{project}/{component}/sr/?q=state:<translated and see that no texts are suggested

Expected behavior

Automatic suggestions should be shown for Serbian.

Screenshots

No response

Exception traceback

No response

How do you run Weblate?

Docker container

Weblate versions

Weblate deploy checks

System check identified some issues:

INFOS:
?: (weblate.I021) Error collection is not set up, it is highly recommended for production use
        HINT: https://docs.weblate.org/en/latest/admin/install.html#collecting-errors

System check identified 1 issue (1 silenced).

Additional context

It seems that Microsoft translator treats "sr" as "sr-Latn".

For example:

POST https://api-eur.cognitive.microsofttranslator.com/translate?api-version=3.0&from=en&to=sr
Content-Type: application/json

[{"Text":"Hello World!"}]

gets the answer

[
  {
    "translations": [
      {
        "text": "Zdravo svete!",
        "to": "sr-Latn"
      }
    ]
  }
]

I think this has to be added to the language_map: https://github.com/WeblateOrg/weblate/blob/5674acc39e21ea092c0d2fba89569b802315595a/weblate/machinery/microsoft.py#L26

github-actions[bot] commented 1 year ago

Thank you for your report; the issue you have reported has just been fixed.