ITEEDU

56.4. Migrating from previous versions

The API of Zend_Translate has changed from time to time. If you started to use Zend_Translate and its subcomponents in earlier versions follow the guidelines below to migrate your scripts to use the new API.

56.4.1. Migrating from 1.6 to 1.7 or newer

56.4.1.1. Setting languages

When using automatic detection of languages, or setting languages manually to Zend_Translate you may have mentioned that from time to time a notice is thrown about not added or empty translations. In some previous release also an exception was raised in some cases.

The reason is, that when a user requests a non existing language, you have no simple way to detect what's going wrong. So we added those notices which show up in your log and tell you that the user requested a language which you do not support. Note that the code, even when we trigger such an notice, keeps working without problems.

But when you use a own error or exception handler, like xdebug, you will get all notices returned, even if this was not your intention. This is due to the fact that these handlers override all settings from within PHP.

To get rid of these notices you can simply set the new option 'disableNotices' to true. It defaults to false.

例 56.17. Setting languages without getting notices

Let's assume that we have 'en' available and our user requests 'fr' which is not in our portfolio of translated languages.

$language = new Zend_Translate('gettext',
                               '/path/to/translations',
                               'auto');

In this case we will get an notice about a not available language 'fr'. Simply add the option and the notices will be disabled.

$language = new Zend_Translate('gettext',
                               '/path/to/translations',
                               'auto',
                               array('disableNotices' => true));