My app allows users to translate titles and descriptions in downloaded documents between languages using Google Translate.
This works fine between "normal" European languages but I have a problem with Russian (and I guess with any language that uses character codes beyond UTF8). While I can get English text translated to Russian, I have not (yet) found the trick to do Russian to English.
English to Russian
I send "https://Translate.googleapis.com/translate_a/single","client=gtx&sl=en&tl=ru&dt=t&q=Gray's Anatomy. This is the printed version of the 20th edititon (1918) of Gray's Anatomy, an English-language textbook of human anatomy"
and I get: "Анатомия Грея. ","Gray's Anatomy. Это печатная версия 20-го редактирования (1918 г.) «Анатомия Грея», англоязычного учебника по анатомии человека. "
German to English
I send "https://Translate.googleapis.com/translate_a/single","Max und Moritz Buch. Ein Klassiker der deutschen Kinderliteratur. In sieben Streichen ärgern die zwei Jungen die Mitbewohner ihres Dorfes. Gott sei Dank! Nun ist's vorbei mit der Übeltäterei!"
and I get: "Max and Moritz book. A classic of German children's literature. In seven strokes, the two boys annoy the roommates of their village. Thank God! Now it's over with the malaise!"
French to Russian
I send "https://Translate.googleapis.com/translate_a/single","La maîtrise de l’information passe par l’information maîtrisée."
and I get "Контроль информации проходит через контролируемую информацию. "
One can debate the quality of the translations, but at least the user gets the gist of it.
Russian to English (using su.EncodeUrl(iString,"UTF16") before sending and upon su.DecodeURL(iString,"UTF16") upon return)
I send "https://Translate.googleapis.com/translate_a/single","client=gtx&sl=ru&tl=en&dt=t&q=Африка к Югу от Сахары Развитие эпидемии СПИДа Pегиональное резюме."
and I get ""РђС \"СЂРёРєР ° Рє Югу РѕС, РЎР ° С ... Р ° СЂС \u003cР Р ° Р ·...." in return - totally useless
I tried different decodings including bytes to string (although I don't fully understand how this is supposed to work).
Does anyone know where I goofed up. Your helps is greatly appreciated. Thank you,
john m.
This works fine between "normal" European languages but I have a problem with Russian (and I guess with any language that uses character codes beyond UTF8). While I can get English text translated to Russian, I have not (yet) found the trick to do Russian to English.
English to Russian
I send "https://Translate.googleapis.com/translate_a/single","client=gtx&sl=en&tl=ru&dt=t&q=Gray's Anatomy. This is the printed version of the 20th edititon (1918) of Gray's Anatomy, an English-language textbook of human anatomy"
and I get: "Анатомия Грея. ","Gray's Anatomy. Это печатная версия 20-го редактирования (1918 г.) «Анатомия Грея», англоязычного учебника по анатомии человека. "
German to English
I send "https://Translate.googleapis.com/translate_a/single","Max und Moritz Buch. Ein Klassiker der deutschen Kinderliteratur. In sieben Streichen ärgern die zwei Jungen die Mitbewohner ihres Dorfes. Gott sei Dank! Nun ist's vorbei mit der Übeltäterei!"
and I get: "Max and Moritz book. A classic of German children's literature. In seven strokes, the two boys annoy the roommates of their village. Thank God! Now it's over with the malaise!"
French to Russian
I send "https://Translate.googleapis.com/translate_a/single","La maîtrise de l’information passe par l’information maîtrisée."
and I get "Контроль информации проходит через контролируемую информацию. "
One can debate the quality of the translations, but at least the user gets the gist of it.
Russian to English (using su.EncodeUrl(iString,"UTF16") before sending and upon su.DecodeURL(iString,"UTF16") upon return)
I send "https://Translate.googleapis.com/translate_a/single","client=gtx&sl=ru&tl=en&dt=t&q=Африка к Югу от Сахары Развитие эпидемии СПИДа Pегиональное резюме."
and I get ""РђС \"СЂРёРєР ° Рє Югу РѕС, РЎР ° С ... Р ° СЂС \u003cР Р ° Р ·...." in return - totally useless
I tried different decodings including bytes to string (although I don't fully understand how this is supposed to work).
Does anyone know where I goofed up. Your helps is greatly appreciated. Thank you,
john m.