firebase / extensions

Source code for official Firebase extensions
https://firebase.google.com/products/extensions
Apache License 2.0
886 stars 376 forks source link

[firestore-Translate Text] Hindi as a source language isn't getting translated #659

Open itssidhere opened 3 years ago

itssidhere commented 3 years ago

[READ] Step 1: Are you in the right place?

Issues filed here should be about bugs for a specific extension in this repository. If you have a general question, need help debugging, or fall into some other category use one of these other channels:

[REQUIRED] Step 2: Describe your configuration

[REQUIRED] Step 3: Describe the problem

When I am setting the text to be translated in Hindi, the text isn't getting translated. Though it works in google translator.

Steps to reproduce:

Set the text "Mera naam siddharth hai"

Expected result

en: My name is Siddharth

Actual result

Mera naam Siddharth hai

jhuleatt commented 3 years ago

@itssidhere can you please post the configuration you used for the extension (step 2 in the issue template)? Hindi is a supported language, and should be configured as hi

itssidhere commented 3 years ago

I mean it gets translated to Hindi but not from Hindi @jhuleatt . It gets translated from every language except hindi.

itssidhere commented 3 years ago

@jhuleatt I get the same text as the source from the extension when the input data is in Hindi. Can you try reproducing it from the steps I have mentioned, please?

dackers86 commented 3 years ago

hi @itssidhere.

I have managed to successfully replicate the issue. Interestingly, this works as expected through Google Translate...

https://translate.google.com/?sl=hi&tl=en&text=Mera%20naam%20siddharth%20hai&op=translate

Using Hindi scripture also seems to work as expected...

image

but not when using Mera naam siddharth hai through the extension.

The extension utilises the Node Api library, which under the hood calls the v2 rest Api endpoint. This endpoint returns the same response...

https://translation.googleapis.com/language/translate/v2?key=

Body:

{
  "q": ["Mera naam siddharth hai"],
  "target": "en"
}

Response:

{
    "data": {
        "translations": [
            {
                "translatedText": "Mera naam siddharth hai",
                "detectedSourceLanguage": "hi"
            }
        ]
    }
}
itssidhere commented 3 years ago

@dackers86 This also happens with the ML kit.

yamankatby commented 2 years ago

Hi there, This doesn't seem to be an issue in the extension since the translation API returns the same response.

capture

TL;DR;

As I understood, the provided example sentence isn't official Hindi, it's something called "Hindi Latin-Phonetics". It's not official and not widely supported, however, some translating services such as translate.google.com (the website) use an extra algorithm called phonetics converter allows non-Latin languages to be written with Latin characters.

For example, translation from Arabic using Latin letters:

Screen Shot 2022-08-05 at 14 27 41