Yireo - Extensions, tutorials and blog for Magento and Joomla!

Blog Tags

MageBridge Standard

Translating the quotes in Magento

Sunday, 27 June 2010

It's a simple trick, but somebody has to tell you. Within Magento, you can translate any text (or override any original English text) by including a file translate.csv in your Magento theming folder. Within this folder, a CSV-format is used to define the English original on the left and your translation on the right. But how about double quotes?

The translation file

Within the Magento theming directory, you can add your own translation-file easily. Just create a subfolder locale in your theme-folder and add a folder named after the locale (language). In this example we'll use en_US, which will override the default English language. Within that folder there is a file translate.csv holding all your changes.

app/design/frontend/default/mytheme/locale/en_US/translate.csv

Now within that file, a CSV-format is used: The original value on the left is separated with a comma from the translated value on the right. It might look this:

"Ship to this address","Use my shipping address"

Meet the double quotes

Notice that in the example above, both strings are surrounded by double quotes. Both what happens when the string itself has quotes in it. This is for instance the case when the Magento shopping cart is visited, while it contains no items.

The solution is simple: Just use 2 double quotes instead of 1. The translation-line would look like the following:

"Click <a href="/"%s"">here</a> to continue shopping.", "Click <a href="/"%s"">here</a> to go back."

Hope this helps people out.

About Yireo

Yireo tries to help webdevelopers build successful Joomla! and Magento sites.

More about Yireo