Want to use Zend_translate outside of Zend?

im creating a website with multilingual features. and I have search and search zend_translate is the best way to translate text. but I started my site with simple php (without a framework) and executed a lot of modules. but now I want to use a translator on my website that translates PHP texts and the text comes from the database (mysql)

I can use gettext (), but I do not have permission to install gettext () on my real server, so I choose zend_translate. so anyone can help me use zend_translate using the zend environment and without copying all the zend library files. or give me another way.

Thank.

+5
source share
1

Zend_Translate, , Zend_Translate, Zend_Exception, Zend_Registry ( ), Zend_Cache ( ), .

, , Zend_Translate

$translator = new Zend_Translate(array(
    'adapter' => 'gettext',
    'content' => '/my/path/source-de.mo',
    'locale'  => 'de'
));

-

echo $translator->_('Welcome back'), ' ', $username;

, :

$translator->addTranslation(
array(
    'content' => '/path/to/translation/fr-source.mo',
    'locale'  => 'fr'
));

:

$translator->setLocale('fr');
echo $translator->_('Welcome back'), ' ', $username;

. http://framework.zend.com/manual/en/zend.translate.html !

+1

All Articles