Using Yireo GoogleTranslate for Magento

The Yireo GoogleTranslate module allows you to easily implement Google Translate into Magento, without coding and without core-hacks. Instead of adding the translation every time at the frontend, this module allows you to store the translation in your backend. This tutorial shows you what you should do to implement Yireo GoogleTranslate into your site.

Get a Google Translate API-key

Google Translate is an online service offered by Google, and it can be used on any site - with the requirement to apply for an API key. Within the Google APIs Console of your Google account you can activate an API version 2 key for multiple services, including Google Translate. The steps to follow are:

  1. Under the Services tab, enable the Translate API. Take note of the courtesy limit. If it is zero, you also need to setup billing under the Billing tab.
  2. Under the API Access tab, navigate to the section Simple API Access. Create either a new Server-key (restricted by IP) or a new Browser-key (restricted by referer). Make sure to configure the restrictions properly: The IP should be the IP of your Magento webserver. The referer should be your Magento root-URL. Write down the generated API-key before continuing.

Get the Yireo GoogleTranslate module

The Yireo GoogleTranslate module is for sale on our site. Once purchased, you can download the latest version of this extension at any time by navigating to your Yireo Account. The extension is only available in the form of a ZIP-file, and is not available through MagentoConnect.

Installing the Yireo GoogleTranslate module

Download the ZIP-file to your computer, extract all files and upload those files to the Magento root-folder using FTP or SSH. The ZIP-file contains the following folders which correspond with existing folders in Magento:

  • app/etc/modules
  • app/code/community
  • app/design/adminhtml/base/default/layout
  • app/design/adminhtml/base/default/templates

This extension does not modify your Magento frontend.

Refresh Magento caching

After uploading these files and folders to Magento, refresh the Magento cache. You can either do this from the Magento backend (System > Cache Management). Or you could also remove the entire var/cache folder through FTP or SSH to remove the cache manually.

Don't forget to configure your locales

When setting up Magento for usage with multiple languages, part of that setup is to create Store Views per language. Do not forget to configure the System Configuration so that that specific Store View has the right locale set. For instance, if you create a Store View with a name Italian, there's nothing in Magento that guarantees that an Italian translation should actually be made for that specific Store View. Within the System Configuration, change the scope in the top left to the Store View named Italian. Next, under General > Locale Options change the Locale to Italian (Italy).

Warning on translating attributes

Make sure to take note that every product attribute is assigned to a specific scope. For instance, a color attribute can be assigned to the Store View scope. This means that you can manage the color value of a product on the global level, but also override this value on the Store View level. However, take for instance the sku attribute, which is assigned to the Global scope. This makes it impossible to override this value in the Store View level. While editing a product, you might be able to switch to the Store View level and modify the SKU. However the [GLOBAL] right from the input, indicates that you will be modifying the attribute globally, across all scopes, across all Store Views.

This mentioning of how attributes work with scopes is not related to our extension but to Magento itself. If this is new to you, you might be missing out on more important hints about the Magento architecture. Make sure to take the time to go through the official Magento documentation.

Configuring the GoogleTranslate settings

Next, login to the Magento Admin Panel and browse to System > Configuration. Select the right scope (Store or Store View) to configure. Then navigate to Catalog > Catalog > Google Translate. If this menu-option is not available, logout from the Magento Admin Panel and log back in again.

Within the configuration panel, you will need to configure the API Key as generated on the official Google Translate website. As soon as you have entered a correct API-key, Google Translate will be enabled in your backend.

Note with latest versions of our GoogleTranslate extension, you can configure 2 API-keys - either version 1 or version 2. You need to enter only one API key, not two.


Detecting the language

The Magento extension detects automatically the right languages: The language of the parent scope (the original text), and of the current scope (the translation). It also tries to detect whether the current text (in the current language) is already translated or not.

Original text (English)


Translated text (German)


Changing the button format

You can change the format of the button label, making it easier to understand what the module is doing. For instance, to see both the source language as well as the destination language, you can enter the following format:

Translate from $FROM to $TO

This will print for instance:

Translate from English to French

Why is the button greyed out?

A translation is always based on a source language and a destination language. The translate-button will be greyed out automatically when the locale / language of the current scope (either Global, Website or Store View) is matching the original scope.

  • When you enter the Products overview in the Magento backend, the scope is set to Global. The scope-selection is set to Default values. Because there is point in translating the default language to the default language, the buttons are greyed out.
  • When you change the scope to a Store View called English, which has the US/English locale configured for it, but when the US/English locale is also the default locale, again the same applies: It makes no sense to translate English to English.
  • When you change the scope to a Store View called French, which has the French locale configured for it, while the default locale is English, then a translation is possible: The button will be usable, because the text can be translated from English to French.

Batch processing of products

Within the Manage Products overview of Magento you will find that the Actions dropdown in the upper right, now also contains an option Translate via GoogleTranslate. Once you select products in the grid, you can use this batch action, which will bring you to a separate confirmation page. This confirmation page will confirm to you the batch translation of products.

Note that to use the batch processing properly, you also have to configure the extension options in the System Configuration: You will need to configure which product attributes and which Store Views will be used for batch processing.

Scripted usage of GoogleTranslate

By using the Magento code-API you can also apply GoogleTranslate for automated translations. The following PHP-script gives a simple of this:

$text = 'Hello World';
$source = 'en';
$destination = 'fr';
require_once '../app/Mage.php';
$translator = Mage::getSingleton('googletranslate/translator');
$translation = $translator->translate($text, $source, $destination);
if(!empty($translation)) {
    echo $translation."\n";
} else {
    echo $translator->getApiError()."\n";


We advise you to be very careful with this. It sounds cool to automatically translate text like this, but - as the Google Translation API is not free - costs might rise quickly.