2

I tried to translate with the translate.csv file, but in this case it doesn't work.

I also tried to find the file in "checkout" folder (every file in the folder) but it doesn't contain the word "Discount".

Any suggestion how this can be done?

6 Answers 6

1

The following flow chart shows how Magento combines the translations from different sources:

Translation precedence Source: http://magehero.com/posts/655/new-post-translationhints-0-2-published-bonus-translation-precedence-explained

If translating "Discount" doesn't work in translate.csv, it means that several modules define "Discount" and these module specific translations have precedence over the global definition from the theme.

However, you also can overwrite module specific translations in translate.csv with the syntax "Namespace_Module::Original","Translated"

In your case, if you search for "Discount" in app/locale, you will find that it's translated in Mage_Paypal, Mage_Rss and Mage_Sales. If you want to translate it in everywhere, use:

"Mage_Paypal::Discount","..."
"Mage_Rss::Discount","..."
"Mage_Sales::Discount","..."
"Mage_Rss::Discount (%s)","... (%s)"
"Mage_Sales::Discount (%s)","... (%s)"
2
  • Half of your examples use one colon and the others use two, I assume you meant to use :: on all?
    – Justin
    Commented Aug 12, 2015 at 19:57
  • Yes, thanks for pointing it out, I corrected the code Commented Aug 12, 2015 at 20:17
2

You can use Fabian's extension to find out where the text comes from: https://github.com/schmengler/TranslationHints

Installing and enabling it shows you where the source of a translation is. Depending on the information from the module, you can then decide where to put your translation.

1

I'm not sure where exactly is this but we can try these 2 ways:

  1. Directly in the translation files - search in app/locale/en_US/Mage_Checkout.csv and app/locale/en_US/Mage_Sales.csv.
  2. Activate inline translate in the admin panel -> System -> Configuration -> ADVANCED -> Developer -> Translate Inline -> Enabled for Frontend : Yes (don't forget to add your IP in Developer Client Restrictions -> Allowed IPs).
3
  • Please do not edit the core files for the translation as mentioned in 1. This is not update-safe. Commented Feb 23, 2015 at 19:53
  • Yes, of course it's better to use inline translate or translate.csv but 1. can be used for test purpose to see if he is doing something wrong with translate.csv or the problem is somewhere else.
    – michael
    Commented Feb 23, 2015 at 20:03
  • I agree for testing purposes but not as a permanent solution. Commented Feb 23, 2015 at 20:53
1

I am supposing you are talking about the totals when checking out where it says "Discount" in the totals? If so, that is in app/code/core/Mage/Sales/Block/Order/Totals.php.

However, the proper way to change this would be to edit the language file You can either use the translate.csv, or if that isn't working try editing this:

app/locale/en_US/Mage_Checkout.csv

and add the following two lines to the bottom:

"Discount (%s)","Your Text (%s)"

"Discount","Your Text"

That will override the text for your.

1
  • Actually, the proper way is translate.csv and not editing core files. If the translation comes from Mage_Checkout.csv, it's always possible to translate with "Mage_Checkout::Discount","Your Text". Commented Feb 23, 2015 at 21:43
1

To translate this specif part of text it should be used the following code in your translate.csv file:

"Mage_Sales::Discount (%s)","... (%s)"

as suggested by mr. #fschmengler

Thanks for all your help end effort.

0

In Magento 2, for the Cart page you find it as:

"Discount (%1)","<whatever your translation>"

So (%1) is the extra parameter needed.

Hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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