Outputting a Translation in a Blade Template


You want to use translations in your Blade template.


Use the Blade @lang command.

For example:


Assuming there's a welcome key in the messages.php for the current locale, the above would output the translated message.

If there is no translated message then messages.welcome would be output.

If your message has a placeholder, you can pass a second parameter with an array of placeholders.

@lang('messages.welcome', ['name' => $name])


This Blade command uses the Lang::get() method.

See Getting the Translation for a Key for details about this method.

comments powered by Disqus