Odd interaction with Discourse and Google Translate

This was brought up by one of regular members that uses a Firefox add-on for page translation, but this seems to be independent of it and can be reproduced with any page in meta.

Steps:

  1. go to https://translate.google.com/
  2. paste a URL like https://meta.discourse.org/t/using-discourse-index/308031
  3. hit the translate icon/button

You’ll likely land on a Discourse 404 page with a URL like this

https://meta-discourse-org.translate.goog/t/using-discourse-index/308031/t/using-discourse-index/308031?_x_tr_sl=en&_x_tr_tl=pt-PT&_x_tr_hl=en&_x_tr_pto=wapp&_x_tr_hist=true

Notice that the URL has the path /t/using-discourse-index/308031 duplicated in it. Removing the duplicate fragment makes the translation work as expected.

Normally this would be an issue with google translate, but it seems to only happen with Discourse (I’ve tried a few other websites) and after we updated to 3.2.

2 Likes

Sorry for rehashing this, but I think I chose the wrong title (and angle) and it didn’t get the proper attention.

Right now, Discourse is incompatible with Google Translate which is likely the most used translation tool.

Any topic URL pasted into Google Translate always ends up with the 404 page being translated and not the actual topic. It works ok with the homepage and topic lists URLs – but not a topic.

Perhaps Google Translate is being fed some special crawler/print version that doesn’t work for this purpose?

I use Google Translate regularly and I only saw this behaviour with Discourse topics, so at least part of the issue appears to be in Discourse.