The
trans
function translates the given translation key using your localization files:<?php echo trans('messages.welcome');
<?php protected function sendResetResponse(Request $request, $response)
{
if ($request->wantsJson()) {
return new JsonResponse(['message' => trans($response)], 200);
}
return redirect($this->redirectPath())
<?php }
return redirect($this->redirectPath())
->with('status', trans($response));
}
<?php {
if ($request->wantsJson()) {
throw ValidationException::withMessages([
'email' => [trans($response)],
]);
}
<?php return redirect()->back()
->withInput($request->only('email'))
->withErrors(['email' => trans($response)]);
}
<?php : back();
return $request->wantsJson()
? new JsonResponse(['message' => trans($response)], 200)
: $redirect->with('status', trans($response));
}
<?php return $request->wantsJson()
? new JsonResponse(['message' => trans($response)], 200)
: $redirect->with('status', trans($response));
}
<?php if ($request->wantsJson()) {
throw ValidationException::withMessages([
'email' => [trans($response)],
]);
}
<?php return $redirect
->withInput($request->only('email'))
->withErrors(['email' => trans($response)], 'user.forgot_password');
}
<?php protected function sendFailedLoginResponse(Request $request)
{
throw ValidationException::withMessages([
$this->username() => [trans('auth.failed')],
]);
}
<?php $uris = $siblings->map->uri();
if ($uris->contains($uri = $page->uri())) {
throw ValidationException::withMessages(['uri' => trans('statamic::validation.duplicate_uri', ['value' => $uri])]);
}
}
}
<?php case 'outside_license_range':
[$start, $end] = $this->response['range'];
return trans('statamic::messages.licensing_error_outside_license_range', compact('start', 'end'));
case 'invalid_edition':
return trans('statamic::messages.licensing_error_invalid_edition', ['edition' => $this->response['edition']]);
<?php return trans('statamic::messages.licensing_error_outside_license_range', compact('start', 'end'));
case 'invalid_edition':
return trans('statamic::messages.licensing_error_invalid_edition', ['edition' => $this->response['edition']]);
}
return parent::invalidReason();
<?php return;
}
return trans('statamic::messages.licensing_error_'.$reason);
}
}
<?php public function trans($value)
{
return trans($value);
}
<?php $this->assertEmpty(User::all());
$this->artisan('statamic:make:user', ['email' => 'jason'])
->expectsOutput(trans('validation.email', ['attribute' => 'input']));
$this->artisan('statamic:make:user', ['email' => 'jason@keeponrunnin.com'])
->expectsOutput('User created successfully.');