diff --git a/core/lib/Drupal/Core/Annotation/Translation.php b/core/lib/Drupal/Core/Annotation/Translation.php index 0d6acd1..9af350e 100644 --- a/core/lib/Drupal/Core/Annotation/Translation.php +++ b/core/lib/Drupal/Core/Annotation/Translation.php @@ -10,6 +10,28 @@ use Drupal\Component\Annotation\AnnotationInterface; /** + * @defgroup plugin_translatable 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: + * @code + * title = @ Translation("Title of the plugin"), + * @endcode + * 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: + * @code + * use Drupal\Core\Annotation\Translation; + * @endcode + * @} + */ + +/** * Defines a translatable annotation object. * * Some metadata within an annotation needs to be translatable. This class @@ -18,6 +40,8 @@ * around the traditional t() function in drupal. * * @Annotation + * + * @ingroup translatable_plugin_definition */ class Translation implements AnnotationInterface { diff --git a/core/lib/Drupal/Core/Entity/Annotation/EntityType.php b/core/lib/Drupal/Core/Entity/Annotation/EntityType.php index 0487d03..38ed5fa 100644 --- a/core/lib/Drupal/Core/Entity/Annotation/EntityType.php +++ b/core/lib/Drupal/Core/Entity/Annotation/EntityType.php @@ -94,14 +94,18 @@ class EntityType extends Plugin { /** * The human-readable name of the type. * - * @var string + * @ingroup plugin_translatable + * + * @var \Drupal\Core\Annotation\Translation */ public $label; /** * The human-readable name of the entity bundles, e.g. Vocabulary. * - * @var string + * @ingroup plugin_translatable + * + * @var \Drupal\Core\Annotation\Translation */ public $bundle_label;