Magento: tłumaczenie z innego języka w obecnym

Dodany: 18 listopada, 2016 | Kategoria: Magento

Załóżmy, że jesteśmy w angielskim sklepie, ale potrzebujemy wyświetlić jedno tłumacznenie z niemieckiego. Zamiast je kopiować albo hardcode-ować, wystarczy:

1
2
3
4
5
6
7
8
/* define */
$translate = new Mage_Core_Model_Translate();
$translate->setLocale(
    Mage::getStoreConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_LOCALE, $storeId)
)->init('frontend');
/* use */
echo $translate->translate(array('Text to translate'));
// optional %s arguments should be given as second and next arguments in array

To wszystko.

Brak komentarzy »

Leave a Reply

  • *