What steps will reproduce the problem?
Use Translator on not-existed key.
echo $translator->translate('not.existed.key'); // "not.existed.key"
What is the expected result?
I want to decide when translate() should return key or null.
$translationsForFooCategory = [
'label.some.existed.key' => 'Hello!',
];
$someOutput = $translator->translate('label.some.existed.key', category: 'foo');
$someOutput .= $translator->translate('description.some.not.existed.key', category: 'foo');
echo $someOutput; // "Hello!"
Throwing exception on missing translations is to complicated here.
I want to decide if given translate category return null on missing key or given TranlateInterface instance.
Additional info
| Q |
A |
| Version |
3.0.0 |
| PHP version |
8.0 |
What steps will reproduce the problem?
Use Translator on not-existed key.
What is the expected result?
I want to decide when
translate()should returnkeyornull.Throwing exception on missing translations is to complicated here.
I want to decide if given translate category return
nullon missing key or given TranlateInterface instance.Additional info