简体   繁体   中英

Zend_translate class not found

I simply want to start using the Zend_translate

  $translate = new Zend_Translate('array',array(),'en_EN');

$fi = array(
    'Hello World' => 'Hei Maailma'
);

$translate->addTranslation($fi,'fi_FI');
$translate->setLocale('fi_FI');
echo $translate->_('Hello World');

on this I get `Class 'Zend_Translate' not found

Of course I need to install something first...BUT there is nowhere said what I should set and how to install. The Zend documentation does not say how to install these stuff and I could not find it on internet, please help

Nope - it's not bundled. Also - the tutorial or sample code you have is not using ZF3, but ZF1. You can already tell from the underscore class name (Zend_Translate).

In ZF3 you have to install the modules:

composer require zendframework/zend-i18n and optionally (if you use the MVC compoments) composer require zendframework/zend-mvc-i18n

The 2 tutorials / docs relevant for i18n can be found here

https://docs.zendframework.com/tutorials/i18n/

https://docs.zendframework.com/zend-i18n/translation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM