Content MarketingEcommerce and RetailMarketing Tools

GTranslate: A Simple WordPress Translation Plugin Using Google Translate

In the past, I’ve hesitated to use machine translations of my site. I’d love to have translators all over the planet to assist in translating my site for different audiences, but there’s no way I would recoup those costs.

That said, I do notice that my site content is shared internationally quite a bit – and many people are using Google Translate to read my content in their native language. That makes me optimistic that the translation may be good enough now that Google continues to improve using machine learning and artificial intelligence.

With that in mind, I wanted to add a plugin that offered translation using Google Translate, but I wanted something more comprehensive than a dropdown that translated the site. I want search engines to actually see and index my content internationally, which requires a couple of features:

  • Metadata – when search engines crawl my site, I want hreflang tags in my header to provide search engines with the different URL paths for each language.
  • URL – within WordPress, I want the permalinks to incorporate the translation language in the path.

My hope, of course, is that it will open my site up to a much wider audience, and there’s a great return on investment as I can increase my affiliate and advertising revenue – without requiring the effort of manual translation.

GTranslate WordPress Plugin

The GTranslate plugin and accompanying service incorporate all these features as well as many other options:

  • Dashboard – A comprehensive service dashboard for configuration and reporting.
gtranslate dashboard
  • Machine Translation – Instantaneous Google and Bing automated translation.
  • Search Engine Indexing – Search engines will index your translated pages. As a result, people can find a product you sell by searching in their native language.
  • Search Engine Friendly URLs – Have a separate URL or Subdomain for each language—for example
  • URL Translation – The URLs of your website can be translated, which is very important for multilingual SEO. You will be able to modify the translated URLs. You can use the GTranslate platform to identify the translated URL.
  • Translation Editing – Edit the translations manually with GTranslate’s inline editor directly from the context. This is necessary for some things… for example, I wouldn’t want my company name, DK New Media, translated.
  • In-line Editing – You can also utilize syntax within your article to replace links or images based on a language.
<a href="" data-gt-href-fr="">Example</a>

The syntax is similar for an image:

<img src="original.jpg" data-gt-src-ru="russian.jpg" data-gt-src-es="spanish.jpg" />

And if you don’t want a section translated, you can add a class of notranslate.

<span class="notranslate">Do not translate this!</span>
  • Usage Statistics – You can see your translation traffic and the number of translations on your dashboard.
GTranslate Language Analytics
  • Subdomains – You can opt into having a subdomain for each language. I chose this rather than the URL path because it was less taxing on my webserver. The subdomain method is incredibly fast and just points directly to Gtranslate’s cached, translated page.
  • Domain – You can have a separate domain for each language. For example, if you use a .fr top-level domain (tld), your site may rank higher in search engine results in France.
  • Collaborators – If you’d like individuals to assist with manual translation, they can have access to GTranslate and add manual edits.
  • Edit History – View and edit your history of manual edits.
GTranslate Edit History
  • Seamless Updates – There is no need to check for software updates and install them. We care about further updates. You enjoy the up-to-date service every day
  • Languages – Afrikaans, Albanian, Amharic, Arabic, Armenian, Azerbaijani, Basque, Belarusian, Bengali, Bosnian, Bulgarian, Catalan, Cebuano, Chichewa, Chinese (Simplified), Chinese (Traditional), Corsican, Croatian, Czech, Danish, Dutch, English, Esperanto, Estonian, Filipino, Finnish, French, Frisian, Galician, Georgian, German, Greek, Gujarati, Haitian, Hausa, Hawaiian, Hebrew, Hindi, Hmong, Hungarian, Icelandic, Igbo, Indonesian, Irish, Italian, Japanese, Javanese, Kannada, Kazakh, Khmer, Korean, Kurdish, Kyrgyz, Lao, Latin, Latvian, Lithuanian, Luxembourgish, Macedonian, Malagasy, Malayalam, Malay, Maltese, Maori, Marathi, Mongolian, Myanmar (Burmese), Nepali, Norwegian, Pashto, Persian, Polish, Portuguese, Punjabi, Romanian, Russian, Serbian, Shona, Sesotho, Sindhi, Sinhala, Slovak, Slovenian, Samoan, Scots Gaelic, Somali, Spanish, Sundanese, Swahili, Swedish, Tajik, Tamil, Telugu, Thai, Turkish, Ukrainian, Urdu, Uzbek, Vietnamese, Welsh, Xhosa, Yiddish, Yoruba, Zulu

Sign Up for a GTranslate 15-Day Trial

GTranslate and Header Permissions

If you’ve opted to configure GTranslate using subdomains, you may have an issue where assets like fonts on your site aren’t loading correctly. To correct this, you’ll need a plugin where you can update your HTTP Headers to enable Allow-Control-Allow-Origin to share the resources across

// Add a policy for allowing assets to each of the subdomains.
function add_cors_http_header() {
    $allowed_subdomains = array(
        "en", "af", "sq", "am", "ar", "hy", "az", "eu", "be", "bn", "bs", "bg", "ca", "ny", "zh-CN", "zh-TW", "co", "hr", "cs", "da", "nl", "eo", "et", "tl", "fi", "fr", "fy", "gl", "ka", "de", "el", "gu", "ht", "ha", "he", "hi", "hu", "is", "ig", "id", "ga", "it", "ja", "jv", "kn", "kk", "km", "ko", "ku", "ky", "lo", "la", "lv", "lt", "lb", "mk", "mg", "ml", "ms", "mt", "mi", "mr", "mn", "my", "ne", "no", "ps", "fa", "pl", "pt", "pa", "ro", "ru", "sr", "sn", "st", "sd", "si", "sk", "sl", "sm", "gd", "so", "es", "su", "sw", "sv", "tg", "ta", "te", "th", "tr", "uk", "ur", "uz", "vi", "cy", "xh", "yi", "yo", "zu"

    $allowed_origins = array_map(function ($subdomain) {
        return "https://$";
    }, $allowed_subdomains);

    // Construct the CORS header with the allowed subdomains
    $allowed_origins_string = implode(' ', $allowed_origins);
    header("Access-Control-Allow-Origin: " . $allowed_origins_string);
    header("Access-Control-Allow-Methods: GET");
    header("Cache-Control: max-age=604800, public"); // One-week caching
    $expires = gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'; // One-week expiration
    header("Expires: $expires");
    header("Vary: Accept-Encoding");
add_action('init', 'add_cors_http_header');

Douglas Karr

Douglas Karr is the founder of the Martech Zone and CEO of DK New Media. Douglas has helped dozens of successful MarTech startups, has assisted in the due diligence of over $5 bil in Martech acquisitions and investments, and continues to assist companies in implementing and automating their sales and marketing strategies. Douglas is an internationally recognized digital transformation and MarTech expert and speaker. Douglas is also a published author of a Dummie's guide and a business leadership book.

Related Articles


Adblock Detected

Martech Zone is able to provide you this content at no cost because we monetize our site through ad revenue, affiliate links, and sponsorships. We would appreciate if you would remove your ad blocker as you view our site.