DeepL Translate page been wonky lately

For support with specific websites

Moderator: trava90

Forum rules
Please always mention the name/domain of the website in question in your topic title.
Please one website per topic thread (to help keep things organized). While behavior on different sites might at first glance seem similar, they are not necessarily caused by the same.

Please try to include any relevant output from the Toolkit Error Console or the Developer Tools Web Console using the following procedure:
  1. Clear any current output
  2. Navigate or refresh the page in question
  3. Copy and paste Errors or seemingly relevant Warnings into a single [ code ] block.
User avatar
jobbautista9
Board Warrior
Board Warrior
Posts: 1120
Joined: 2020-11-03, 06:47
Location: Philippines

Re: DeepL Translate page been wonky lately

Post by jobbautista9 » 2025-11-30, 15:31

UCyborg wrote:
2025-11-30, 11:05
Moonchild wrote:
2025-11-08, 21:37
UCyborg wrote:
2025-11-08, 20:59
That site has really become cumbersome, hasn't it?
It's been cumbersome for quite some time. I ended up just using Google Translate for when I need machine translation. It works.
DeepL works better for some languages. The idea in my case is specifically to avoid Google / Bing.
There's a Mozhi (fork of SimplyTranslate) instance which has DeepL as an option: https://mozhi.pussthecat.org/?engine=deepl

Updated bookmarklet code:

Code: Select all

javascript:(function translate() {
    function se(d) { return d.selection ? d.selection.createRange().text : d.getSelection(); }
    s = se(document);
    for (i = 0; i < frames.length && !s; i++) s = se(frames[i].document);
    if (!s || s == '') s = prompt('Enter text to translate with SimplyTranslate', null);
	if (!s) return; /* Don't do anything if prompt cancelled */
	let wn = 'w_' + Date.now() + Math.floor(Math.random() * 100000).toString();
	var f = document.createElement("form");
	f.setAttribute("method", "post");
	f.setAttribute("action", "https://mozhi.pussthecat.org/?engine=deepl");
	f.setAttribute("target", wn);
	var hf = new Array(3);
	for (i = 0; i < hf.length; i++) { hf[i] = document.createElement("input"); hf[i].type = "hidden"; }
	hf[0].name = "from";
	function avl(l) {
	  switch (l) {
	    case "bg":
	    case "cs":
	    case "da":
	    case "de":
	    case "el":
	    case "es":
	    case "et":
	    case "fi":
	    case "fr":
	    case "hu":
	    case "id":
	    case "it":
	    case "ja":
	    case "ko":
	    case "lv":
	    case "lt":
	    case "nb":
	    case "nl":
	    case "pl":
	    case "pt":
	    case "ro":
	    case "ru":
	    case "sk":
	    case "sl":
	    case "sv":
	    case "tr":
	    case "uk":
	    case "zh":
	    case "ar":
	    	return l;
	    default:
	    	return "ja";
	  }
	}
	hf[0].value = avl(document.documentElement.lang.split("-")[0]);
	hf[1].name = "to";
	hf[1].value = 'en';
	hf[2].name = "text";
	hf[2].value = s
	for (i = 0; i < hf.length; i++) f.appendChild(hf[i]);
	document.body.appendChild(f);
	open('', wn).focus();
	f.submit();
})();
Converted to a single-line with https://chriszarate.github.io/bookmarkleter/:

Code: Select all

