Translation
Resolve a value from the loaded translation collection.
Purpose & processing
Calls Core\Translations::get($key) on the Registry-resolved translations controller.
Parameters
| Parameter | Type | Default | Behavior |
|---|---|---|---|
| key | string | Required | Key used to resolve the value. |
Example
#[Translation('core__dashboard__title')]
protected string|null $title = null;
Behavior and considerations
- A missing translation key resolves to null; it does not return the key itself.
- A stored null value also resolves to null.
- Allow null in the destination property unless the translation is guaranteed to exist.
Source
shared/src/Core/Annotation/Translation.php