Certificated magento

Q.1.18)How are translation conflicts (when two modules translate the same string) processed by Magento?

What to check if your translation isn't working
 
If your translation from a translate.csv file isn't being used, follow this checklist:
 
Is the translation cache turned off/refreshed? (Solution: clear the cache)
Is the translate.csv file really in the theme fallback for the current store? (Solution: fix theme configuration)
Is there a conflicting record for the translation in the core_translate table? (Solution: remove the conflicting record from core_translate)
If all the previous points aren't the cause, there must be a conflicting translation from a different module. (Solution: see below)
 
Solution for Module Scope Translation conflicts
 
If you find the final case is true, simply add the translation a second time to your translate.csv with the module scope of the module doing the translation.
 
Use translation like this for each case:
 
<?php Mage::helper('sales')->__('text here')?>
 
In the example, if you always wanted AAA to be translated as DDDvia the theme translation, you could do this in your translate.csv:
 
"AAA","DDD"
"Mage_Catalog::AAA","DDD"
"Some_Module::AAA","DDD"
 
 
In practice, I only add the module scope to the translation if there is a conflict, that is, if a translation isn't working.
 
Additional Notes
 
Inline Translation
 
The inline translation feature of Magento also adds the custom translations to the core_translate table using the module scope prefix.
 
Backward Compatibility
 
The priority of the theme translations used to be higher then the database translations up to Magento version 1.3 or so.
 
XML Translation
 
Magento sometimes evaluate translate=""arguments in config.xml, system.xml and layout XML to translate child node values.
A helper class can be specified in those cases using the module="" argument to specify the module for the translation scope.
If no module argument is specified in the XML, the core/data helper is used to translate the child node values.
 
Further Information
 
I confess I glossed over some details of the Magento translation process in this post, but only because I don't want to too much information.
 
Some technical details while the translation array is built
The possibility to use additional translation files for modules
Store view scope for core_translate records
Pros and cons using the different methods of translation
Please ask a separate question if more information is required.
 

0 Bình luận

Trở về
  • 1.12) Set up a cron job
  • 1.12) Set up a cron job

    Let’s start with server setup.   As any complex system, Magento has a lot of tasks that need to be executed...