translate-tools / linguist

Translate web pages, highlighted text, Netflix subtitles, private messages, speak the translated text, and save important translations to your personal dictionary to learn words even offline
https://linguister.io
BSD 3-Clause "New" or "Revised" License
679 stars 22 forks source link

Remember auto detection for translate page #38

Open vitonsky opened 3 years ago

vitonsky commented 3 years ago

Proposal from https://github.com/translate-tools/linguist/issues/36#issuecomment-894724965

Add option for remember "auto detect" direction for translate page. In this case auto translate will use this direction too.

This should remember for all sites or for each domain?

lamrongol commented 1 month ago

Add option for remember "auto detect" direction for translate page. In this case auto translate will use this direction too.

This is just a plan? Auto translation doesn't work only for "auto detect" is very inconvenient, I think. Now I have to disable auto translation and manually order translation by setting Hotkey. This is suggested on this Vivaldi forum: https://forum.vivaldi.net/post/770819

vitonsky commented 1 month ago

Add option for remember "auto detect" direction for translate page. In this case auto translate will use this direction too.

This is just a plan? Auto translation doesn't work only for "auto detect" is very inconvenient, I think. Now I have to disable auto translation and manually order translation by setting Hotkey. This is suggested on this Vivaldi forum: https://forum.vivaldi.net/post/770819

Yes, this issue is just proposal. Could you elaborate here your suggest from vivaldi forum. What problem you have and how it could be fixed

lamrongol commented 1 month ago

