diff --git a/core/lib/Drupal/Core/Annotation/Translation.php b/core/lib/Drupal/Core/Annotation/Translation.php index 0d6acd10dfaaa12912b363776017a0bc0774cd8b..d98e3a14ff762d0d01e6f950f8f9d06d59e092e4 100644 --- a/core/lib/Drupal/Core/Annotation/Translation.php +++ b/core/lib/Drupal/Core/Annotation/Translation.php @@ -9,6 +9,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. * @@ -18,6 +40,8 @@ * around the traditional t() function in drupal. * * @Annotation + * + * @ingroup plugin_translatable */ 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 50b604ce57369933463a6709cba528f4b5a56818..95d97f0680c4ffb566e5037f627c56da223adc9e 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;