Automatic text translation at MSDN pages - How to turn off? - msdn

Is there a way to turn off the automatic text translation at the MSDN library pages ?
I do prefer English text but due to having a German IP address Microsoft activates the automatic translation on every new page load which gives me a yellow box with a German translation of the text I am currently hovering over with the mouse.
This happens regardless what language is initially set in the right upper corner and regardless of whether I am logged in or not.
I can't tell how annoying this is !!
Any ideas, anyone ?

When you hit the "Original" radio button at the top, you see English, with German in the yellow hover box.
If you visit the original English site, you don't see a translation, not even on hover.
You switch to English by replacing /de-de/ in the URL with /en-us/. As in
German (translation or original with translation on hover):
http://msdn.microsoft.com/de-de/library/system.diagnostics.contracts.contractargumentvalidatorattribute(v=vs.110).aspx
English only (no translation):
http://msdn.microsoft.com/en-us/library/system.diagnostics.contracts.contractargumentvalidatorattribute(v=vs.110).aspx

If you are a firefox user, you can use Redirector addon. Create a new redirect and set it up like this:
It will automatically redirect all msdn requests to english non-translated versions.

Found it! I mean, it's 2016, 3 years late, and maybe they just added it recently, but when you scroll all the way down there's a small button in the left bottom corner where you can choose language you want to use (more specifically a country "you're from").

MSDN uses the prefered language from your web browser settings.
http://social.msdn.microsoft.com/Forums/en-US/6543407d-f743-48fb-965b-b8af9f9a0cb1/howto-disable-automatic-translation-into-german?forum=msdnfeedback
This is due to the Accept-Language header:
http://www.w3.org/International/questions/qa-accept-lang-locales
So setting your browser to prefer English language websites should fix this problem. W3C has an overview how to do that on different browsers here:
http://www.w3.org/International/questions/qa-lang-priorities.en.php

There is a chrome addon aswell
Switcheroo-Redirector

I got tired of replacing manually the url of the MSDN docs to target en-us in the url, so I came up with this little user script for the very handy Tampermonkey extension (available on Chrome, Microsoft Edge, Opera, and Firefox)
// ==UserScript==
// #name MSDN docs [en-us] redirect
// #version 0.1
// #description Redirects to the en-us version of the current MSDN doc page
// #grant none
// #match https://learn.microsoft.com/*
// ==/UserScript==
(function () {
let pathname = window.location.pathname.split('/');
if (pathname[1].toLowerCase() !== 'en-us') {
pathname[1] = 'en-us';
pathname = pathname.join('/');
window.location.href = window.location.origin + pathname + window.location.search;
}
})();
Once you have the extension installed,
Click on its icon
Click on Create a new script...
Paste the previous code
Save it (Ctrl + S or File > Save).
Test the redirection: https://learn.microsoft.com/fr-fr/dotnet/csharp/programming-guide/classes-and-structs/classes
The #match property will ensure that this script is only run against MSDN doc pages.

Recently I came across the same problem. And I solved it with Chrome extension ModHeader.
I configured and it works:

I know it's an old question, by maybe this insight will be useful to someone.
I almost always open msdn through a search in google. It most of the time offered me site translated to my local language (through a part of the address with locale), sometimes accompanied by original (English) version next to it. If I click on the original language link, it does not translate anything, so it is not automatic translation based on my localization.
What solved my problem was to change google search settings to prefer English, rather than my native language. Go to google search settings, set Which language should Google products use? to English, then in Currently showing search results in: click Edit and check other languages you are likely to search in.
It will also change the UI language for google. I know it might be a high price to pay, but I believe it is worth it. If you search for a query typed in given language, results will most likely result in this language pages anyway.