@vitonsky On SNS(like X/Twitter or Bluesky), many languages would appear and I want posts to be translated automatically for each languages(English, German, Portuguese and so on to users' native language, Japanese in my case). e.g. https://bsky.app/profile/did:plc:boopgqnkg2inpleusxo7kj4l

However, there are settings that English(for example) pages are translated automatically but "auto-detect" and tranlating settings doesn't exist.

vitonsky commented 1 month ago

@lamrongol we have issue https://github.com/translate-tools/linguist/issues/73 about this problem.

The problem is currently Linguist translate page like whole text in one language. To improve translation quality, we should consider lang attribute on elements and translate all text inside container according to its language.

Even if user will choose English for page translation, but page will contains Japanese text, linguist should detect language on every element itself.

Currently, i don't understand what current issue about, so probably i should close it. But if have idea how something should works, please describe it here.

lamrongol commented 1 month ago

@vitonsky Ah, this is a different problem. I can translate multi languages when clicking toolbar button and select "auto detect" and push "translate" button. However, when reloading or opening a new tab, translation setting is returned from "auto detect" to page language(e.g. English). I hope "auto detect" settings holds forever (or holds for a particular site).

vitonsky commented 1 month ago

The problem here in understanding "what auto translation option do".

This option just send texts to translator with languages direction auto-TARGET_LANGUAGE, so translators who support auto detection for text, can translate even mixed text correctly.

However, Linguist may not rely on translators implementation, since not all translators support option auto and not all translators works fine with mixed content.

This is why we have issue https://github.com/translate-tools/linguist/issues/73 to detect languages per every element and sent to translator more precise information, but not just auto.

Moreover, this option will be useful even if user choose one specific language in popup (not auto), but page contains text in another language.


Now, let's back to your problem. I see your concern, your expectation as user is that option "auto" will translate mixed content well, so you setup auto translation for direction auto-TARGET_LANGUAGE but after page reloading auto translation is never starts. Is my understanding correct?

If yes, then we have problem with UI that is lied to users with this expectation, and we must fix this problem.

When you open/reload a web page, Linguist will try to detect its language, and always will operate with this language to decide should be enabled translation based on languages preferences or not. Only in case Linguist cannot detect page language with no one way, the language "auto" will be used instead.

You may enable auto translation for site if you will chose option "Preferences for SITE_NAME":

image

if it does not work for you, then please tell about it in issues, it would be bug.

lamrongol commented 1 month ago

I have tried some experiments and first I want to confirm language detection process.

When you open/reload a web page, Linguist will try to detect its language, and always will operate with this language to decide should be enabled translation based on languages preferences or not. Only in case Linguist cannot detect page language with no one way, the language "auto" will be used instead.

When "Detect language by content" option is disabled, Linguist detects a language as "English" if page has a language setting like as <html lang="en">. When the option is enabled, Linguist detects a language by which language is mainly used in the page, doesn't it?

Then,

Only in case Linguist cannot detect page language with no one way, the language "auto" will be used instead. This case is only for the special case: page language settings doesn't exist(not like <html lang="en"> but <html>) and "Detect language by content" option is disabled.

So in the first place, "detected language" never be "auto" if page has language settins like as <html lang="en"> then "auto translation for direction auto-TARGET_LANGUAGE" never work, is it right?

This is only my thought, "Translate only visible elements" option is enabled as default, there is no problem if auto-TARGET_LANGUAGE translation is applied for all sites because processing visible elements one by one is needed and detecting language and sending texts to translator at the same time would cost little, I think. If this costs much, a site list option to setting language "auto" is needed, I think.

lamrongol commented 1 month ago

Another problem, the UI is confusing:

画像

When setting "Never Translate" or "Always Translate", the setting is applied for all languages, although this menu is under the "Common preferences for this language".

vitonsky commented 1 month ago

When "Detect language by content" option is disabled, Linguist detects a language as "English" if page has a language setting like as <html lang="en">. When the option is enabled, Linguist detects a language by which language is mainly used in the page, doesn't it?

You're right

So in the first place, "detected language" never be "auto" if page has language settins like as <html lang="en"> then "auto translation for direction auto-TARGET_LANGUAGE" never work, is it right?

Yes, you're correct.

This is only my thought, "Translate only visible elements" option is enabled as default, there is no problem if auto-TARGET_LANGUAGE translation is applied for all sites because processing visible elements one by one is needed and detecting language and sending texts to translator at the same time would cost little, I think. If this costs much, a site list option to setting language "auto" is needed, I think.

Here i didn't understood what problem you talk about, which solution you had proposed and why it worth to talk about it. Let's try to make our conversation style keep formula "the problem - the solution", to don't lose context.


When setting "Never Translate" or "Always Translate", the setting is applied for all languages, although this menu is under the "Common preferences for this language".

Actually, this option is in section Preferences for SITE_NAME. But it is bad that UI confused you, it is our problem with UI, not your as user. We should think about how to improve UI. Do you have any ideas/proposals?

lamrongol commented 1 month ago

Here i didn't understood what problem you talk about, which solution you had proposed and why it worth to talk about it. Let's try to make our conversation style keep formula "the problem - the solution", to don't lose context.

This "solution" may be pointless so please ignore. I only talk about problem, "auto translation for direction auto-TARGET_LANGUAGE" never work" that you said correct. However, just after replying, I started to think this problem may be small because this happens for only few sites(such as Bluesky). So setting "Auto Detect" manually only once when booting browser, it doesn't need more cost.

Actually, this option is in section Preferences for SITE_NAME. But it is bad that UI confused you, it is our problem with UI, not your as user. We should think about how to improve UI. Do you have any ideas/proposals?

Now I noticed that it is unclear what first option "Use Common Rules" means. "Common Rules" for a specific language exists but "Common Rules" for ALL languages doesn't exist, don't it? Tentatively, delete "Use Common Rules" menu and changes: "Never translate" -> "Never translate for all languages" "Always translate" -> "Always translate for all languages" How about above ideas?

lamrongol commented 1 month ago

I noticed when pushing translating button with "auto-detect" settings and then get back original texts, language setting also get back (such as "English", not "auto-detect"). Not only for "auto-detect", language setting changed by manually should be hold, I think.

vitonsky commented 1 month ago

I noticed when pushing translating button with "auto-detect" settings and then get back original texts, language setting also get back (such as "English", not "auto-detect"). Not only for "auto-detect", language setting changed by manually should be hold, I think.

Could you record video or describe step by step what you do, what you expect and what actual result is

lamrongol commented 1 month ago

Following is detailed steps:

  1. set auto-TARGET_LANGUAGE and push page translating button
  2. (Sorry I noticed I fogot that I had set Hotkeys) then push Hotkeys to get back original text image
  3. auto-TARGET_LANGUAGE also returns to such as English-TARGET_LANGUAGE and it is needed to set auto-TARGET_LANGUAGE manually again