Development :  K-Meleon Web Browser Forum
K-Meleon development related discussions. 
Pages: 12Next
Current Page: 1 of 2
Replace Google with Yandex on Translate menu
Posted by: gordon451
Date: September 20, 2018 10:22AM

OK, I've looked around the K-M folders, opened a few boxes, but there seem to be too many inter-locking puzzle pieces.

Exactly what do I need to do to replace Google, or even to allow myself to chose which translator? ATM I'm thinking about keeping it in my LUA profile, but if it works then I could move it to (make it global in) the Program Files K-M folder.

I'm fairly sure I need to alter at least 2 .js files, and .\{profile.default]\menus.cfg

____________________
Understanding the scope of the problem is the first step on the path to true panic. [Florence Ambrose, "Freefall" 01372 January 22, 2007 http://freefall.purrsia.com/ff1400/fv01372.htm]

Options: ReplyQuote
Re: Replace Google with Yandex on Translate menu
Posted by: siria
Date: September 23, 2018 10:32AM

Quote
gordon451
what do I need to do to replace Google, or even to allow myself to chose which translator? ATM I'm thinking about keeping it in my LUA profile, but if it works then I could move it to (make it global in) the Program Files K-M folder.

I'm fairly sure I need to alter at least 2 .js files, and .\{profile.default]\menus.cfg

1) Do you mean only single-word dictionary lookups? Which can be added as search-engine? Example (another because I don't have yandex):
https:/ /www.multitran.ru/c/m.exe?l1=1&l2=2&s=<word>
THAT is rather easy.

2) Or do you mean whole-page or selected-text translation? Like in the context menu "Translation"?
THAT I'm afraid is a lot more complicated.
Google translate is all done in a macro, which is only possible for a service that can get the original text in URL strings. Either the page URL, or selected text, all appended to the URL.
Have worked last year to improve the native GT macro (but as so often got carried away again and added buttons etc. and ended up with another unfinished monster macro, sigh.) In the beginning I had tried to also add more translator services, guess Bing-translator, but couldn't figure out how to do it with URL-strings, or if it's even possible.
In the end have decided with all those options and endless language subgroups it gets all far too complicated to still mix up different translators in 1 macro together, and just deleted the old non-existing babel translator stuff completely. That had involved to list every single language pair explicitely! Was okay in the far past, but now imagine all the possible pairings today...

But if you can tell which URL strings work for another translator, and need only a few fix language pairs not the whole GUI with endless pairs and default settings etc., it could be used as easily as a 1-word-dictionary link too.

Such strings are necessary for a fullpage or multitext macro:
https:/ /translate.google.com/translate?u=<url>&ie=UTF8&sl=<from>&tl=<to>"
https:/ /translate.google.com/translate_t?langpair=<from>|<to>&text=<txt>


Options: ReplyQuote
Re: Replace Google with Yandex on Translate menu
Posted by: gordon451
Date: September 25, 2018 01:00AM

Thanks for that siria. It's the whole-page/selected text bit I'm looking for.

I found a support page on Yandex, they have an API for "commercial" translation, I asked them if they could assist in getting a macro/js up to link into their web translator. We'll see how it goes.

