Translatable plugin metadata

When providing plugin annotation, properties whose values are displayed in the user interface should be made translatable. Much the same as how user interface text elsewhere is wrapped in t() to make it translatable, in plugin annotation, wrap translatable strings in the @ Translation() annotation. For example:

  title = @ Translation("Title of the plugin"),

Remove spaces after @ in your actual plugin - these are put into this sample code so that it is not recognized as annotation.

You will also need to make sure that your class file includes the line:

  use Drupal\Core\Annotation\Translation;


drupal/core/lib/Drupal/Core/Annotation/Translation.php, line 12
Definition of Drupal\Core\Annotation\Translation.


Namesort descending Location Description
Translation drupal/core/lib/Drupal/Core/Annotation/Translation.php Defines a translatable annotation object.