Get Free Audit

Editing Magento Translate.csv File

May 21, 2013

5718 Andrey Litvin

Editing Magento Translate.csv File

If you read my article about Internationalization in Magento, you should know that there is a way to edit translation CSVs using one file – translate.csv. In order to do that, you just need to set locale via Magento admin area, then create translate.csv in app/design/frontend/<package>/<theme>/locale/languagecode_COUNTRYCODE and put your translated strings inside this translate.csv file.

Here are some tips and tricks:

1. All strings should start and end with double quotes and should be separated with comma (,), not a semicolon or any other sign


 

2. It can be very handy to alternate the default theme strings with the help of app/design/frontend/<package>/<theme>/locale/en_US/translate.csv file

For example:


Magento store.belvg.com

Magento Extensions

Take your online store to the next level with BelVG Magento Extensions

Visit the store

3. All the lines are case-sensitive and the first message must be copied exactly as it appears in the default en_US version.

For example, if in en_US locale the string looks like that


But in your translate.csv you would try

Andrey_Dubina
Partner With Us Let's discuss how to grow your business. Get a Free Quote.
Talk to Andrey


It simply wouldn’t work, so be careful with that.

 

4. Some strings can contain %1$s %s %d etc., and if you want to have the correct strings in your translations these entries should be also kept in the translated string


 

5. Your text editor should be able to save an edited CSV file in UTF-8 encoding (), especially when you translate using different alphabets. If you have your translations in Excel, you need to convert your file to UTF-8 (find more info on how to convert Excel to CSV with UTF-8 encoding StackOverflow).

 

6. If you need to have double quotes in your string they need to be escaped by using two double quotes


 

7. There are some strings that can be presented in a few extensions simultaneously. For example, in “Add To Cart” strings can be found in both Mage_Catalog.csv and Mage_Checkout.csv. What if you would like to translate/change them differently? Normal way would be to edit .phtml files manually, but with translate.csv you can solve this issue more elegantly – just put your extension name as a prefix and you will be able to translate them separately.


 

8. Last but not least – remember to refresh all caches after any changes of your translate.csv file!

magento development services

Magento Development Services

Take your online store to the next level with BelVG Magento development

Visit the page
Andrey Dubina
Partner With Us Looking for a partner to grow your business? We are the right company to bring your webstore to success. Talk to Andrey

6 Comments

  1. @Flavia, both phrases are stored in Mage_Newsletter.csv locale file.
    You can create same file under app/locale/pt_PT/Mage_Newsletter.csv (I hope it’s Portuguese :-) and add your translations in the second column.

  2. Olá tudo bem?

    Estou tentando traduzir essa linah e não consigo, como posso fazer por favor?

    <input type="text" name="email" id="newsletter" title="__(‘Sign up for our newsletter’) ?>” class=”input-text required-entry validate-email” placeholder=”Enter your email address …” />

    “Enter your email address …” para português

    Já tentei d etdo até peguei o ‘Sign up for our newsletter’ e coloquei assim

    “‘Sign up for our newsletter'”, “Insira seu e-mail”

    Muito obrigada
    abraços
    Flavia

Post a new comment

BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *