Search code examples
magentotranslationmagento-1.5

Magento translations in external script


I want to be able to use $this->__('String to translate') in an external script. How do I do this? Magento version 1.5.1.0.


Solution

  • This should work:

    require 'app/Mage.php'; // here you should use the correct path to Mage.php file
    
    Mage::app();
    Mage::getSingleton('core/translate')->init('sv_SE', true); // UPDATE
    $to_translate = "String to translate";
    $translated = Mage::helper('core')->__($to_translate);