Zend Framework: translatable content within the model

I have a model in my application that takes care of creating the original database structure (like the installer). I recently added translatable content (uses gettext). I would like to make the original content language dependent.

What is the best way to use translated content within the model? Is there a way to use the function view->translate()inside the model or do I need to pass already translated lines from the outside, for example. how parameter?

+3
source share
1 answer

, Zend_Locale Zend_Translate, Zend_Registry ( "Zend_Locale" "Zend_Translate" ), translate() :

    /*@var $translator Zend_Translate */
    $translator = Zend_Registry::get('Zend_Translate');

    /*@var $adapter Zend_Translate_Adapter */
    $adapter = $translator->getAdapter();

    var_dump($adapter->translate('Text to be translated'));

Zend_Locale.

? . "" "" , __get __set Zend_DB_Table_Row translate().

+15

Source: https://habr.com/ru/post/1789444/


All Articles