Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Showing with 28 additions and 7 deletions.
  1. +28 −0 docs/en/changelogs/3.0.0.md
  2. +0 −7 i18n/i18n.php
View
28 docs/en/changelogs/3.0.0.md
@@ -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
7 i18n/i18n.php
@@ -1501,13 +1501,6 @@ static function get_translators() {
'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');
}
Please sign in to comment.
Something went wrong with that request. Please try again.