Google Cloud Translate - Serbian Latin not working

Viewed 56

I have used Google Translate APIs for translating from English to Serbian (with Latin characters).

Since few days ago, using en as source language and sr-Latn I was able to get correct translation but now it does not seem anymore.

Code snippet:

from google.cloud import translate

project_id = "<my project>"
parent = f"projects/{project_id}"
client = translate.TranslationServiceClient()

sample_text = "Hello!"
source_language_code = "en"
target_language_code = "sr-Latn"

response = client.translate_text(
    contents=[sample_text],
    source_language_code=source_language_code,
    target_language_code=target_language_code,
    parent=parent,
)

for translation in response.translations:
    print(translation.translated_text)

Actual output:

Здраво!

Expected output:

Zdravo!

Additional info: sr-Latn is a valid BCP-47 language code and worked since few days ago.

Thanks for you help

0 Answers
Related