____________________
Understanding the scope of the problem is the first step on the path to true panic. [Florence Ambrose, "Freefall" 01372 January 22, 2007 http://freefall.purrsia.com/ff1400/fv01372.htm]

Options: ReplyQuote
Re: Replace Google with Yandex on Translate menu
Posted by: gordon451
Date: October 06, 2018 09:57AM

Hi siria - Yandex finally got back to me. I guess their support team must be fairly busy!

Anyway, here's what they wrote:
Quote

Hello,

Please try our version with free-of-charge limits
( https://tech.yandex.com/translate/ ). Perhaps it will suit your purpose.


--
Sincerely yours, Platon
Yandex customer support
https://yandex.com/company/

I had a dekko at the pages, it looks reasonably easy for someone into light coding--I'd have to spend a month just getting into JSON and back into JS etc, and I'm so busy with work (which I love) I'm unable to come to this party.

However, a quick read indicates we can get a "selected text" or a whole page, as it appears the API figures out whether we sent a page URL or a paragraph of words. The only preprocessing we do is URL-encoding. I think. It appears to be not so different to what is currently done for Google.

____________________
Understanding the scope of the problem is the first step on the path to true panic. [Florence Ambrose, "Freefall" 01372 January 22, 2007 http://freefall.purrsia.com/ff1400/fv01372.htm]

Options: ReplyQuote
Re: Replace Google with Yandex on Translate menu
Posted by: siria
Date: October 06, 2018 12:06PM

I find it already amazing to just get a real answer, as a normal user.
And looks like they have very nice and clear Help pages.

But this translation API is far more complicated as Google's:
additionally to just calling a URL with parameters, it requires an own app or addon which calls it, and which transforms back the translated text into a readable layout, and additionally every user must get a yandex-account and create his own API-key to use it:
https://tech.yandex.com/translate/doc/dg/concepts/api-overview-docpage/

My suggestion would be to download now as quickly as possible all 'legacy' Firefox addons for Yandex, because they will all be deleted now or very soon by Mozilla. Especially this:
https://addons.mozilla.org/en-US/firefox/addon/yandex-translate-in-context/versions/
but probably also some others:
https://www.google.com/search?q=firefox+addon+yandex&num=30&gbv=1

Those addons probably need some menu tweaks to be usable in KM too, but that must be examined later, and probably by someone with more skills :cool:
Perhaps Chrome's "WebExtensions", the only addon type which Firefox allows now for their 'modern' Firefox versions too, can be adapted for KM later as well, perhaps even easier as XUL-addons, no idea, but at any rate would download NOW all important 'legacy' XUL-addons just in case, before they are all lost.

Options: ReplyQuote
Re: Replace Google with Yandex on Translate menu
Posted by: gordon451
Date: October 06, 2018 03:02PM

Quote
siria
... every user must get a yandex-account and create his own API-key to use it:
https://tech.yandex.com/translate/doc/dg/concepts/api-overview-docpage/
...

I disagree on this bit, I read it as the browser (kmeleonbrowser.org) gets the API key which is then available for all users. But, there's only one way to find out... smiling smiley

And yes, if Firefox has Yandex stuff, then we must collect it.

____________________
Understanding the scope of the problem is the first step on the path to true panic. [Florence Ambrose, "Freefall" 01372 January 22, 2007 http://freefall.purrsia.com/ff1400/fv01372.htm]

Options: ReplyQuote
Re: Replace Google with Yandex on Translate menu
Posted by: siria
Date: October 06, 2018 06:34PM

Oh... looky see...
Finally noticed that their translation site starts working for me too when using Opera12 instead of KM1.6 :cool: AND - tada: a translated site has an own iframe, which can be opened in a new tab by right-click!!

This is exactly what a simple variation of the googletranslate-macro needs.
Does this URL-method work for you too, can you try opening some other test pages directly this way?

https://translate.yandex.com/translate?url=https%3A%2F%2Fforum.mozilla-russia.org%2Fviewforum.php%3Fid%3D25&dir=&ui=en&lang=ru-en

https://translate.yandex.com/translate?url=
http.... (would try with 'normal' url first, perhaps works without %-convert)
&dir=&ui=en&lang=ru-en

But if that "%" stuff is necessary, open the errorconsole and paste this into the "Evaluation" line:
encodeURIComponent("your http....");

-----------

And text snippets are equally easy!
And they even add direct links to Google+Bing!
# https://translate.yandex.com/?lang=en-ru&text=the%20house%20is%20big
# https://translate.google.com/?q=the%20house%20is%20big&sl=en&tl=ru
# https://www.bing.com/translator/?text=the%20house%20is%20big&from=en&to=ru

Now I'm wondering why you went the complicated way of mailing their support instead of simply copying the urlbar :cool:



Edited 2 time(s). Last edit at 10/06/2018 06:59PM by siria.

Options: ReplyQuote
Re: Replace Google with Yandex on Translate menu
Posted by: siria
Date: October 06, 2018 08:10PM

Just for completeness, all 3 translators syntax for a WEBSITE URL:
(example page: https://forum.mozilla-russia.org/viewforum.php?id=25 )

YANDEX:
https:// translate.yandex.com/translate?url=https%3A%2F%2Fforum.mozilla-russia.org%2Fviewforum.php%3Fid%3D25&dir=&ui=en&lang=ru-en

GOOGLE:
https:// translate.google.com/translate?u=https%3A%2F%2Fforum.mozilla-russia.org%2Fviewforum.php%3Fid%3D25&hl=en&ie=UTF8&sl=ru&tl=en

BING:
https:// www.microsofttranslator.com/bv.aspx?from=ru&to=en&a=https://forum.mozilla-russia.org/viewforum.php?id=25

Options: ReplyQuote
Re: Replace Google with Yandex on Translate menu
Posted by: gordon451
Date: October 07, 2018 12:57PM

Quote
siria
Does this URL-method work for you too, can you try opening some other test pages directly this way?

Now I'm wondering why you went the complicated way of mailing their support instead of simply copying the urlbar :cool:

Da. It works, no %-encoding needed:
< https://translate.yandex.com/translate?url=http://kmeleon-ru.blogspot.com/ >

Having said that, I do feel that if Yandex want %-encoding, then as it's so easy why not oblige them?

I didn't use the urlbar because Yandex didn't expose it. But I learned a long time ago that if you're lost, it's a good idea to ask somebody :cool:

Another silly question: "translate.kmm" as shipped with roytam1's KMG77 has 3 sections, the second one is BabelFish, the third is Google. It seems the first section does the hard yakka of setting up? I feel that a simple deletion of BabelFish would be sufficient, then replace Google with Yandex. However, my life experience tells me nothing is that easy. But that kmm appears to be what gives us Google, and no mention of BabelFish.

____________________
Understanding the scope of the problem is the first step on the path to true panic. [Florence Ambrose, "Freefall" 01372 January 22, 2007 http://freefall.purrsia.com/ff1400/fv01372.htm]

Options: ReplyQuote
Re: Replace Google Translate / HELPER macro for YANDEX+BING
Posted by: siria
Date: October 07, 2018 03:34PM

I'm probably crazy, but couldn't resist tongue sticking out smiley

Here's a little hac.. ahem Helper Macro!
It's a supplement macro which only fills out the 2 URL-prefs, nothing else.
All the rest is still done by the original, unchanged translate macro.
And this workaround only works right if the original macro is set to Google, not to babelfish.
(Tested only with old browser versions so far, confirmations for newer versions welcome :coolsmiling smiley



Installation: put the kmm-file into a macros folder
Uninstall: use menu to first reset to Hack=Google, then remove this file
(if you forgot the reset, use the original menu Translation>Using>Google Translate)



Edited 3 time(s). Last edit at 10/07/2018 03:39PM by siria.

Attachments: TranslateHack_YandexBing.kmm (3.2 KB)   TranslateHackYB_menu.png (4.9 KB)  
Options: ReplyQuote
Re: Replace Google Translate / HELPER macro for YANDEX+BING
Posted by: gordon451
Date: October 08, 2018 10:34AM

Well, it works OK on KMG77. But see below...

I removed (crude hacking!) the BabelFish section from "translate.kmm", and that still works :O but the default (?) English is now greyed out on the From menu. Yandex does seem to check what language the original is in: I tried a KM forum page which is largely in French, but Yandex wanted to give me the French "translation". Of course all I had to do was select the body of each post and translate those. I don't know if this is due to the greyed-out (frozen in?) "English" selection on the From menu?

Looking through the code in the original kmm I could not see where the selection is enabled. I think it must have been obvious to the original authors smiling smiley I will put the original kmm back, I think. The BabelFish bit seems to be doing no harm.

This is why I don't want to tackle the translation macro myself. I simply don't have the time to do the research. But siria, I do agree the translate macro should be rebuilt, it is a bit of a dog's breakfast as it is now.

____________________
Understanding the scope of the problem is the first step on the path to true panic. [Florence Ambrose, "Freefall" 01372 January 22, 2007 http://freefall.purrsia.com/ff1400/fv01372.htm]

Options: ReplyQuote
Re: Replace Google Translate / HELPER macro for YANDEX+BING
Posted by: siria
Date: October 08, 2018 03:54PM

Quote
Gordon451
I removed (crude hacking!) the BabelFish section from "translate.kmm", and that still works surprised smiley but the default (?) English is now greyed out on the From menu

If your "from" language is grayed out in the menu, it normally means your "TO" language is the same.
Of course, it's also well possible your 'crude hacking' caused a prob smiling smiley
But this yandex-macro is meant for use with the unchanged translate.kmm anyway.

UPDATE v2:
Trying a different string for Google-TEXT:
with given FROM and TO languages, instead of the traditional "langpair" for both directions.
Perhaps this can reduce that ukrainian/russian mess which you get...?
Please test, and after install click again on "Hack-Google" to update the strings.

http://kmeleonbrowser.org/forum/file.php?2,file=1807,filename=TranslateHack_YandexBing.kmm

And now noticed:
The Yandex page itself is only available in a few languages.
Which one seems determined by the called domain, while the "&ui=" part is only used for a few russian variations. Those are their domains in the source code:

link rel="canonical" href="https://translate.yandex.com/";
link rel="alternate" hreflang="ru" href="https://translate.yandex.ru/";
link rel="alternate" hreflang="ru-UA" href="https://translate.yandex.ua/?ui=ru";
link rel="alternate" hreflang="be" href="https://translate.yandex.by/";
link rel="alternate" hreflang="ru-BY" href="https://translate.yandex.by/?ui=ru";
link rel="alternate" hreflang="kk" href="https://translate.yandex.kz/";
link rel="alternate" hreflang="ru-KZ" href="https://translate.yandex.kz/?ui=ru";
link rel="alternate" hreflang="uk" href="https://translate.yandex.ua/";
link rel="alternate" hreflang="en" href="https://translate.yandex.com/";
link rel="alternate" hreflang="tr" href="https://ceviri.yandex.com.tr/";

Now riddling how to include that in a macro again....



Edited 1 time(s). Last edit at 10/08/2018 11:13PM by siria.

Attachments: TranslateHack_YandexBing.kmm (3.2 KB)  
Options: ReplyQuote
Re: Replace Google Translate / HELPER macro for YANDEX+BING
Posted by: gordon451
Date: October 11, 2018 12:02PM

OK. I tried the v2 hack, no luck at all. Translating the page, Google showed the possibility of an English translation, but it was still in Russian. So I went back to select and translate, see the image:



Spanish? sad smiley FWIW, my test site for Russian is < http://kmeleon-ru.blogspot.com/ >, and Alain's Jujuland site for French.

So I reverted to the v1 macro. I'm probably never going to use Google or Bing again unless Yandex goes under, which I don't think is any time soon.

Quote

The Yandex page itself is only available in a few languages.

Well, I see 95 languages available on their translation page, even though many are in Beta. It would seem there may be--or indeed is--a need for a group effort to clean up the translate macro and allow a greater selection of languages to and from. But you yourself have put in a marvellous effort, especially with this current Hack version smiling smiley

____________________
Understanding the scope of the problem is the first step on the path to true panic. [Florence Ambrose, "Freefall" 01372 January 22, 2007 http://freefall.purrsia.com/ff1400/fv01372.htm]

Options: ReplyQuote
Re: Replace Google Translate / HELPER macro for YANDEX+BING
Posted by: siria
Date: October 11, 2018 08:09PM

Quote
gordon451
OK. I tried the v2 hack, no luck at all. Translating the page, Google showed the possibility of an English translation, but it was still in Russian. So I went back to select and translate, see the image

Uhm, looks like another little misunderstanding:
v2 changed only Google's "selected text" URL-keys, not the whole-page url.
The PAGE url is identic in v1+v2

For selected text, since ages in old macro (min 2009):
https://translate.google.com/translate_t?langpair=<from>;|<to>&text=<txt>
Test in hack-v2:
https://translate.google.com/?sl=<from>&tl=<to>&hl=<to>&ie=UTF-8&q=<txt>;

"langpair" means bidirectional, while sl (source-lang) and tl (target-lang) are oneway.
Now am not sure if you noticed any difference in "selected text" tests for v1+v2?

The 'prob' is that google seems to work better for me, so it's a bit difficult to test from my end. It seems to respect the language keys sent in the macro-url, unless the source language is definitely wrong. And that russian blog is a bit difficult to test too because it shows up completely empty here. Unless ajax is allowed, but that means all security blocks down and instead all doors and windows dangerously wide open.
(on a side note: lately other google pages are giving me a dutch layout sometimes (not always), and sometimes include a few dutch search results, which makes no sense. Google definitely has a growing prob with telling some languages apart!)

Regarding the real translation macro (translate.kmm), am working again at an update.
The first step includes little bugfixes and addition of Yandex, Bing and DeepL (from Linguee company, currently 7 languages with plans for more.)
But considering the language explosion from some 25 to 100 languages for Google, almost the same number for Yandex with a few minor differences, and around 60 for Bing, that's a challenge to update. After much riddling I now think the best would be to overhaul the menu structure completely and use flyout-menus for the continent-blocks, with a couple fix languages listed in main menu. Currently planning to do that in a step2 update. And overall I think it gets far too complicated to still hardcode for every single service all its available languages in the macro anymore, for every service its own superlong From-menu, and a second superlong To-menu, and a superlong Clear-menu. 3x100 for Google, 3x100 for Yandex, 3x60 for Bing, what a monster, and soon outdated anyway... At the moment guess I'll just simplify and use the same language menu for all those mega-services together. Even if it means not all menu-languages will actually work in all services alike, oh well. Or perhaps include only the 60 from Bing, not almost 100? Then a bunch are missing, but frankly, those exotic ones are probably still horrible quality anway, and also, even 60 are already ridiculous for such a rare niche browser as KM, with only a handful GUI-languages for itself :cool:

Options: ReplyQuote
Re: Replace Google Translate / HELPER macro for YANDEX+BING
Posted by: gordon451
Date: October 13, 2018 12:30AM

Quote
siria
Now am not sure if you noticed any difference in "selected text" tests for v1+v2?

In v1--Russian to English--Google doesn't think Russian is Spanish. But yes, Google has had problems with language identification for a long time. I'm not sure what they give their AI to drink winking smiley

Quote

But considering the language explosion from some 25 to 100 languages for Google, almost the same number for Yandex with a few minor differences ...

Your wisdom is impeccable. Maybe I should have thought this through before asking the question. There is a proverb: "If you have dogs, you don't need to bark." Maybe we should just find a few well-known translators and provide their URLs in a small Tools>Translation submenu? I was going to say put them in a {Bookmarks|Favorites|Hotlist} submenu, but that seems like a lot of work. We could perhaps look at a way for users to add their own URLs, but the reality is that most people already know where their favourite translator lives, they just need to learn about alternatives.

We really don't need to fudge with automating things things that users already know, like selecting text and pasting it, and all the translators I have seen offer to take a URL in the home page anyway.

____________________
Understanding the scope of the problem is the first step on the path to true panic. [Florence Ambrose, "Freefall" 01372 January 22, 2007 http://freefall.purrsia.com/ff1400/fv01372.htm]

Options: ReplyQuote
Re: Replace Google Translate / HELPER macro for YANDEX+BING
Posted by: siria
Date: October 18, 2018 10:12PM

Argh... Attention Yandex!
Now that I've added it to the menu, and compared again 2-3 little texts with Google, have finally noticed:
Yandex simply DELETES whole sentences and lines! sad smiley
Without even any hint that there could be something missing.

Slightly shocked, that's a real killer bug of that service. It gives a completely wrong impression if users aren't aware they are missing essential texts. Google at least shows the original text if it finds any prob with translating.
Now will have to add a little warning in the macro, grmpf. A service which hides essential parts is really almost useless. It may still give a slightly better translation in some difficult phrases, but users must stay vigilant and use at least one other service additionally.

Options: ReplyQuote
Re: Replace Google Translate / HELPER macro for YANDEX+BING
Posted by: gordon451
Date: October 21, 2018 12:17PM

Quote
siria
Yandex simply DELETES whole sentences and lines! sad smiley
Without even any hint that there could be something missing.

That's doing it with the macro? I know Google had problems with some selected text, it seemed unable to see the line break for a new paragraph after a full stop, so it just ran the whole thing together without even a space--and then mistranslated the result. But I could at least edit the From: box, and sort the mess. It is possible Google was having trouble with the way the passage was encoded for the macro, but that's just a guess.

However, any user should use as many services as possible:

(From my previous): Your wisdom is impeccable. Maybe I should have thought this through before asking the question. There is a proverb: "If you have dogs, you don't need to bark."

Yandex: Deine Weisheit ist tadellos. Vielleicht hätte ich das durchdenken sollen, bevor ich die Frage gestellt habe. Es gibt ein Sprichwort :" wenn Sie Hunde haben, müssen Sie nicht bellen."

Bing: Ihre Weisheit ist makellos. VielLeicht hätte ich das durchdenken sollen, bevor ich die Frage gestellt habe. Es gibt ein Sprichwort: "Wenn du Hunde hast, brauchst du nicht zu bellen. "

Google: Deine Weisheit ist tadellos. Vielleicht hätte ich das durchdenken sollen, bevor ich die Frage gestellt habe. Es gibt ein Sprichwort: "Wenn Sie Hunde haben, müssen Sie nicht bellen."

They all seem to need a bit of tuition tongue sticking out smiley And putting a Capital "L" in "VielLeicht" ? I could not get rid of it, no matter what I tried. Just translating "Maybe" on its own was good, but in the passage... sad smiley

____________________
Understanding the scope of the problem is the first step on the path to true panic. [Florence Ambrose, "Freefall" 01372 January 22, 2007 http://freefall.purrsia.com/ff1400/fv01372.htm]

Options: ReplyQuote
Re: Replace Google Translate / HELPER macro for YANDEX+BING
Posted by: siria
Date: October 21, 2018 01:53PM

Quote
gordon451
Quote
siria
Yandex simply DELETES whole sentences and lines! sad smiley
Without even any hint that there could be something missing.

That's doing it with the macro?

No, that's the whole point: it's not the macro, it's the service itself, that's exactly their Killer prob.
It happens also when you copy/paste or edit text manually in their left translation textarea. Their right side simply does not always translate everything that's displayed on the left side. Whole sentences and lines can be just missing. The macro does send the complete text, it does show up on left side.

Of course it doesn't happen always, and your test was a little bit too short smiling smiley
But keep an eye on this when doing future translations. My impression was that Yandex already gives up and skips at the slightest translation probs, not even any complicated stuff. I also saw it when there was a linebreak in the middle of a sentence. Some people do such stuff as a manual max-text-width setting, for better readability.

Quote
gordon451
I know Google had problems with some selected text, it seemed unable to see the line break for a new paragraph after a full stop, so it just ran the whole thing together without even a space--and then mistranslated the result. But I could at least edit the From: box, and sort the mess. It is possible Google was having trouble with the way the passage was encoded for the macro, but that's just a guess.

Yeah, and for that "gluing together" of linebreaks I had posted a fix already 3 years ago, along with a few other fixes/updates:
http://kmeleonbrowser.org/forum/read.php?9,98467,136561#msg-136561
That only inserted blanks after linebreaks, so that the words would get translated at least, but it didn't do anything yet to keep the linebreaks themselves.

What I did not realize then, since my testing options were too limited at the time (didn't know about Opera12 yet, with much more advanced engine as KM1.6):
the reason that linebreaks vanish completely isn't Google at all, what I too had thought all the time! Now discovered just recently, thanks to this extensive testing here:
for once Google is innocent, in reality it's a prob in macrolanguage. One that was completely unknown to me, or perhaps it's considered a 'feature' who knows. At any rate the "urlencode" command transforms all sorts of special characters but not linebreaks. One would think now, that opening a URL which still contains 'real' linebreaks in the text string, would crop the URL after the first break, but looks like KM deletes the breaks at the moment it opens a URL. Having finally realized this, the workaround in the macro was easy again. Until I publish the whole thing, complete with a few other updates too, you can fix those linebreaks yourself if you feel like, exchange this module:

_Translate_text{
$_txt=urlencode($SelectedText);
# encode linebreaks or they vanish when called as URL:
$_txt=gsub("\r","%0D",$_txt);
$_txt=gsub("\n","%0A",$_txt);
$OpenURL=sub("<txt>",$_txt,gsub("<from>",$_from,gsub("<to>",$_to,getpref(STRING,$_Translate_pref_text))));
&_Translate_OpenURL;
}

BUT: after realizing that one of the reasons that Yandex may delete whole sentences can simply be a manual linebreak in the middle of a sentence, this creates a new prob again:
perhaps the macro should consider which translation service a user has chosen, and if it's yandex, then intentionally throw out ALL linebreaks again? Just as it was in the 2015 version??
Sigh, every step forward seems to create new probs too sad smiley



Edited 2 time(s). Last edit at 10/21/2018 02:12PM by siria.

Options: ReplyQuote
Re: Replace Google Translate / HELPER macro for YANDEX+BING
Posted by: anonymous
Date: October 21, 2018 06:34PM

@gordon451
All translation services add markers. The one you found is old.

@siria
Any examples of selections of a page where Yandex ignores lines? Does it happen in other browsers? Paste from clipboard to test it.

Options: ReplyQuote
Re: Replace Google Translate / HELPER macro for YANDEX+BING
Posted by: anonymous
Date: October 26, 2018 07:45AM

@siria
Found an example on ru-board where Yandex deletes something:

а на 0707 не работает не
and the 07 does not


K-Meleon does not remove line breaks from $OpenURL; Gecko does.
The same "gluing together" happens with tab (hex 9).

Options: ReplyQuote
Re: Replace Google Translate / HELPER macro for YANDEX+BING
Posted by: siria
Date: October 29, 2018 09:08AM

@anonymous
Thanks for more background info, always interesting.

So I've added \t and %09 to the replacements too, but wondered how tabstops could be created in html. After a longer research, finally found it's &#09;
But when testing (in KM1.6+KG74) it turned out, those are already missing in $SelectedText.
Then started testing with a plain TXT file. And now that usual 1-step-forward-0.9-steps-backward effect hit again: on txt pages there are not even linebreaks in $SelectedText sad smiley
Tried a workaround with injectJS and window.getSelection(), but still the same prob. Probably same cause as for macrolanguage. Oh well, guess we can live with that, if it affects only txt files.

About Yandex deleting text parts, a new discovery/theory:
they do seem to translate text fully, but then just hide the end sometimes! Their right rectangle seems calculated too short before showing a scrollbar. And scrolling with arrow keys or mousewheel isn't possible either. My only chance to get the full text is CTRL+C and then paste into a text editor.
(all non-google translator tests I'm doing with Opera12.02 due to old OS: for macro-testing by copying over the macro-created url target from KM, and for general tests like vanished text parts by manual copy/pasting of selected text)

Quote
anonymous
@gordon451
All translation services add markers. The one you found is old.

You mean "vielLeicht"? So that's a secret marker for Bing translations? Cool, and makes curious for some more translation markers :cool: Googled around awhile, but no luck yet.



Edited 2 time(s). Last edit at 10/29/2018 09:25AM by siria.

Options: ReplyQuote
Re: Replace Google Translate / HELPER macro for YANDEX+BING
Posted by: siria
Date: October 29, 2018 09:29AM

Just for fun and translator comparison, two example sentences I used
(IMO yandex pretty bad, google usually best):

ORIGINAL:
Given the scraping used, I would not be surprised if their system works really well for business/formal documents and quite terribly for everyday language.
(from a comment about Linguee/DeepL)
GOOGLE:
Angesichts des verwendeten Scraping wäre ich nicht überrascht, wenn ihr Modell wirklich gut für geschäftliche / formelle Dokumente und ganz schrecklich für die Alltagssprache funktioniert.
YANDEX:
Angesichts der Schaben verwendet, wäre ich nicht überrascht, wenn Ihr system funktioniert wirklich gut für business/formale Dokumente und ganz schrecklich für die Alltagssprache.
BING:
Angesichts des verwendeten Krattes würde ich mich nicht wundern, wenn Ihr Modell wirklich gut für geschäftliche/formale Dokumente und ganz furchtbar für die Alltagssprache funktioniert.
DEEPL: (Killer: INVERTS a meaning)
Angesichts der verwendeten Verschrottung wäre ich nicht überrascht, wenn ihr System für Geschäfts-/Formdokumente und für die Alltagssprache wirklich gut funktioniert.

ORIGINAL:
Artikel 6: Männer können ab dem 18. Lebensjahr zur Mitgliedschaft in einem FC-Bayern-Fanclub verpflichtet werden. Eine Ablehnung aus Gewissensgründen ist nicht möglich.
(if not obvious enough: from a kidding comment)
GOOGLE:
Article 6: Men can be obliged to become members of a FC Bayern fan club from the age of 18 years. A denial of conscience is not possible.
YANDEX: (Killer: INVENTS more stuff freely!)
Article 6: men may, from the 18th day of the month, take part in the training. At the age of 18, you must be a member of an FC-Bayern-fan club. A rejection for reasons of conscience is not possible.
BING:
Article 6: Men may be required to become members of an FC-Bayern fanclub from the age of 18. A refusal for reasons of conscience is not possible.
DEEPL:
Article 6: Men can be obliged to become members of an FC Bayern fan club from the age of 18. A rejection on grounds of conscience is not possible.



Edited 1 time(s). Last edit at 10/29/2018 09:32AM by siria.

Options: ReplyQuote
Re: Replace Google Translate / HELPER macro for YANDEX+BING
Posted by: rodocop
Date: October 29, 2018 10:08AM

My experience with 2 translators was the same: Google much better than Yandex, specially after some engine redesign of last year.

Options: ReplyQuote
Re: Replace Google Translate / HELPER macro for YANDEX+BING
Posted by: anonymous
Date: October 29, 2018 06:34PM

@siria
Text fields support tab (hex 9). Add some tabs to a text and paste it to forum editor, select some lines and run translate macro. It works if K-Meleon sends %09 instead of ASCII <tab> to Gecko. Bing even adds a single <tab> to translation result where one or more are found in the source.

Bing anomalies:
A few years ago, Microsoft forum users thought that their feedback was ignored and it was just used to collect their identities. They had to add gordon451's example to auto correction. Now you added "Krattes" to mine.

Options: ReplyQuote
Re: Replace Google Translate / HELPER macro for YANDEX+BING
Posted by: gordon451
Date: November 03, 2018 05:46AM

In my last post, I was trying to illustrate inconsistencies in treating the formal "Ihre" and the familiar "du". Back when I was at school learning German and French in the mid-60s, we were taught to use the Second Person Plural (Ihre/Vous) as a respectful way of addressing strangers and superiors, while the Second Person Singular (du/tu) is for family and close friends, or for juniors if you wish to hammer a point home.

So when I see three translators which cannot even make my statement (Your wisdom is impeccable) agree with the proverb (If you have dogs...), then I would say we have a problem: all three Ais need some tuition. FWIW, in rendering the proverb, I think Bing has the best thought: IMHO "brauchen" is better than "müssen". "tadellos"/"makellos", tongue sticking out smiley meh.

When I removed the period from the number 18, Yandex became quite civilised: "Men can be required to join a FC Bayern fan club from the age of 18." Is this period part of German grammar?

However, as anonymous has reminded us, we can always submit a "better" translation... Whether the service takes any notice of that is probably up for debate smiling smiley

Quote
siria
... on txt pages there are not even linebreaks in $SelectedText sad smiley

Generally text files don't have line-breaks unless the author puts them in. Usually we get them when we hit "Enter" for a new paragraph. The entire preceding sentence(s) would normally be a single line of text, which we don't normally see because we usually have the editor set to "Word Wrap ON" (Ctrl-W toggle).

____________________
Understanding the scope of the problem is the first step on the path to true panic. [Florence Ambrose, "Freefall" 01372 January 22, 2007 http://freefall.purrsia.com/ff1400/fv01372.htm]



Edited 1 time(s). Last edit at 11/03/2018 07:15AM by gordon451.

Options: ReplyQuote
Re: Replace Google Translate / HELPER macro for YANDEX+BING
Posted by: gordon451
Date: November 03, 2018 07:12AM

Quote
anonymous
@gordon451
All translation services add markers. The one you found is old.

Just for fun, I ran the example through Bing again:
Quote

Ihre Weisheit ist makellos. Vielleicht hätte ...

No marker. Like I say, one wonders what they give their Ais to drink grinning smiley

____________________
Understanding the scope of the problem is the first step on the path to true panic. [Florence Ambrose, "Freefall" 01372 January 22, 2007 http://freefall.purrsia.com/ff1400/fv01372.htm]

Options: ReplyQuote
Re: Replace Google Translate / HELPER macro for YANDEX+BING
Posted by: anonymous
Date: November 03, 2018 11:07AM

@gordon451
You are right. It is fixed. They are watching us.

A period behind 18 is German for 18th.

She opened a text file with line breaks in the browser and found out that the macro variable $SelectedText didn't contain the line breaks like a clipboard copy.

Options: ReplyQuote
Re: Replace Google Translate / HELPER macro for YANDEX+BING
Posted by: siria
Date: November 03, 2018 03:54PM

For the linebreaks I've finally found a workaround via clipboard, functions in plain text too smiling smiley
Will be in the normal macro, just hope to some day get that overhaul finally finished (always running into that old prob with 1-step-forward-0.9-steps-backwards, causing so many unfinished monster macros, sigh)

Quote
gordon451
No marker. Like I say, one wonders what they give their Ais to drink grinning smiley

Offtopic
They feed it Facebook kiddo slang? Twitter slang? Disqus slang? SMS slang? :cool: No wonder. Rather wonder when those folks who consider spelling as completely unnecessary nonsense will realize this also hinders machine translations?
Awhile ago I was really shocked about an incredible glitch in google's translation quality, when they started translating completely correct words and grammar suddenly into such kiddish slang too. Couldn't believe it, but hope it was only temporary. At any rate it only happened during a short period. Or perhaps I just don't notice anymore, because I usually never translate into german, only for rare quality comparisons? Anyway, sure hope Google reconsidered.

If you're interested in grammar, yes that dot after 18 in the example above is mandatory. It's the equivalent of english 18th. Interesting that this helps Yandex, maybe a good trick to remember in the future! Thinking about it, perhaps understandable that machines have a prob determining whether a dot is a period after a sentence or only part of a number...
But oh well, spelling is so deteriorating everywhere, and since some years that includes a complete mishmash with english words and grammar thrown into german texts. Germish as you say, or denglish over here. More and more often I see nonsense stuff like "18te" in german texts too, or even complete illogic like "80ig" etc, when they really just mean "80", or (ouch) "20igsten" instead of "20." Hopeless.
Although, the youngest ones are actually innocent, the culprits irresponsable politicians. Completely incredible and insane again, those have decided that in the first four years of school little kids should NOT be taught any spelling at all! They shall only "write as they hear", without any correction, in order to not hurt their poor sensitive little souls...! Needless to say, poor kids without help from parents are now completely lost, no chance to later correct all that wrong stuff imprinted into their brains so young. And of course there's a deep gap now among parents/teachers/politicians, but as usual today, the most incompetent ones always win :-(

"Du" and "Sie", oh yeah that has always been difficult, and meanwhile is a great mishmash too, thanks to english influence too. Especially funny at workplaces. When regular visits from far abroad started becoming normal, from customers or suppliers, and vice-versa, and emails of course, all Germans were very eager to "adapt" to english habits. Suddenly there was this completely silly and idiotic situation that they were adressing complete strangers with "du" and first name from the start, while still adressing their own collegues from next desk, very much familiar and much liked since decades, still with "Sie" and last name! Even in the same meeting room with visitors (still can't quite wrap my head around it LOL!)
Then things slowly started changing, and today you never know if a workgroup is "all Du" by their own rules, or still all are traditionally formal, or a mix. Same confusion for sports clubs, hobby groups etc. To make it even funnier, there are all sorts of mixups possible too, in some groups everyone calls each other "Sie+Firstname", in some others "Du+Lastname" etc. - and this can even depend from the region! Crazy...
And when the internet came, everyone was suddenly per "Du" with the whole world, whow smiling smiley With a few exceptions, "Sie" there only used in formal or in hostile situations. But on business intranets that makes now a near unsolvable dilemma, many people riddling how to adress unknown collegues there, LOL! Whatever you do, it sure will be wrong. Oh, the fashions.

Quote
gordon451
There is a proverb: "If you have dogs, you don't need to bark."

There we also have this confusing Du/Sie prob again smiling smiley It's an endless dilemma. Guess many nations greatly envy the English with their universal "you". But what's often striking me, the german language uses a lot less direct speech (Du/Sie) as english, perhaps for exactly this reason!?
In special cases, when you have stuff like street signs, short instruction plates, computer menus or similar, all situations which are not "2 humans talking", such direct speech was not usual at all (in the past, before the complete denglification). In proverbs too: instead of starting with "Wenn du/Sie...", they'd all start with "Wer..." in german. In this case would sound natural: "Wer Hunde hat, braucht nicht (zu) bellen." (müssen is ok too, "nicht müssen" means "not need"). Short dialogues in computer apps are (were?) also rather avoiding Du/Sie. That's why app dialogues in older apps feel more natural, but newer ones often sound awkward if translated 1:1 by a machine or non-professionals, even if 100% correct. Just too much direct speech from a non-person, also making stuff a bit longwinded instead of short and precise. But most people don't realize why, it's just a feeling, so they keep translating 1:1, and unnecessarily running into stupid Du/Sie probs too.
But of course, when meeting people in person, the prob arizes again.
(sorry for the novel, sigh)

Options: ReplyQuote
Re: Replace Google Translate / HELPER macro for YANDEX+BING
Posted by: gordon451
Date: November 04, 2018 01:16AM

Quote
siria
...
"Du" and "Sie", oh yeah that has always been difficult, and meanwhile is a great mishmash too, thanks to english influence too.
...
Guess many nations greatly envy the English with their universal "you".
...
newer ones often sound awkward if translated 1:1 by a machine or non-professionals
...
(sorry for the novel, sigh)

Don't be sorry for the novel siria, it's a lovely read smiling smiley

English was probably the first language to lose the distinction between singular/familiar thou and plural/formal ye/you, begining somewhere in the 1300s. But it's not without problems, we frequently need to distinguish which of several people we are talking to: in the King James' version of the Bible the problem is solved by using archaic English to retain the thou/ye construction, while in Australia you will often hear the invented word youse as a nominative plural. And (obviously) the pronoun you has become the nominative singular :O

I can remember in my first French lessons, and many since then, we were warned to never never never translate 1:1, because it could get us into all sorts of trouble. But reading your novel reminds me once again that the "Rise of the Robots" is far, soooo far, from reality until we can learn how to teach a computer how to think. And I guess training a translation AI is a good place to start our learning tongue sticking out smiley

EDIT: In English, the nuances of must and need are different: must like shall implies an external imperative that absolutely requires compliance, while need like want is a personal preference which can be ignored, at least temporarily. Of course, English nuances do not necessarily translate to German, but that was my thinking when I said I preferred brauchen over müssen. Plus, of course, the transitive verb (to me) sounds more natural in this case.

____________________
Understanding the scope of the problem is the first step on the path to true panic. [Florence Ambrose, "Freefall" 01372 January 22, 2007 http://freefall.purrsia.com/ff1400/fv01372.htm]



Edited 2 time(s). Last edit at 11/04/2018 01:29AM by gordon451.

Options: ReplyQuote
Re: Replace Google Translate / HELPER macro for YANDEX+BING
Posted by: siria
Date: November 04, 2018 03:48AM

offtopic

Interesting the English have that distinction prob with "you" in singular/plural - actually Germans have the same, in formal "Sie" situations! One never knows, does the speaker now mean the whole group, or only the one he talks to directly?? Like you, we need a workaround, and there isn't any real good one. Now over the last decades, while formalism is slowly retreating, you can hear more and more often an informal "Ihr" when meaning several people, despite still being formal on "Sie" when talking to an individual of the same group...
"Youse" is a perfect solution grinning smiley And until today I thought thou/ye was normal speech at the writer's time, never dawned on me that it could also just be a workaround smiling smiley

Quote
gordon451
In English, the nuances of must and need are different: must like shall implies an external imperative that absolutely requires compliance, while need like want is a personal preference which can be ignored, at least temporarily.

Oh but german has exactly the same distinction, just with a litte twist smiling smiley
The trap lies in the *negation* of must/müssen:
EN: you must NOT = inverted imperative => do NOT do this
DE: du musst NICHT = it's NOT imperative = du musst/brauchst nicht
but: you must not = du darfst nicht / ihr dürft nicht

A frequent false-friend trap for learners of the other language :cool:
And now an english trap again: someone "may"... = ?? You must...? You can...?
Have read that's a quite difficult nuance to figure out, incl. considering who speaks, especially when it's written in a law...



Edited 1 time(s). Last edit at 11/04/2018 03:54AM by siria.

Options: ReplyQuote
Pages: 12Next
Current Page: 1 of 2


K-Meleon forum is powered by Phorum.