javascript:void%20function(){var%20a=Math.floor;function%20b(a){return%20a.selection%3Fa.selection.createRange().text:a.getSelection()}function%20c(a){return%22bg%22===a||%22cs%22===a||%22da%22===a||%22de%22===a||%22el%22===a||%22es%22===a||%22et%22===a||%22fi%22===a||%22fr%22===a||%22hu%22===a||%22id%22===a||%22it%22===a||%22ja%22===a||%22ko%22===a||%22lv%22===a||%22lt%22===a||%22nb%22===a||%22nl%22===a||%22pl%22===a||%22pt%22===a||%22ro%22===a||%22ru%22===a||%22sk%22===a||%22sl%22===a||%22sv%22===a||%22tr%22===a||%22uk%22===a||%22zh%22===a||%22ar%22===a%3Fa:%22ja%22}for(s=b(document),i=0;i%3Cframes.length%26%26!s;i++)s=b(frames[i].document);if(s%26%26%22%22!=s||(s=prompt(%22Enter%20text%20to%20translate%20with%20SimplyTranslate%22,null)),!!s){let%20b=%22w_%22+Date.now()+a(1e5*Math.random()).toString();var%20d=document.createElement(%22form%22);d.setAttribute(%22method%22,%22post%22),d.setAttribute(%22action%22,%22https://mozhi.pussthecat.org/%3Fengine=deepl%22),d.setAttribute(%22target%22,b);var%20e=[,,,];for(i=0;i%3Ce.length;i++)e[i]=document.createElement(%22input%22),e[i].type=%22hidden%22;for(e[0].name=%22from%22,e[0].value=c(document.documentElement.lang.split(%22-%22)[0]),e[1].name=%22to%22,e[1].value=%22en%22,e[2].name=%22text%22,e[2].value=s,i=0;i%3Ce.length;i++)d.appendChild(e[i]);document.body.appendChild(d),open(%22%22,b).focus(),d.submit()}}();
The DeepL option unfortunately doesn't support an auto as source language, so I'm back with document.documentElement.lang. It will only do the non-English languages that DeepL supports though, and it will ignore the region part (e.g. es-AR becomes es). If the document doesn't have a supported language it will default to Japanese as source language (which seems to be the most used for DeepL, well at least I mostly use Japanese for it because as you said DeepL is better than Google for it).
Image

Tired of creating stuff!

Avatar artwork by Shinki669: https://www.pixiv.net/artworks/113645617

XUL add-ons developer. You can find a list of add-ons I manage at http://rw.rs/~job/software.html.

User avatar
Mæstro
Keeps coming back
Keeps coming back
Posts: 808
Joined: 2019-08-13, 00:30
Location: Casumia

Re: DeepL Translate page been wonky lately

Post by Mæstro » 2025-12-01, 15:20

In the desire to avoid large language models altogether, I swapped DeepL for LibreTranslate, which is available in several instances and employs traditional, rules-based methods, like Babelfish in the good, old days. Like Job, I usually wish to make Japanese text intelligible, and I find this suffices. Online bilingual dictionaries also help. German readers might already know Leo and Pons, while other sites are more helpful for Chinese, Japanese and Korean. WolframAlpha can also serve as multilingual dictionary.
Life is a fever dream Mæstro would enjoy.
All posts 100% organic. Ash is the best letter.
What is being nice online?
Debian 10 ELTS / Official PM build

User avatar
Lecco
Newbie
Newbie
Posts: 5
Joined: 2025-08-16, 12:55

Re: DeepL Translate page been wonky lately

Post by Lecco » 2025-12-06, 12:12

jobbautista9 wrote:
2025-11-29, 15:32

Code: Select all

if (!s) return; /* Don't do anything if prompt cancelled */
That is a good idea, I added it to my script. :thumbup:

User avatar
tellu-white
Lunatic
Lunatic
Posts: 290
Joined: 2022-03-08, 22:02

Re: DeepL Translate page been wonky lately

Post by tellu-white » 2025-12-07, 17:17

UCyborg wrote:
2025-11-30, 11:05
DeepL works better for some languages. The idea in my case is specifically to avoid Google / Bing.
In a previous post, I said:
I've made a Custom Button that gets rid of unnecessary stuff on the page, which also helps Pale Moon to reduce the load of heavy scripts.

Note: Unfortunately, from time to time, at irregular intervals (sometimes short, sometimes long), DeepL gets upset and removes all content from the page (the page becomes empty).
https://forum.palemoon.org/viewtopic.php?f=70&t=32874#p267168

Important!
If I don't remove the unnecessary tags from "DeepL Translator" page, Pale Moon ends up using up to 90% of the CPU ( I have an older PC ). After removing these tags, the CPU level drops to 0%.

***

It seems that in the Custom Button code posted in the previous comment, I also removed the tags that DeepL uses later. It seems that this is the reason why DeepL empties the page after a while (it cannot find the respective tags). I rewrote the code after several tests, and it seems that with the new code, the problem with the page becoming empty after a while has disappeared. After 40 minutes, "DeepL Translator" is still working correctly.

Also, in the new tests, I accepted cookies and manually closed all pop-ups (not with JavaScript code) before using the button. The URL used in the tests is https://www.deepl.com/en/translator

Custom Button "CODE" :

Code: Select all

/*CODE*/

var arr_is_home = content.document.getElementsByClassName("[.is-home_&]:hidden");

if(arr_is_home){
	for(var i=0; i<arr_is_home.length; i++){
		var is_home_className = arr_is_home[i].className;
		
		if(is_home_className == "[.is-home_&]:hidden"){
			arr_is_home[i].parentNode.removeChild(arr_is_home[i]);
		}
	}
}


var footer = content.document.getElementsByTagName("footer");

if(footer){
	footer[0].parentNode.removeChild(footer[0]);
}


var arr_header = content.document.getElementsByTagName("header");

for(var i=0; i<arr_header.length; i++){
	var header_className = arr_header[i].className;
	
	if(header_className && header_className.includes("page-header")){
		arr_header[i].parentNode.removeChild(arr_header[i]);
	}
}


var all_tags = content.document.getElementsByTagName("*");
var i = all_tags.length;

while(i--){
	try{
		var dataset = all_tags[i].dataset;
		
		if(dataset){
			var dataset_layoutId = all_tags[i].dataset.layoutId;
			
			if(dataset_layoutId){
				if(dataset_layoutId == "translatorSidePanel"){
					all_tags[i].parentNode.removeChild(all_tags[i]);
				}
			}
		}
		
	} catch(err){
		console.log('ERROR in "DeepL - Restore Page Layout" : ', err.message);
	}
}


var all_tags = content.document.getElementsByTagName("*");
var i = all_tags.length;

while(i--){
	try{
		var dataset = all_tags[i].dataset;

		if(dataset){
			var dataset_layoutId = all_tags[i].dataset.layoutId;
			
			if(dataset_layoutId){
				if(dataset_layoutId == "sourceTextareaContainer"){
					all_tags[i].style.cssText = 'display: inline-block; vertical-align: top; width: 48vw; margin: 0px; padding: 10px 0px 10px 10px;';
				}
				
				if(dataset_layoutId == "targetTextareaContainer"){
					all_tags[i].style.cssText = 'display: inline-block; vertical-align: top; width: 48vw; margin: 0px; padding: 10px 0px 10px 10px;';
				}
			}
		}
		
	} catch(err){
		console.log('ERROR in "DeepL - Restore Page Layout" : ', err.message);
	}
}


var textareas_Container = content.document.getElementById("textareasContainer");

if(textareas_Container){
	textareas_Container.style.cssText = 'width: 98vw; margin: 0px; padding: 0px;';
}


var arr_contents = content.document.getElementsByClassName("contents");

for(var i=0; i<arr_contents.length; i++){
	var contents_className = arr_contents[i].className;
	
	if(contents_className && contents_className == "contents"){
		var role_attribute = arr_contents[i].getAttribute("role");
		
		if(!role_attribute){
			arr_contents[i].style.cssText = "display: inline-block; margin: 0px; padding: 0px;";
		}
	}
}

Custom Buttons Enhanced 0.0.6

https://forum.palemoon.org/viewtopic.php?f=71&t=32626

Screenshots:
01.png
02.png
03.png
04.png
05.png
06.png
07.png
08.png
09.png
You do not have the required permissions to view the files attached to this post.

User avatar
jobbautista9
Board Warrior
Board Warrior
Posts: 1120
Joined: 2020-11-03, 06:47
Location: Philippines

Re: DeepL Translate page been wonky lately

Post by jobbautista9 » 2025-12-09, 15:01

How does that custom button compare to using these uBlock Origin filters and Stylem/userContent CSS which seem to achieve the same thing?

Code: Select all

! 2025-12-09 https://www.deepl.com
www.deepl.com##.\[\.is-home_\&\]\:lg\:pb-\[90px\].\[\.is-home_\&\]\:md\:pb-\[130px\].\[\.is-home_\&\]\:min-h-screen.min-w-0.flex-1.relative > .z-\[999\].top-0.sticky
www.deepl.com##.Page_scalableTranslator__rzGIl.bg-white.relative > .\[\.is-home_\&\]\:hidden
www.deepl.com##.py-10.px-8.gap-10.flex-col.max-w-\[1440px\].w-full.flex.sm\:px-15
www.deepl.com##.items-center.justify-between.gap-2.py-2.px-3.flex-1.min-w-0.flex.mobile\:p-0 > .overflow-hidden.gap-1\.5.items-center.flex > .shared_contents__lpgzs > .shared_contents__lpgzs > .shared_contents__lpgzs.Tooltip_Target_Target__WFp_8

Code: Select all

@namespace url(http://www.w3.org/1999/xhtml);

@-moz-document domain("deepl.com") {
  #textareasContainer
  {
    width: 98vw;
    margin: 0px;
    padding: 0px;
  }
  
  #textareasContainer > div.contents
  {
    display: inline-block;
    margin: 0px;
    padding: 0px;
  }
  
  div[data-layout-id='sourceTextareaContainer'],
  div[data-layout-id='targetTextareaContainer']
  {
    display: inline-block;
    vertical-align: top;
    width: 48vw;
    margin: 0px;
    padding: 10px 0px 10px 10px;
  }
  
  .Button.as-medium.is-icon-only
  {
    padding: unset !important;
    margin-left: 500px;
    margin-top: -500px;
  }
}
Image

Tired of creating stuff!

Avatar artwork by Shinki669: https://www.pixiv.net/artworks/113645617

XUL add-ons developer. You can find a list of add-ons I manage at http://rw.rs/~job/software.html.

User avatar
tellu-white
Lunatic
Lunatic
Posts: 290
Joined: 2022-03-08, 22:02

Re: DeepL Translate page been wonky lately

Post by tellu-white » 2025-12-09, 18:13

jobbautista9 wrote:
2025-12-09, 15:01
How does that custom button compare to using these uBlock Origin filters and Stylem/userContent CSS which seem to achieve the same thing?
I don't know the answer to this question because I don't use uBlock Origin and Stylem.