我希望能够$this->__('String to translate')
在外部脚本中使用。我该怎么做呢?Magento 版本1.5.1.0
。
问问题
5578 次
2 回答
9
我认为设置语言环境的正确方法是:
Mage::getSingleton('core/translate')->setLocale('sv_SE')->init('frontend', true);
于 2011-12-06T12:03:30.297 回答
6
这应该有效:
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);
于 2011-08-25T10:49:07.097 回答