0

I need to change the text on an item in a 3rd party extension from "Apply" to "Redeem". Since Apply is used in other modules as well I want to make sure to only affect instance of "apply" in the module specifically.

In Magento 1 this could be done using the line below in the theme's translation file...

"Module_Name::Apply","Redeem"

I tried this in Magento 2 and it does not seem to work and I didn't see any mention of an alternative in the Magento Translate Docs. Is there a way to accomplish this in Magento 2?

2 Answers 2

3

You can use "Apply", "Redeem", module, Module_Name

Example in devdocs

"Add to Cart", "Add to Cart", module, Magento_Review

"Add to Cart", "Add to Shopping Cart", module, Magento_Catalog

3
  • This saved me ! Thx ! Oct 1, 2020 at 20:14
  • Are you sure this works? I could not get this to work. It always seems to translate with the last translation row on the language package's translation file.
    – Webninja
    May 3, 2021 at 15:39
  • Do not forget to execute below command. php bin/magento setup:static-content:deploy -f I spent a day to make above code working with the help of this command.
    – user98255
    Jan 5 at 8:15
1

This can be done by creating an independent language translation file inside your 3rd party extension (custom module).

First create i18n directory inside your custom module
Then create a language file and name it en_US.csv
Inside that language file put your translation

Apply, Redeem

Save it then run cache:flush

It should translate only the specific 'apply' from your custom module and will not affect any other module using the 'apply' instance

check if it works!

1
  • I am having the same issue. While this method works, since the extension is 3rd party, translations get deleted whenever the extension is updated. Aug 13, 2019 at 12:35

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.