magento translate text inside cms page or static block without touching the core

For Translate Static block content
you can use following directive in cms page or static block

1
{ {translate words="translate me"}}

 

you are not finishing :
For complete the work without touching the core by override the class Filter.php:

A – Create file Filter.php in this path app/code/local/Mage/Core/Model/Email/Template/ (create all required folder)
B – go app/code/core/Mage/Core/Model/Email/Template/ and open Filter.php file and copy content
C – paste inside app/code/local/Mage/Core/Model/Email/Template/Filter.php
D – open app/code/local/Mage/Core/Model/Email/Template/Filter.php and add following function

1
2
3
4
5
6
public function translateDirective($construction)
{
$params = $this->_getIncludeParameters($construction[2]);
$words = $params['words'];
return Mage::helper('page')->__($words);
}

 

is done !

坚持原创技术分享,您的支持将鼓励我继续创作!