Instead of extensions, which will consume memory and are a bit overkill for that kind of thing, you can use a custom search query.
Chrome
Settings => Manage Search Engines, add this entry:
Engine: MSDN US
Keyword: ms
URL: https://social.msdn.microsoft.com/Search/en-US?query=%s (or whatever the proper url is at the time of your reading, just use %s wherever it needs the actual query string)
Now, in the address bar, just type ms [SPACE]. As soon as you press the space, it will prompt you with Search on MSDN US:. Just type your query now. For instance ms string will redirect you to the MSDN-US version of the search results for string. Of course you can change the title and keyword.
I'm sure the other common browsers expose that kind of functionality too. On Firefox, I used to plug custom search engines on the search bar.
This is a neat trick that I use for all kinds of searches (SO, Amazon, Wikipedia in different languages, etc.). It's very efficient.

Usually there is a language link at the bottom of the page where you can change language (even though a permanent site specific setting would be much nicer).

In IE in Internet Options Panel you have Apperrance part in General Tab. Add preffered language as a first and from now on all pages from MSDN will be presented in choosen language

I'm using NoScript addon with Firefox (actually Waterfox), just forbib "m-msft.com", the translator will be turned off. I think you can use other plugins in other browser to forbid the domain too. NoScript is a must have addon for any serious web user, and UserStyles, of course.

Related

DuckDuckGo API - How to get more results?

The default search using the DuckDuckGo API returns only the results on the first page (around 25 I guess). Is there any way to get more results or navigate to the 2nd, 3rd pages of the search results?
Websites like Faroo have a parameter called s (which stands for start) which can be set to 1 if we want the first 10 results, to 11 if we want the next 10 results and so on. Is there something like that for DuckDuckGo, too?
According to DuckDuckGo Search API documentation, all the available parameters are:
q: query
format: output format (json or xml)
If format=='json', you can also pass:
callback: function to callback (JSONP format) pretty: 1 to make JSON
look pretty (like JSONView for Chrome/Firefox)
no_redirect: 1 to skip HTTP redirects (for !bang commands).
no_html: 1 to remove HTML from text, e.g. bold and italics.
skip_disambig: 1 to skip disambiguation (D) Type.
In particular, note that:
This API does not include all of our links, however. That is, it is
not a full search results API or a way to get DuckDuckGo results into
your applications beyond our instant answers.
TL/DR; - Install TamperMonkey, add the short script below (full instructions follow) and the browser will lazy-load the next page(s) automatically as you scroll.
After coming to this answer via Google and not finding the information I was seeking, I wrote this small TamperMonkey script to do the job. I post it here for future googlers.
The below userscript will work with Chrome, Firefox and Opera. Instructions for installation follow below the script, and a brief explanation of what TamperMonkey is follows below that.
This script is inspired by, and named similarly to (in honor of), Endless Google by Tumpio.
// ==UserScript==
// #name Endless DuckDuckGo
// #namespace http://tampermonkey.net/
// #match https://duckduckgo.com/?q=*
// #require http://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js
// #grant none
// ==/UserScript==
(function() {
'use strict';
$(window).scroll(function(){
var els = document.querySelectorAll('.result.result--more');
if (els.length){
var elmore = document.querySelectorAll('.result--more__btn.btn.btn--full');
if (elmore.length){
elmore[0].click();
}
}
});
})(); //
How To Install the Above Script:
Install the TamperMonkey extension for Chrome (or the "add-in" for Firefox).
You will see the TamperMonkey icon appear at the top of the browser
Do a search on DuckDuckGo
Click on the TamperMonkey icon and from the drop-down menu, choose Dashboard
Along the tabs at the top of the Dashboard page, click on the [+] icon at left of the tab strip
The TamperMonkey editor will open up with a blank UserScript template. Delete that entire sample script and replace it with the script from this post.
Save [Ctrl] + [s]
Run another DuckDuckGo search and scroll down the page... True happiness is yours.
What Is TamperMonkey:
A good overview is here.
TamperMonkey is a browser extension, and there is a version of TamperMonkey for each major browser. You probably already use the AdBlock or uBlock browser extensions (if not, WHY NOT?), this is just another extension like those. Anyway, to install for Chrome or Brave, go to the Chrome Web Store and search for TamperMonkey by Jan Binoc. Install it. (Yes, it's safe - there are hundreds of thousands of users, mostly coders). Please consider donating - Jan deserves your support (and no, I don't know him, and yes I donated.)
Before TamperMonkey, there was another extension called GreaseMonkey that did the same thing but only worked on Firefox. However, the GreaseMonkey authors stopped maintaining it or something, and Jan Binoc stepped up to the plate with TamperMonkey.
TamperMonkey allows us to inject our own code into ANY webpage, to programmatically manipulate the web page on our local computers. How does that work? Simplistic Explanation: When you view a web page, you never actually view it "directly from the web server" - your browser first downloads a local copy of the web page code to your browser's cache folder and displays it to you from there. Therefore, TamperMonkey can intercept the page as it loads from cache (on your local hard drive) into the browser and modify it before it is displayed. That explanation is super-simplistic and not fully technically accurate, but in essence that is exactly how it works, and why TamperMonkey works. Most Importantly: The above few lines explain why the page does not change for anyone else - just for you, on your own computer.
TamperMonkey is an excellent reason to learn a bit of javascript/css/html. Using it, you can do stuff like hiding or re-arranging images on a webpage, removing clutter from a page, totally reformatting a page, etc. For example, one of my fav News sites has lots of clutter. So, I go to their RSS feed page, which acts like a great index of articles, but that also has too much stuff I don't want to see (mainly unnecessary thumbnail images and too-narrow columns). I wrote a short TM script to hide all the images and widen the columns and now, instead of seeing 5 or 6 article summaries per screen, I see ~ 20.
The absolute best, most concise, primer for html/css/js that I've ever seen is on Lynda.com. (You might already have access via your local library card - I was greatly surprised to find out that I do.) There is a series by Emma Saunders called D3.js Essential Training for Data Scientists. The course begins with two short tutorials (Recalling HTML Basics (4m) and Understanding HTML5 (3m) ) in html/css/js that are worth a university course tuition by themselves. Why can't everyone teach like this? Anyway, that's all you need - those first two (3 and 4 min) videos. Now, go tweak a webpage.
(Final disclaimer: No, I don't know Emma Saunders either, nor do I have anything to do with either Binoc's or Saunders' products in any way. I'm just a run-of-the-mill user and fan.)

