0

On my Magento website I have 2 buttons (javascript/ajax) that have the text

"Add to Cart" & "Go to Top"

These buttons are both in English, and since my website is in Dutch I tried to translate them. In the .CSV files I tried to edit them, but no effect was shown. This while all of my other translations through .CSV files went very well.

Then I tried using Magento's inline translation, but when hovering over the buttons, there is no booklet to click on in order to translate it.

It looks like the pieces of text are somewhere in some javascript file, but I can't seem to find it anywhere. Would anybody perhaps know where I can edit these two buttons text? Thanks!

  • In your theme's addtocart.phtm, please make sure this line is there as it is <?php $buttonTitle = $this->__('Add to Cart'); ?> – Nasir Perwaiz Apr 14 '15 at 11:55
  • 1
    Do a grep -R "Go to Top" . in your Magento installation and I'm sure you'll find where it is. From there you can translate it. – SR_Magento Apr 14 '15 at 12:05
2

It might be an issue with hardcoded lines but first try to find the strings in the corresponding phtml files.

You can use template hints under System > Configuration > Developer > Debug (set scope to the website) to see what phtml file the line is in. Then open up that file, probably under app/design/frontend/[package]/[template]/template/path/to/file.phtml and look for the line Add to Cart for example.

Check if it is inside something that looks like

<?php echo $this->('Add to Cart')?>

If so: go to the locale/nl_NL/translate.csv file under app/design/frontend/[package]/[template]/ or create it and add the line

"Add to Cart","Voeg toe aan winkelwagen"
"Go to Top","Ga naar boven"

If it's not wrapped in the above code you can do so yourself. This will tell Magento to translate it

  • I tried to add "Add to Cart","Voeg toe aan winkelwagen" to the csv file, but there is no result on the website. Is it possible that there is another way of translating, besides .csv files and inline translation? – Jennie Apr 14 '15 at 14:20
  • 1
    Nope, not really. Can you update your question with part of the phtml file that has the line in it? – Sander Mangel Apr 14 '15 at 14:22
0

By using below method you can translate with inline & csv as well.

<?php echo $this->__('Add to Cart');?>
If you are using above method then you can translated this with following way app/design/frontend/PackageName/ThemeName/locale/langauageCode/translate.csv in following way "Add to Cart","New Translated Text"

0

Open the Mage_Checkout.csv & edit the (Add to Cart) string

example: "Add to Cart","sourav cart kar product"

0

Turn on template hints to find out, in which templates the texts are translated. Then look into the template and find out which module is used for translation. It should be something like:

Mage::helper('checkout')->__('Add to cart')

In this example, the module is Mage_Checkout. If you find $this->__('Add to cart') instead, the module is derived from the block class (which again you can see in the template hints).

Now, add your translation to translate.csv of your theme, but specify the scope (i.e. the module) like this:

"Mage_Checkout::Add to cart","Voeg toe aan winkelwagen"

Explanation: Translations without a specified scope only work if the translation is not ambiguous, i.e. if it is not defined in several modules.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.