eCommerce PHP

How to translate a Magento theme in six easy steps

I’ve been pretty busy at work these last few weeks, but that doesn’t mean I have given up working on any of my learning projects. I’ve begun to translate a Magento theme. I was afraid at first, but translating a Magento theme is actually quite an easy process. It’s actually simpler than trying to make a WordPress theme multilingual using WPML.

Get Translation Files For Default Magento Interface

The first step is to go ahead and download the official Magento translation packages. Be sure to download the actual package and not the inline or string list. I won’t be using those translation methods in my guide.

Once that is done, decompress the file and upload the /app folder of your Magento store’s root directory. It’s easy-peasy.

magento translation root folder

Create Store Views For Every Language

how to translate magento theme configsNow that the Magento translation files have been uploaded on your serve, it’s time to create the various store views associated with each language.

First, navigate to System/Manage Stores which can be found easily by using the Magento backend’s header menu. From here, you’ll be able to create new store views as well as edit the names of the existing ones. I suggest you change the default store view’s name to English to keep your naming convention convenient.

Once, you’ve created the store the views. You will have to navigate to System/Configuration and ensure that you set the current configuration scope to your new language. Select the appropriate language from the locale dropdown on the General/General configuration page.


Why Your Theme Isn’t Fully Translated

After creating the store views and associating them with the appropriate locale file, you might notice that some text portions of your Magento theme have already been translated in the front end. This is because those particular strings use the same wording that is used in the default Magento theme. Yet, most good Magento theme developers will have modified the default text and added strings of their own. In addition, you’ll most likely have created a number of static blocks and pages that will need translating as well.

Don’t worry! You’re halfway through translating your Magento theme.

Depending on how many pages and static blocks you have, that might have been a lie. This is where actual Magento translation grunt work actually begins.

Translate All Static Blocks

Navigate to CMS/Static Blocks. Go through every single block that currently exists, and set their store view to your default language. In our case, it’s English.

translating english static block

Next, you’ll want to start creating blocks that will replace them in your translated Magento theme. You’re best bet is to come up with a naming convention that will make it easier when it comes to translating your pages. In my case, I tend to append a language code such as _en or _fr to all my static blocks.

translating french static block

Once that’s done, verify that you have not forgotten to translate the actual content of any of your newly created static blocks for your new store views. If you don’t translate them, you won’t end up with a fully multilingual Magento theme.

Translate All Pages

Repeat the same process that you have just done with the pages found in CMS/Page. The only difference is that you’ll have to keep an eye open for calls to your static blocks.

Whenever you see something similar to {{block type="cms/block" block_id="static_block_1" template="cms/content.phtml"}}, you’ll have to be sure to append the appropriate language code to the store view you have selected for the page.

Verify Store View Theme Configurations

how to translate magento theme configs

If you’re lucky, you’ll be able to skip this last step. Some Magento themes reference static blocks in the System/Config and you’ll need to ensure that each store view references the right CMS static block.

You’ll want to go through each part of the config and look for mentions of static blocks. Remember to select a store view as the current configuration scope.

In addition, you may also encounter a few options that require either custom HTML or text. You’ll have to change those as well to ensure that the last step runs smoothly.

You’ve almost successfully translated your Magento theme!

The last step may be the most tedious one, but over 80% of the translation job is now done.

Complete a Magento Translate.csv For Your Theme

Now that all the text that can be customized in the backend of your Magento theme has been translated, it’s time to fix all other text. Open up Excel, or whatever spreadsheet editor you prefer, and start jotting down all the text lines lines that still do not appear translated in your theme in the first column. In the next column, write the translation as it should appear on the new store view.

Save it as CSV and name it translate. Upload translate.csv to the appropriate language folder in your Magento theme’s locale folder. In some cases, you will have to create a folder. This is often found in a similar path to ../app/design/frontend/default/theme_name/locale/language_name.

Dealing With Variables

Remember that not all information displayed in your theme is 100% static. In some cases, the code used to display the text includes a variable. Usually, you can use %s to take the place of that variable in your translate.csv. If that doesn’t work, check the actually php code that is displaying the text and use the exact same variable that you see there.

Congrats! You are finished translating your Magento theme. If you know of easier ways or spotted a mistake feel free to call me names.

I also don’t mind hearing you complain about CSV and quotation mark problems too.

You Might Also Like

  • Dragos
    December 27, 2014 at 4:31 am

    Brilliant needed a guide like this, thanks

  • martin
    April 12, 2015 at 3:38 pm

    hello, Philip.

    I am trying to translate Magento theme, but got no luck so far.
    I can’t find official Magento translation package for my language and also that URL is not working (so would translate another language).

    I found two “locale” folders in my Magento theme, but there is so much files and I believe that those are also for CMS itself, so I don’t need to translate everything if I want to have only webpage in local language.

    Pls, is there way to figure out which csv files should I translate? Or is it enough if I translate everything only in CMS (there are four languages in my theme as default, so I just can translate/rewrite one of them). I’ve tried to copy one of those languages (folders on FTP to newly created one), but had no luck, website was broken when selected new language.

    Thank you very much for answer

  • Johny
    August 25, 2015 at 7:45 am

    Got any link for Serbian language.

  • trxpe
    July 28, 2016 at 12:21 am

    I think this site holds very great indited subject material blog posts.