How to get the raw text from Opera's omnibox when the text is not a valid URI

Since Opera no longer implements the shortcut "/." to visit slashdot.org, I thought to write an extension that replaces that functionality.
I have not previously written an Opera extension, so I hit the docs.
Setting up an omnibox extension doesn't work, because it requires the user to put a space after the keyword.
As "/." isn't a valid URL, I'm not seeing an obvious way to intercept it.
My issue boils down to "how do I get the text before Opera assumes the user is trying to do a keyword search?"
"/." is valid url, but this is not working in Opera.
This is bug which should be fixed soon. But still you will have to wait until
user will put space and the start typing text to omnibox.
Event onInputStarted is the earliest event you can catch. I tried
chrome.omnibox.onInputStarted.addListener(function () {
chrome.tabs.create({url:"http://slashdot.org"});
})
and browser create tab after user type first letter.

Why do I have an error on some Flattr buttons?

I've integrated Flattr with my Dotclear blog, using the appropriate plugin, and it works fine.
Except that, from time to time, some older posts have errors and I don't understand why.
See:
http://ploum.net/post/224-gpager-03-scenes-from-a-memory-finally-free
http://ploum.net/post/86-le-repas-de-noel-en-famille
those posts have nothing special and, yet, cannot be Flattered.
Could it be an issue on Flattr side ? Do you see what can cause that problem ?
Thanks in advance,
Seems like you're both using the new 0.6 version of the Flattr JavaScript API and a quite old 0.2 version. Using two versions at the same page can probably result in some pretty strange things - I would suggest just using the newer version that is documented here: https://flattr.com/support/integrate/js
Regarding why the button show an error - here's a bit of a secret way to find out: Look at the HTML for the button iframe and look within the div-tag with a "button-wrapper"-class - there you should find an HTML-comment that states the reason for the button error.
In your case the HTML-comment in the button iframe says "ERRORS: User couldn't be found and no owner specified." - which isn't strange since the iframe's URL has "0" specified as the uid-parameter - it should be a username instead.
Your script is disrupted by doublequotes in "var flattr_tle=", you should encode them with '"'

