// resources/lang/es/navigation.phpreturn['back'=>'Volver al panel',];// routes/web.phpRoute::get('/es/contacts/show/{id}',function(){ // Setting it manually, for this example, instead of in a service provider App::setLocale('es');return view('contacts.show');});// resources/views/contacts/show.blade.php<ahref="/contacts">{{__('navigation.back')}}</a>
Example 6-23. Defining a simple translation with an option for pluralization
// resources/lang/en/messages.php
return [
'task-deletion' => 'You have deleted a task|You have successfully deleted tasks',
]
// resources/views/dashboard.blade.php
@if ($numTasksDeleted > 0)
{{ trans_choice('messages.task-deletion', $numTasksDeleted) }}
@endif
Example 6-24. Using the Symfony’s Translation component
// resources/lang/es/messages.php
return [
'task-deletion' => "{0} You didn't manage to delete any tasks.|" .
"[1,4] You deleted a few tasks.|" .
"[5,Inf] You deleted a whole ton of tasks.",
];
Example 6-25. Using JSON translations and the __() helper
// In Blade
{{ __('View friends list') }}
// resources/lang/es.json
{
'View friends list': 'Ver lista de amigos'
}