First make sure you set config/app.php, as
'locale' => 'fr'
.
You may set that per request using Illuminate\Support\Facades\App::setLocal('fr');
within the routes(Route::get()) or maybe using a middleware.
After you set the locale, add this key:value pair to resources/lang/fr.json file:
"There is one apple|There are many apples" : "{1} Hay una manzana|[2,*] Hay muchas manzanas"
.
And instead of __()
use trans_choice()
method. And you also have to provide the number of apple/apples as the second argument. That's how it knows if it's going to be singular(1) or plural(2+). So this how you use it inside the blade file:
{{ trans_choice("There is one apple|There are many apples", 2) }}
.