Home > firefox, javascript > Patch to Google Translate https pages

Patch to Google Translate https pages

Problem

When you want to translate a page with Google Translate that uses the HTTPS protocol, you will get an error. Translation only works with HTTP addresses. Here is how to reproduce the problem:

You will get a beautiful “Sorry, this URL is invalid” error.

Explanation:

This a known bug on the side of Google but they don’t rush to correct it. In the address bar you have the string “http://translate.google.com/translate?js=n&prev=_t&hl=en&ie=UTF-8&layout=2&eotf=1&sl=auto&tl=en&u=https%3A%2F%2Fubuntulife.wordpress.com%2F”. Notice that the address to be translated begins with https. In the upper frame, Google Translate transforms this address to “http://ubuntulife.wordpress.com:443/”, i.e. port 443 is added automatically.

Update (20110211): Google has a clarification. In this thread, Google guy Josh says the following: “Currently our webpage translation service will not translate secure https pages. This is because such pages often have secure content, that you wouldn’t want to send over the wire plain text to Google Translate.” That is, they know about this problem but they don’t have a good solution.

Manual workaround #1:
Remove the port “:443” from the Google Translate textfield and press the button Translate.

Manual workaround #2:
In the address bar, locate the string https and change it to http. Then press Enter to reload the page. The port “443” will also disappear.

Workaround for the lazy ones

Let’s use a simple bookmarklet that implements the manual method #2:

javascript:
var l = document.location;
var h = l.href;
var https = encodeURIComponent('https://');   // https%3A%2F%2F
var http = encodeURIComponent('http://');   // http%3A%2F%2F
l.href = h.replace(https, http);
void(1);

Installation:
Open this page in a new tab. There, you will find a link “ReTr” (re-translate). Drag and drop that link to the bookmark bar.

Usage:
Once the ReTr (re-translate) bookmarklet is installed, try to translate an HTTPS page. When you get the error message, just click on the ReTr bookmarklet and the page should be translated correctly.

Translate with Flagfox

Flagfox is a Firefox add-on that can “display a country flag depicting the location of the current website’s server and provides a multitude of tools such as site safety checks, whois, translation, similar sites, validation, URL shortening, and more…

How to translate a page with Flagfox: right click on the country flag in the address bar -> select Google Translate. You will get an error message with HTTPS pages, but you can correct it with the previously mentioned “ReTr” bookmarklet.

  1. Steven Seagal
    February 11, 2011 at 00:56

    The workarounds don’t work unless the website supports plain unencrypted HTTP for the needed content. Some sites, such as github.com, only support HTTPS, so in this case you are out of luck.

  2. HOWARD HOYT
    February 12, 2011 at 20:52

    Very helpful. I have been struggling with google translate of spam in gmail for reporting.

    Turns out my Ubuntu 10.10/Chrome9 translate problem was the https: as explained above.
    Note: For me, not able to change adr bar https: to http: – translate does not then load.
    BUT, changing to BASIC (HTTP) gmail allows the translate to go ahead, so that is the problem.

    tks, Howie

  3. Eric
    June 6, 2012 at 01:53

    You would think that they could come up with an error message that actually explained what the problem was, rather than this bogus message.

  4. Hannah
    June 7, 2012 at 07:35

    my internet office was blocked all access. but i can access it by add it https in front since it still cannot be used it for google translate no use :( i really need it. anyway any suggestion for translation using https :( i need to create the sentences.

    • Zsolt
      March 7, 2013 at 13:20

      Chrome can do it, because it has built in translation capability. For firefox I still can’t find a solution

  5. reader
    July 18, 2012 at 15:24

    How EXACTLY do you do the “Manual workaround #1:” ?
    Unable to delete the :443 part. If I highlight the :443 and press the keyboard delete key, then nothing happens. And if highlight it and press the backspace key, then the browser just goes back to the previous page, like when you click the browser’s back button.
    Thank you.

    • July 20, 2012 at 21:23

      I guess you want to delete “:443” on the HTML page and not in the URL textfield. Try to modify the URL in the address bar. Try workaround #2 too.

  6. Zsolt
    March 7, 2013 at 13:21

    Are there no workarounds for https and firefox?

  7. May 5, 2013 at 17:42

    You can just use google’s own multi-language translator.

    See my site big-lies.org

    I only found the 443 error by testing my site and couldn’t understand why this error suddenly appeared. As it happens, I’d put BOTH the single flag things and Google’s drop-down multi language translator. Keep the flags if you like them, but only allow the drop down menu to function, is easiest with firefox.

  8. May 30, 2013 at 22:06

    With me the manual workouts are not helping as that when I change to http or delete 443 I get message that specific site got redirected to other site that includes the https again and that site could not be translated

  1. No trackbacks yet.

Leave a comment