I'm using laravel (5.1) blade template engine with the localization feature.
There is a language file messages.php
within the /resources/lang/en/
folder:
return [
'welcome' => 'welcome',
In my blade template the welcome message is called using the trans
method:
{{ trans('messages.welcome') }}
In some cases I need to show the same message but with first letter capitalized ("Welcome"). I don't want to use duplicate records in the translation file.
How can I approach this?
Use PHP's native ucfirst
function:
{{ ucfirst(trans('messages.welcome')) }}