1

I have a translate.csv file in my theme app/design/frontend/{package}/{theme}/locale/en_GB/translate.csv, which is getting loaded and successfully translating various items on my site. For example I have:

"Maximum words count is %1$s. In your search query was cut next part: %2$s.","Maximum words count is %1$s. The following words were ignored: %2$s."`

Which works perfectly fine. However, it's my understanding that you should be able to prefix the text with the module name in order to only translate for that module. So I can't understand why the following doesn't work:

"Mage_CatalogSearch::Maximum words count is %1$s. In your search query was cut next part: %2$s.","Maximum words count is %1$s. The following words were ignored: %2$s."`

Obviously this is a derived example, the text in question only appears in one place on the site. But there are situations where we have things such as subscribe where it would be nice to translate differently in different places.

Am I mis-understanding it, or is there a bug?

1
  • I don't think this is possible in translate.csv, try it in your Module_Name.csv - but to be honest I dont know :) Nov 14, 2013 at 16:07

2 Answers 2

2

Normally this should work exactly as you expect it to. But in case that a module rewrites Mage_CatalogSearch_Helper_Data (where this string is translated), the module scope changes to the rewriting module, unless the $_moduleName property in the rewritten class is set explicitly to Mage_CatalogSearch (which you should to when rewriting helpers).

The same goes for block rewrites where $this->__() is used in templates.

1

Usually it should work if you put the module name in front of the text.

However, if the translation was done using the inline translation tool, it is saved in your database (translation table). The translations of the database are loaded in the end, so they overwrite everything else.

So double-check that in your case, your string is not in the database.

Your Answer

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

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