Skip to content
This repository
Browse code

MINOR Removed i18nSSLegacyTranslator from default setup for performan…

…ce reasons, document how to re-apply it
  • Loading branch information...
commit 03de6e5e5f6dd6534d0c4046415a5bf66144d50b 1 parent 652f0ec
Ingo Schommer authored December 04, 2011
28  docs/en/changelogs/3.0.0.md
Source Rendered
@@ -365,6 +365,34 @@ placeholder and the `PageComment` class. See the ['comments' module](https://git
365 365
 The setting determines difference homepages at arbitrary locations in the page tree,
366 366
 and was rarely used in practice - so we moved it to a "[homepagefordomain](https://github.com/silverstripe-labs/silverstripe-homepagefordomain)" module.
367 367
 	
  368
+### Default translation source in YML instead of PHP $lang array, using Zend_Translate ###
  369
+
  370
+This allows for a more flexible handling of translation sources in various formats.
  371
+Your own translations can be converted automatically via the ["i18n_yml_converter" module](https://github.com/chillu/i18n_yml_converter). Any modifications
  372
+to the `$lang` global variable need to be re-applied via YML, or directly to the new translation adapters.
  373
+
  374
+	:::php
  375
+	i18n::get_translator('core')->getAdapater()->addTranslation(array(
  376
+		'content' => array('My.Entity' => 'My Translation'),
  377
+		'locale' => 'en_US',
  378
+		'usetranslateadapter' => true
  379
+	));
  380
+
  381
+In order to keep backwards compatibility for PHP-based translations
  382
+(from modules or your own code) without conversion, please add the following to your `_config.php`.
  383
+Note that its just necessary if SilverStripe is used in a language other than the default (`en_US`).
  384
+
  385
+	:::php
  386
+	i18n::register_translator(
  387
+		new Zend_Translate(array(
  388
+			'adapter' => 'i18nSSLegacyAdapter',
  389
+			'locale' => i18n::default_locale(),
  390
+			'disableNotices' => true,
  391
+		)),
  392
+		'legacy',
  393
+		9 // priority lower than standard translator
  394
+	);
  395
+	
368 396
 ### Removed "auto-merging" of member records from `Member->onBeforeWrite()`
369 397
 
370 398
 Due to security reasons. Please use `DataObject->merge()` explicitly if this is desired behaviour.
7  i18n/i18n.php
@@ -1501,13 +1501,6 @@ static function get_translators() {
1501 1501
 					'disableNotices' => true,
1502 1502
 				))
1503 1503
 			);
1504  
-			self::$translators[$defaultPriority-1] = array(
1505  
-				'legacy' => new Zend_Translate(array(
1506  
-					'adapter' => 'i18nSSLegacyAdapter',
1507  
-					'locale' => self::$default_locale,
1508  
-					'disableNotices' => true,
1509  
-				))
1510  
-			);
1511 1504
 			
1512 1505
 			i18n::include_by_locale('en_US');
1513 1506
 		}

0 notes on commit 03de6e5

Please sign in to comment.
Something went wrong with that request. Please try again.