Search code examples
phpzend-translate

Integrate Zend translator into my app


I wish to use the Translator classes of Zend framework in my app, but I don't want to include the whole framework. I grabbed the:

  • Locale folder
  • Translate folder
  • Exception.php
  • Loader.php
  • Locale.php
  • Registry.php
  • Translate.php

and copied into a custom folder named zend.translator. Obviously I had to edit all them to adjust the includes to the new path... Is this the way to go? I'm worried to have to edit all those files every time a new version is released.


Solution

  • You could use the Zend_Loader_Autoloader to include only the classes from Zend Framework that you actually use. So you wouldn't have to check all the dependencies yourself. Just put the complete Framework on your include_path and the Autoloader will take care of it.

    That way, you don't have to edit all the files. And autoloading can also give you a significant performance boost.