How to change case of the translation variables in Laravel

Categorized as Laravel

You can easily change case of the translated variables with Laravel (uppercase, lowercase, first letter capitalized). See the following code:

{{ __('messages.hello', ['name' => 'mike']) }}

// File: resources/lang/en/messages.php

'hello' => 'Hi, :Name'
// "Hi, Mike"

'hello' => 'Hi, :NAME'
// "Hi, MIKE"

'hello' => 'Hi, :name'
// "Hi, mike"

From @ecrmnn

Leave a reply

Your email address will not be published. Required fields are marked *