Closed Gummby closed 2 years ago
I think you're missing the key to the actual line here?
trans('messages.buttons.submit', ['confirm' => 'save'])
The usage you're showing has never been supported I believe.
Hey, sorry that was just an example. We have trans files full with multiple key values. see: https://laravel.com/docs/8.x/localization#using-short-keys
so doing
trans('messages', ['reject' => 'nah', 'confirm' => 'yeah']));
on
<?php
// messages
return [
'welcome' => 'Welcome to our application! :reject',
'buttons' => [
'close' => ':reject',
'submit' => ':confirm',
],
];
will return
Array
(
[welcome] => Welcome to our application! nah
[buttons] => Array
(
[close] => nah
[submit] => yeah
)
)
I'm sorry but I believe it was never intended to be used that way. You'd always specify the full path to the translation key.
I'm sorry but I believe it was never intended to be used that way. You'd always specify the full path to the translation key.
all good, thought that might be the case. Thank you
Description:
Hi there, I am not sure if this a bug or is not intended functionality. But in
illuminate/translation/Translator.php
translate'smakeReplacements
method is now usingstrtr
. If we use a nested arraystrtr
will fail on the type check. It previously usedstr_replace
which would allow$line
to be an array or string. I'm unsure if this was ever meant to be used like this. How ever if it was it would be great if this could be supported still.Steps To Reproduce:
trans('messages', ['confirm' => 'save'])
change occurred here:
https://github.com/illuminate/translation/commit/019c83d17b6311be5e52ab99487804d210110d9d