How to set MSDN to be always in English

I know that this isn't exactly programming question, but it is tightly related -
How the hell do I set MSDN to display everything in English? I'm Czech, and every KB or documentation article it automatically translates it to Czech with their translator, which result just in gibberish, and switching it to English requires couple of searching and clicks.
I wrote a simple dedicated browser extension for this. Unlike the Redirector plugin, no configuration is required.
It's called "FFS MSDN in English" and is available for:
Chrome
Firefox
Opera
It simply redirects any localised MSDN (or docs.microsoft) page to the english (en-us) version.
The rather trivial sources can be found at https://github.com/AirLancer/ffs_msdn_in_english
Very legitimate question, I think.
You need to modify the url like explained here. In your case change cz-cz to en-us.
Or better, let it do a browser plugin like Redirector for firefox:
You can select your default language from bottom left of the page.
Edit
New docs site has an easier option to view in English. However, the setting is not permanent.
I've fixed it by installing a redirector plugin for chrome:
http://bendavis78.github.io/chrome-extension-redirector/
If you are using Google search, you need to change language preferences for Google itself (you don't need to be logged in)1:
Go to https://google.com
Click Settings > Search settings on the bottom right corner.
Proceed to Languages tab.
Choose English as preferred.
1 You might also need to do what pr0gg3r and Beachwalker advise.
One solution is to rewrite google's search engine links using this Tampermonkey userscript:
// ==UserScript==
// #name Fix learn.microsoft.com links on google.com
// #description Changes all links to en-us versions.
// #include /^http[s]?:\/\/(www\.)?google\.[a-z]{2,3}\/.*$/
// #noframes
// #grant none
// ==/UserScript==
(function() {
'use strict';
let re = /^(https?:\/\/(docs|msdn).microsoft.com)\/(\w+\-\w+)\/(.*)/i;
const links = document.querySelectorAll("a");
for (const link of links) {
let m = re.exec(link.href);
if (!m) continue;
const clone = link.cloneNode(true);
clone.removeAttribute('onmousedown');
clone.href = `${m[1]}/en-us/${m[4]}`;
link.replaceWith(clone);
}
})();
Edit 2021-01-28: Remove onmousedown attribute event from link. Stops link capture and substitution of google's own redirect link.
I do not want to use extensions because I consider their required permissions to be a major security risk. Furthermore MSDN is not the only site where translations sucks. So for me the best solution was to change the language settings in Windows 10. Add English to your "Preferred languages" and set it to be 1st. Apps and websites will appear in the first language in the list that they support.
I like to have the choice between the translated and en-us version.
I authored the following UserScript... to be used in TamperMonkey for instance.
It does what it pretends in the #description.
// ==UserScript==
// #name Link to MSDN in en-us
// #description Adds a link in the top left corner of the translated MSDN pages allowing to jump to en-us version.
// #match http*://learn.microsoft.com/*
// #match http*://msdn.microsoft.com/*
// ==/UserScript==
(function() {
'use strict';
let url = location.href;
let rx = /^http([s]?):\/\/(docs|msdn)\.microsoft\.com\/(\w+\-\w+)\/(.*)$/i;
let match;
if ( match = rx.exec(url) ) {
if (match[3] !== 'en-us') {
var targetUrl = url.replace(rx, "http$1://$2.microsoft.com/en-us/$4");
jQuery("body").prepend(
jQuery('<a>en-us</a>').attr('href', targetUrl)
);
}
}
})();
In Firefox > Settings > "Language and Appearance" section there is below some Language settings a button next to a label that says:
"Choose your preferred language for displaying pages"
There you can setup a ordered list of languages. I have added english and moved it to the top of the list.
Now after a restart the same, previously opened msdn links do not auto translate.
I don't know the browser you're using but most browsers send info about the client to the server (incl. preferred language). So one option might be to set the default language to english (as done here for Firefox).

How to stop firefox from downloading and applying CSS via a firefox extension?

Thanks to everyone in advance -
So I have been banging on this issue for quite a while now and have burned through all my options. My current approach to canceling css requests is with nsIRequest.cancel inside of nsIWebProgressListener.onStateChange. This works most of the time, except when things are a little laggy a few will slip through and jump out of the loadgroup before I can get to them. This is obviously a dirty solution.
I have read through the following links to try and get a better idea of how to disable css before a nsIRequest is created...no dice.
https://developer.mozilla.org/en/Document_Loading_-_From_Load_Start_to_Finding_a_Handler
https://developer.mozilla.org/en/The_life_of_an_HTML_HTTP_request
https://developer.mozilla.org/en/Bird's_Eye_View_of_the_Mozilla_Framework
How do I disable css via presentation objects/interfaces? Is this possible? Inside of nsIDocShell there are a few attributes that kind of imply you can disable css via the browsers docshell - allowPlugins, allowJavascript, allowMetaRedirects, allowSubframes, allowImages.
Any suggestions?
Thanks,
Sam
The menu option that disables style sheets uses a function
setStyleDisabled(true)
so you probably can just call this function whenever new browser tab is created. Style sheets are still requested from server, but not applied. This function is not very sophisticated and doesn't mess with nsIRequest, source:
function setStyleDisabled(disabled) {
getMarkupDocumentViewer().authorStyleDisabled = disabled;
}
Digging in Web Developer Toolbar source code I have noticed that their "disable stylesheets" function loops trough all document.styleSheets and sets the disabled property to true, like:
/* if DOM content is loaded */
var sheets = document.styleSheets;
for(var i in sheets){ sheets[i].disabled = true; }
So if the key is to not apply CSS to pages, one of the above solutions should work. But if you really need to stop style sheets from being downloaded from servers, I'm affraid nsIRequest interception is your only option.
Set permissions.default.stylesheet to 2 and voilà!
You can actually use the permissions manager to block or allow stylesheets on a host-by-host basis.
Unfortunately there doesn't seem to be a simple flag like allowImages. The bugzilla adding for that is https://bugzilla.mozilla.org/show_bug.cgi?id=340746. You can now vote for it using the new bugzilla voting functionality. You can also add yourself to the CC list to be notified if anyone ever works on it.
A related request is to just give us basic HTML parsing support, which may be what you are trying to do. Unfortunately that isn't supported yet either, but you can vote/track the bugzilla for that at https://bugzilla.mozilla.org/show_bug.cgi?id=102699.
So the only workable solution seems to be some sort of interception as #pawal suggests. Here is a link that talks about the basics of interception to at least get you/us started https://developer.mozilla.org/en/XUL_School/Intercepting_Page_Loads. It lists several options that I list below.
These first few seem to just be at the page/document level so I don't think they help:
Load Events (addEventListener load)
Web Progress Listeners (nsIWebProgressListener) - I tried this approach, it only seems to be called for the page itself, not for content within the page.
Document Loader Service - A global version of nsIWebProgressListener so I think it has the same problem (page level only)
That leaves two others I have not tried yet. They work globally so you would need to filter them to just the browser/pages you care about.
HTTP Observers - Seems like it might work, need to verify it calls back for CSS
Content Policy - Seems like the best option to me since it explicitly is called for CSS, someday I hope to try it :)