Level 6
Mar 15, 2017
1
Level 6
Translation default fallback
For faster translation, I used this helper function to save time, if the translation does not exist just show default string.
if (! function_exists('tr')) {
function tr($id, $fallback, $parameters = [], $domain = 'messages', $locale = null)
{
return ($id === ($translation = trans($id, $parameters, $domain, $locale))) ? $fallback : $translation;
}
}
For example
{{ tr('frontend/wellcome.message', 'Wellcome to our new website') }}
In Laravel 5.3 all worked well but since 5.4 this helper function does not work.
I can not figure out where could be the problem!
Please or to participate in this conversation.