MINOR Removed i18nSSLegacyTranslator from default setup for performance reasons, document how to re-apply it

This commit is contained in:
Ingo Schommer 2011-12-04 21:28:03 +01:00
parent 652f0ec007
commit 03de6e5e5f
2 changed files with 28 additions and 7 deletions

View File

@ -365,6 +365,34 @@ placeholder and the `PageComment` class. See the ['comments' module](https://git
The setting determines difference homepages at arbitrary locations in the page tree,
and was rarely used in practice - so we moved it to a "[homepagefordomain](https://github.com/silverstripe-labs/silverstripe-homepagefordomain)" module.
### Default translation source in YML instead of PHP $lang array, using Zend_Translate ###
This allows for a more flexible handling of translation sources in various formats.
Your own translations can be converted automatically via the ["i18n_yml_converter" module](https://github.com/chillu/i18n_yml_converter). Any modifications
to the `$lang` global variable need to be re-applied via YML, or directly to the new translation adapters.
:::php
i18n::get_translator('core')->getAdapater()->addTranslation(array(
'content' => array('My.Entity' => 'My Translation'),
'locale' => 'en_US',
'usetranslateadapter' => true
));
In order to keep backwards compatibility for PHP-based translations
(from modules or your own code) without conversion, please add the following to your `_config.php`.
Note that its just necessary if SilverStripe is used in a language other than the default (`en_US`).
:::php
i18n::register_translator(
new Zend_Translate(array(
'adapter' => 'i18nSSLegacyAdapter',
'locale' => i18n::default_locale(),
'disableNotices' => true,
)),
'legacy',
9 // priority lower than standard translator
);
### Removed "auto-merging" of member records from `Member->onBeforeWrite()`
Due to security reasons. Please use `DataObject->merge()` explicitly if this is desired behaviour.

View File

@ -1501,13 +1501,6 @@ class i18n extends Object implements TemplateGlobalProvider {
'disableNotices' => true,
))
);
self::$translators[$defaultPriority-1] = array(
'legacy' => new Zend_Translate(array(
'adapter' => 'i18nSSLegacyAdapter',
'locale' => self::$default_locale,
'disableNotices' => true,
))
);
i18n::include_by_locale('en_US');
}