The actual translateDirective() function is placed here due to a previous extension i made for Magento 1. In the Magento 1 extension it was here because the module class extended Mage_Widget_Model_Template_Filter for not losing the {{widget ...}} directive.