Ok what i want to do is use Zend Translate adapter only because i already have 5 language csv's in zend -understandable format. and i just want to:
echo $translate->_('word_to_translate'); //from zend adapter
from the view in the views/ folder i am using blade as main.blade.php and trying to call $translate which is defined as:
/*
* Zend_Translate
*/
define('APP_PATH', getenv('DOCUMENT_ROOT').'/members');
define('APP_LANG', APP_PATH . '/lang');
require_once 'Zend/Translate.php';
$translate = new Zend_Translate( array(
'adapter' => 'csv',
'content' => APP_LANG,
'scan' => Zend_Translate::LOCALE_DIRECTORY ) );
$translate->setLocale($locale);
$locale is defined earlier is the language
what i tried is to include and initiate everything statically from various locations but that didn't work. Maybe i need to create a facade i think but with the zend method inside and is getting difficult.
i read all documents about making a facade but what i didn't understand is if it has to be done with composer in mind so it can generate the autoloader classes, or i can do it mannually
As Zend Framework is modular, this is simple (assuming ZF1, for ZF2 you'll use Zend\ObjectName
instead because it uses namespaces):
include_path
in php.ini
.Create a Zend_Translate object like so:
$translator = new Zend_Translate( ...options... );
Translate text, like this:
echo $translator->_('Hello world');
Full documentation for Zend_Translate
can be found here.