You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR was squashed before being merged into the 7.4 branch.
Discussion
----------
[Translation] Add `StaticMessage`
| Q | A
| ------------- | ---
| Branch? | 7.4
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Issues | Fix #... <!-- prefix each issue number with "Fix #"; no need to create an issue if none exists, explain below -->
| License | MIT
When working with translation, it's "classic" to have library with the following logic:
```php
if ($message instanceof Translatable) {
$message->trans($translator);
} else {
$translator->trans($message, domain: 'OpenSourceBundle');
}
```
Then if the user doesn't want the text to be translated, he cannot.
A useful and simple way would be to support `new TranslatableMessage($text, domain: false)` but as recommended, it might be better to introduce a special class for this, the StaticMessage
Commits
-------
b329818 [Translation] Add `StaticMessage`
0 commit comments