Translations

This commit is contained in:
David Bomba 2021-01-25 10:04:50 +11:00
parent a0d0c77630
commit af19afedb5
5 changed files with 14 additions and 10 deletions

View File

@ -134,7 +134,7 @@ class LicenseController extends BaseController
}
$error = [
'message' => 'Invalid license, or invalid environment '.config('ninja.environment'),
'message' => ctrans('texts.invoice_license_or_environment', ['environment' => config('ninja.environment')]),
'errors' => new stdClass,
];

View File

@ -74,7 +74,7 @@ class PingController extends BaseController
public function health()
{
if (Ninja::isNinja()) {
return response()->json(['message' => 'Route not available', 'errors'=>[]], 403);
return response()->json(['message' => ctrans('texts.route_not_available'), 'errors'=>[]], 403);
}
return response()->json(SystemHealth::check(), 200);

View File

@ -81,7 +81,7 @@ class PreviewController extends BaseController
$design_object = json_decode(json_encode(request()->input('design')));
if (! is_object($design_object)) {
return response()->json(['message' => 'Invalid custom design object'], 400);
return response()->json(['message' => ctrans('texts.invalid_design_object')], 400);
}
$entity = ucfirst(request()->input('entity'));

View File

@ -507,7 +507,7 @@ class QuoteController extends BaseController
$quotes = Quote::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get();
if (! $quotes) {
return response()->json(['message' => 'No Quote/s Found']);
return response()->json(['message' => ctrans('texts.quote_not_found')]);
}
/*
@ -517,13 +517,13 @@ class QuoteController extends BaseController
if ($action == 'download' && $quotes->count() >= 1) {
$quotes->each(function ($quote) {
if (auth()->user()->cannot('view', $quote)) {
return response()->json(['message'=>'Insufficient privileges to access quote '.$quote->number]);
return response()->json(['message'=> ctrans('texts.access_denied')]);
}
});
ZipInvoices::dispatch($quotes, $quotes->first()->company, auth()->user()->email);
return response()->json(['message' => 'Email Sent!'], 200);
return response()->json(['message' => ctrans('texts.sent_message')], 200);
}
if ($action == 'convert') {
@ -651,7 +651,7 @@ class QuoteController extends BaseController
case 'approve':
//make sure it hasn't already been approved!!
if ($quote->status_id != Quote::STATUS_SENT) {
return response()->json(['message' => 'Unable to approve this quote as it has expired.'], 400);
return response()->json(['message' => ctrans('texts.quote_unapprovable')], 400);
}
return $this->itemResponse($quote->service()->approve()->save());
@ -692,7 +692,7 @@ class QuoteController extends BaseController
case 'email':
$quote->service()->sendEmail();
return response()->json(['message'=>'email sent'], 200);
return response()->json(['message'=> ctrans('texts.sent_message')], 200);
break;
case 'mark_sent':
$quote->service()->markSent()->save();
@ -702,7 +702,7 @@ class QuoteController extends BaseController
}
break;
default:
return response()->json(['message' => "The requested action `{$action}` is not available."], 400);
return response()->json(['message' => ctrans('texts.action_unavailable',['action' => $action])], 400);
break;
}
}

View File

@ -3419,5 +3419,9 @@ return [
'no_group_settings_found' => 'No group settings found',
'access_denied' => 'Insufficient privileges to access/modify this resource',
'invoice_cannot_be_marked_paid' => 'Invoice cannot be marked as paid',
'invoice_license_or_environment' => 'Invalid license, or invalid environment :environment',
'route_not_available' => 'Route not available',
'invalid_design_object' => 'Invalid custom design object',
'quote_not_found' => 'Quote/s not found',
'quote_unapprovable' => 'Unable to approve this quote as it has expired.',
];