Zend_Translate-Migration.xml 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="zend.translate.migration">
  4. <title>Migrating from previous versions</title>
  5. <para>
  6. The API of <classname>Zend_Translate</classname> has changed from time to time.
  7. If you started to use <classname>Zend_Translate</classname> and its subcomponents
  8. in earlier versions follow the guidelines below to migrate your scripts to
  9. use the new API.
  10. </para>
  11. <sect2 id="zend.translate.migration.fromonesixtooneseven">
  12. <title>Migrating from 1.6 to 1.7 or newer</title>
  13. <sect3 id="zend.translate.migration.fromonesixtooneseven.languages">
  14. <title>Setting languages</title>
  15. <para>
  16. When using automatic detection of languages, or setting languages manually
  17. to <classname>Zend_Translate</classname> you may have mentioned that from time to time a
  18. notice is thrown about not added or empty translations. In some previous
  19. release also an exception was raised in some cases.
  20. </para>
  21. <para>
  22. The reason is, that when a user requests a non existing language, you
  23. have no simple way to detect what's going wrong. So we added those
  24. notices which show up in your log and tell you that the user requested
  25. a language which you do not support. Note that the code, even when
  26. we trigger such an notice, keeps working without problems.
  27. </para>
  28. <para>
  29. But when you use a own error or exception handler, like xdebug, you
  30. will get all notices returned, even if this was not your intention.
  31. This is due to the fact that these handlers override all settings
  32. from within PHP.
  33. </para>
  34. <para>
  35. To get rid of these notices you can simply set the new option
  36. 'disableNotices' to true. It defaults to false.
  37. </para>
  38. <example id="zend.translate.migration.fromonesixtooneseven.example">
  39. <title>Setting languages without getting notices</title>
  40. <para>
  41. Let's assume that we have 'en' available and our user requests
  42. 'fr' which is not in our portfolio of translated languages.
  43. </para>
  44. <programlisting language="php"><![CDATA[
  45. $language = new Zend_Translate('gettext',
  46. '/path/to/translations',
  47. 'auto');
  48. ]]></programlisting>
  49. <para>
  50. In this case we will get an notice about a not available language 'fr'.
  51. Simply add the option and the notices will be disabled.
  52. </para>
  53. <programlisting language="php"><![CDATA[
  54. $language = new Zend_Translate('gettext',
  55. '/path/to/translations',
  56. 'auto',
  57. array('disableNotices' => true));
  58. ]]></programlisting>
  59. </example>
  60. </sect3>
  61. </sect2>
  62. </sect1>