Alien Road Company

Google Search strives to make information accessible and useful to all users. To help address content gaps when a user queries in their local language, sometimes Google may translate the title link and snippet of a search result for results that aren’t in the language of the search query. A translated result is a Google Search feature that enables users to view results from other languages in their language, and can help publishers reach a larger audience.

Currently, translated results are available for English results to the following languages: Indonesian, Hindi, Kannada, Malayalam, Tamil, Telugu. It’s available on mobile devices with any browser that supports Google Search.

If the user clicks the translated title link, all further user interaction with the page is through Google Translate, which will automatically translate any links followed. By expanding the result, users can view the original title link and snippet, and access the entire page in the original language.

Clicking the translated title link in Google Search leads to a translated page, and expanding the result leads to the original version of the page

Google doesn’t host any translated pages. Opening a page through a translated result is no different than opening any other URL in Google Translate. This means that Javascript on the page is usually supported, as well as embedded images and other page features.If you run an ad network, you may need to take additional action to ensure that your ad network displays correctly after a user clicks a translated result. Learn more about enabling your ad network to work with translation-related Google Search features.

Monitor performance in Search Console 

To monitor clicks and impressions for translated results, you can use the Search Appearance filter in the Performance report.

Opting in or out of translated results

This feature is applicable across all pages and results based on the user’s language. You don’t need to do anything to opt in.

Translated results are like other translation-related features in Google Search. To opt out of all translation features in Google Search, use the notranslate directive:

<meta name="robots" content="notranslate">
<meta name="googlebot" content="notranslate">
HTTP/1.1 200 OK
Date: Tue, 25 May 2010 21:42:43 GMT
X-Robots-Tag: notranslate

Google Search offers several translation-related features that enable users to access translated content. If you run an ad network and your ads aren’t working properly on translated web pages, you’ll need to follow the steps in this guide to make sure your ads render or attribute correctly.

Our approach

When users access translated content provided by Google Translate from within search results, Google retrieves the page from the publisher, rewrites the source URL, and translates the web page after the user clicks the translated result.

Convert the Google Translate URL to the original URL

If you run an ad network that relies on the publisher’s source URL, you’ll need to convert the Google Translate URL to make sure your ads are working properly. Follow these steps to decode the publisher’s hostname:

  1. Extract the domain prefix from the hostname, by removing the suffix.
  2. Split the _x_tr_enc parameter by the , (comma) character and save it as encoding_list.
  3. Prepend the value of the _x_tr_hp parameter to the domain prefix, if it exists.
  4. If encoding_list contains 1 and the output begins with 1-, remove the 1- prefix from the output of step 2.
  5. If encoding_list contains 0 and the output begins with 0-, remove the 0- prefix from the output of step 3. If you removed the prefix, set is_idn to true. Otherwise, set is_idn to false.
  6. Replace /\b-\b/ (regex) with the . (dot) character.
  7. Replace the -- (double hyphen) character with the - (hyphen) character.
  8. If is_idn is set to true, add the punycode prefix xn--.
  9. Optional: Convert to Unicode.

Sample JavaScript code for decoding the hostname from a Google Translate URL 

function decodeHostname(proxyUrl) {
  const parsedProxyUrl = new URL(proxyUrl);
  const fullHost = parsedProxyUrl.hostname;
  // 1. Extract the domain prefix from the hostname, by removing the
        "" suffix
  let domainPrefix = fullHost.substring(0, fullHost.indexOf('.'));

  // 2. Split _x_tr_enc parameter by "," (comma), save as encodingList
  const encodingList = parsedProxyUrl.searchParams.has('_x_tr_enc') ?
      parsedProxyUrl.searchParams.get('_x_tr_enc').split(',') :

  // 3. Prepend value of _x_tr_hp parameter to the domain prefix, if it exists
  if (parsedProxyUrl.searchParams.has('_x_tr_hp')) {
    domainPrefix = parsedProxyUrl.searchParams.get('_x_tr_hp') + domainPrefix;

  // 4. Remove '1-' prefix from the output of step 2 if encodingList contains
  //    '1' and the output begins with '1-'.
  if (encodingList.includes('1') && domainPrefix.startsWith('1-')) {
    domainPrefix = domainPrefix.substring(2);

  // 5. Remove '0-' prefix from the output of step 3 if encodingList contains
  //    '0' and the output begins with '0-'.
  //    Set isIdn to true if removed, false otherwise.
  let isIdn = false;
  if (encodingList.includes('0') && domainPrefix.startsWith('0-')) {
    isIdn = true;
    domainPrefix = domainPrefix.substring(2);

  // 6. Replace /\b-\b/ (regex) with '.' (dot) character.
  // 7. Replace '--' (double hyphen) with '-' (hyphen).
  let decodedSegment =
      domainPrefix.replaceAll(/\b-\b/g, '.').replaceAll('--', '-');

  // 8. If isIdn equals true, add the punycode prefix 'xn--'.
  if (isIdn) {
    decodedSegment = 'xn--' + decodedSegment;
  return decodedSegment;

Reconstruct the URL

  1. Using the original page URL, replace the hostname with the decoded hostname.
  2. Remove all _x_tr_* parameters.

Test your code

You can create unit tests for your code using the following table. Given a proxyUrl, the decodeHostname must match the expected value.

The following table can only be used to test the hostname decoding. You’ll need to ensure that the path, fragment, and original parameters of the URL are preserved as is.

proxyUrldecodeHostname (⚡?.com)
https://1-en--us-example-com/? (en-⚡?.com), (⚡-?.com) (?????‍♂️????????????????????.com)



Leave a comment

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir