[Bug]: Google translate feature translate to my native language instead of the language i select.
NaGeL182 opened this issue · comments
Checklist
- This is an issue for Hyperchat, not LiveTL. I will go to the LiveTL repo to report an issue with LiveTL.
- This issue is not a matter of opinion. If it is, I will use the feature suggestion issue template.
- I have checked for a duplicate or similar issue. I made sure to check closed issues as well.
- I am still able to reproduce the issue after I reinstall the extension.
- I have clear instructions to reproduce the bug, even on another machine.
- I am not suggesting a feature. If I am, I will use the feature suggestion issue template.
- By submitting this issue, you agree to follow our Code of Conduct
Describe the bug
Google translate translates all messages to my native language which I think it is, instead of the language I select it as.
Steps To Reproduce
- Enable Google translate
- Select a language that is not your native language
- Still translates to your native language, or rather what google think it is.
Expected behavior
That it translates to the language i selected.
What browsers are you seeing the problem on?
Other (Put it in the "Anything else?" section)
Anything else?
Vivaldi which is Chromium basedChromium-based
oh I see, so that's why some people were saying selecting English translates to Indonesian! I'll look into this
@NaGeL182 @toruzz could you try out https://github.com/LiveTL/HyperChat/releases/tag/v2.3.2 and let me know if it fixes ur issue?
@NaGeL182 @toruzz could you try out https://github.com/LiveTL/HyperChat/releases/tag/v2.3.2 and let me know if it fixes ur issue?
It seems like it's not getting the selected target language right. When I choose English it translates into Sinhala, when I choose Afrikaans it translates into Spanish, etc.
pain peko
I played a bit around using the v2.3.2 version of Hyperchat and the current master of the iframe-translator and it seems that the list of target languages is being translated, which causes some weird issues with the array indices.
e.g. Using a German system the list of languages which are used to select the correct target is something like:
Deutsch (German)
Afrikaans
Albanisch
Amharisch
The list is translated and later sorted using those translated names. Another interesting exception is that the system language, German, is at the start of the list.
Selecting English as the target, seems to produce messages in Filipino. Looking again at the 2 lists we can see that English is at the index of 21 in the list used by the iframe-translator library. Looking at the German list we can see Filipino at that position in the list. Similarly you can get German messages by selecting Afrikaans in the UI because the entry for "German" has the index 0.
My JavaScript/Typescript is sadly not that good which is why I can't create a fix for that problem, but maybe you can use the provided information to fetch the correct list of languages, without any applied translations
I pinned down the issue to the language drop down being translated too, yeah. Haven't been able to find a good fix yet
Could you screenshot the output for these two variables inside the hidden iframe? I'm in the US so it makes it a bit harder for me to test.
google.translate.TranslateElement.getInstance().B
google.translate.TranslateElement.getInstance().Ba
i'd appreciate if you could just paste these 2 lines into the console within the iframe context and lemme know what the two outputs look like (either copy-paste or screenshot).
Content of the first line:
{
"de": "Deutsch",
"af": "Afrikaans",
"sq": "Albanisch",
"am": "Amharisch",
"ar": "Arabisch",
"hy": "Armenisch",
"az": "Aserbaidschanisch",
"eu": "Baskisch",
"be": "Belarussisch",
"bn": "Bengalisch",
"my": "Birmanisch",
"bs": "Bosnisch",
"bg": "Bulgarisch",
"ceb": "Cebuano",
"ny": "Chichewa",
"zh-TW": "Chinesisch (traditionell)",
"zh-CN": "Chinesisch (vereinfacht)",
"da": "Dänisch",
"en": "Englisch",
"eo": "Esperanto",
"et": "Estnisch",
"tl": "Filipino",
"fi": "Finnisch",
"fr": "Französisch",
"fy": "Friesisch",
"gl": "Galizisch",
"ka": "Georgisch",
"el": "Griechisch",
"gu": "Gujarati",
"ht": "Haitianisch",
"ha": "Hausa",
"haw": "Hawaiisch",
"iw": "Hebräisch",
"hi": "Hindi",
"hmn": "Hmong",
"ig": "Igbo",
"id": "Indonesisch",
"ga": "Irisch",
"is": "Isländisch",
"it": "Italienisch",
"ja": "Japanisch",
"jw": "Javanisch",
"yi": "Jiddisch",
"kn": "Kannada",
"kk": "Kasachisch",
"ca": "Katalanisch",
"km": "Khmer",
"rw": "Kinyarwanda",
"ky": "Kirgisisch",
"ko": "Koreanisch",
"co": "Korsisch",
"hr": "Kroatisch",
"ku": "Kurdisch (Kurmandschi)",
"lo": "Lao",
"la": "Lateinisch",
"lv": "Lettisch",
"lt": "Litauisch",
"lb": "Luxemburgisch",
"mg": "Malagasy",
"ml": "Malayalam",
"ms": "Malaysisch",
"mt": "Maltesisch",
"mi": "Maori",
"mr": "Marathi",
"mk": "Mazedonisch",
"mn": "Mongolisch",
"ne": "Nepalesisch",
"nl": "Niederländisch",
"no": "Norwegisch",
"or": "Odia (Oriya)",
"ps": "Paschtu",
"fa": "Persisch",
"pl": "Polnisch",
"pt": "Portugiesisch",
"pa": "Punjabi",
"ro": "Rumänisch",
"ru": "Russisch",
"sm": "Samoanisch",
"gd": "Schottisch-Gälisch",
"sv": "Schwedisch",
"sr": "Serbisch",
"st": "Sesotho",
"sn": "Shona",
"sd": "Sindhi",
"si": "Singhalesisch",
"sk": "Slowakisch",
"sl": "Slowenisch",
"so": "Somali",
"es": "Spanisch",
"sw": "Suaheli",
"su": "Sundanesisch",
"tg": "Tadschikisch",
"ta": "Tamil",
"tt": "Tatarisch",
"te": "Telugu",
"th": "Thailändisch",
"cs": "Tschechisch",
"tr": "Türkisch",
"tk": "Turkmenisch",
"ug": "Uigurisch",
"uk": "Ukrainisch",
"hu": "Ungarisch",
"ur": "Urdu",
"uz": "Usbekisch",
"vi": "Vietnamesisch",
"cy": "Walisisch",
"xh": "Xhosa",
"yo": "Yoruba",
"zu": "Zulu"
}
Content of 2nd line:
{
"de": "Deutsch",
"af": "Afrikaans",
"sq": "Albanisch",
"am": "Amharisch",
"ar": "Arabisch",
"hy": "Armenisch",
"az": "Aserbaidschanisch",
"eu": "Baskisch",
"be": "Belarussisch",
"bn": "Bengalisch",
"my": "Birmanisch",
"bs": "Bosnisch",
"bg": "Bulgarisch",
"ceb": "Cebuano",
"ny": "Chichewa",
"zh-TW": "Chinesisch (traditionell)",
"zh-CN": "Chinesisch (vereinfacht)",
"da": "Dänisch",
"en": "Englisch",
"eo": "Esperanto",
"et": "Estnisch",
"tl": "Filipino",
"fi": "Finnisch",
"fr": "Französisch",
"fy": "Friesisch",
"gl": "Galizisch",
"ka": "Georgisch",
"el": "Griechisch",
"gu": "Gujarati",
"ht": "Haitianisch",
"ha": "Hausa",
"haw": "Hawaiisch",
"iw": "Hebräisch",
"hi": "Hindi",
"hmn": "Hmong",
"ig": "Igbo",
"id": "Indonesisch",
"ga": "Irisch",
"is": "Isländisch",
"it": "Italienisch",
"ja": "Japanisch",
"jw": "Javanisch",
"yi": "Jiddisch",
"kn": "Kannada",
"kk": "Kasachisch",
"ca": "Katalanisch",
"km": "Khmer",
"rw": "Kinyarwanda",
"ky": "Kirgisisch",
"ko": "Koreanisch",
"co": "Korsisch",
"hr": "Kroatisch",
"ku": "Kurdisch (Kurmandschi)",
"lo": "Lao",
"la": "Lateinisch",
"lv": "Lettisch",
"lt": "Litauisch",
"lb": "Luxemburgisch",
"mg": "Malagasy",
"ml": "Malayalam",
"ms": "Malaysisch",
"mt": "Maltesisch",
"mi": "Maori",
"mr": "Marathi",
"mk": "Mazedonisch",
"mn": "Mongolisch",
"ne": "Nepalesisch",
"nl": "Niederländisch",
"no": "Norwegisch",
"or": "Odia (Oriya)",
"ps": "Paschtu",
"fa": "Persisch",
"pl": "Polnisch",
"pt": "Portugiesisch",
"pa": "Punjabi",
"ro": "Rumänisch",
"ru": "Russisch",
"sm": "Samoanisch",
"gd": "Schottisch-Gälisch",
"sv": "Schwedisch",
"sr": "Serbisch",
"st": "Sesotho",
"sn": "Shona",
"sd": "Sindhi",
"si": "Singhalesisch",
"sk": "Slowakisch",
"sl": "Slowenisch",
"so": "Somali",
"es": "Spanisch",
"sw": "Suaheli",
"su": "Sundanesisch",
"tg": "Tadschikisch",
"ta": "Tamil",
"tt": "Tatarisch",
"te": "Telugu",
"th": "Thailändisch",
"cs": "Tschechisch",
"tr": "Türkisch",
"tk": "Turkmenisch",
"ug": "Uigurisch",
"uk": "Ukrainisch",
"hu": "Ungarisch",
"ur": "Urdu",
"uz": "Usbekisch",
"vi": "Vietnamesisch",
"cy": "Walisisch",
"xh": "Xhosa",
"yo": "Yoruba",
"zu": "Zulu"
}
I hope this helps
yep perfect, thanks so much! I know how to fix this now I think 🙂