Change record status: 
Introduced in branch: 
8.x
Description: 

Introduced \Drupal\Core\StringTranslation\TranslationWrapper class to wrap translatable strings.

This class delays translating so that circular dependencies in info hooks and early use of annotations can be avoided. \Drupal\Core\Annotation\Translation::get() returns an instance of TranslationWrapper instead of a translated string.

This class is useful for using string translation in very low level subsystems like entity definition, stream wrappers, and annotations.

Drupal 7

 function locale_stream_wrappers() {
   $wrappers = array(
     'translations' => array(
      'name' => t('Translation files'),
       'class' => 'Drupal\locale\TranslationsStream',
      'description' => t('Translation files'),
       'type' => STREAM_WRAPPERS_LOCAL_HIDDEN,
     ),
   );

Drupal 8

 function locale_stream_wrappers() {
   $wrappers = array(
     'translations' => array(
      'name' => new TranslationWrapper('Translation files'),
       'class' => 'Drupal\locale\TranslationsStream',
      'description' => new TranslationWrapper('Translation files'),
       'type' => STREAM_WRAPPERS_LOCAL_HIDDEN,
     ),
   );
Impacts: 
Module developers