translations

This commit is contained in:
David Bomba 2021-01-25 09:24:13 +11:00
parent c4db674fae
commit a0d0c77630
10 changed files with 28 additions and 20 deletions

View File

@ -136,7 +136,7 @@ class ActivityController extends BaseController
$backup = $activity->backup; $backup = $activity->backup;
if (! $backup || ! $backup->html_backup) { if (! $backup || ! $backup->html_backup) {
return response()->json(['message'=> 'No backup exists for this activity', 'errors' => new stdClass], 404); return response()->json(['message'=> ctrans('texts.no_backup_exists'), 'errors' => new stdClass], 404);
} }
$pdf = $this->makePdf(null, null, $backup->html_backup); $pdf = $this->makePdf(null, null, $backup->html_backup);

View File

@ -150,7 +150,7 @@ class BaseController extends Controller
*/ */
public function notFound() public function notFound()
{ {
return response()->json(['message' => '404 | Nothing to see here!'], 404) return response()->json(['message' => ctrans('texts.api_404')], 404)
->header('X-API-VERSION', config('ninja.minimum_client_version')) ->header('X-API-VERSION', config('ninja.minimum_client_version'))
->header('X-APP-VERSION', config('ninja.app_version')); ->header('X-APP-VERSION', config('ninja.app_version'));
} }
@ -198,7 +198,7 @@ class BaseController extends Controller
$updated_at = request()->has('updated_at') ? request()->input('updated_at') : 0; $updated_at = request()->has('updated_at') ? request()->input('updated_at') : 0;
if (auth()->user()->getCompany()->is_large && ! request()->has('updated_at')) { if (auth()->user()->getCompany()->is_large && ! request()->has('updated_at')) {
return response()->json(['message' => 'Cannot load a large account without a updated_at parameter', 'errors' =>[]], 401); return response()->json(['message' => ctrans('texts.large_account_update_parameter'), 'errors' =>[]], 401);
} }
$updated_at = date('Y-m-d H:i:s', $updated_at); $updated_at = date('Y-m-d H:i:s', $updated_at);

View File

@ -501,6 +501,6 @@ class CompanyController extends BaseController
} }
} }
return response()->json(['message' => 'success'], 200); return response()->json(['message' => ctrans('texts.success')], 200);
} }
} }

View File

@ -115,7 +115,7 @@ class CompanyUserController extends BaseController
$company_user = CompanyUser::whereUserId($user->id)->whereCompanyId($company->id)->first(); $company_user = CompanyUser::whereUserId($user->id)->whereCompanyId($company->id)->first();
if (! $company_user) { if (! $company_user) {
throw new ModelNotFoundException('Company User record not found'); throw new ModelNotFoundException(ctrans('texts.company_user_not_found'));
return; return;
} }

View File

@ -484,7 +484,7 @@ class CreditController extends BaseController
$credits = Credit::withTrashed()->whereIn('id', $this->transformKeys($ids)); $credits = Credit::withTrashed()->whereIn('id', $this->transformKeys($ids));
if (! $credits) { if (! $credits) {
return response()->json(['message' => 'No Credits Found']); return response()->json(['message' => ctrans('texts.no_credits_found')]);
} }
$credits->each(function ($credit, $key) use ($action) { $credits->each(function ($credit, $key) use ($action) {
@ -561,7 +561,7 @@ class CreditController extends BaseController
break; break;
default: 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; break;
} }
} }

View File

@ -124,7 +124,7 @@ class DocumentController extends BaseController
{ {
$this->document_repo->delete($document); $this->document_repo->delete($document);
return response()->json(['message'=>'success']); return response()->json(['message'=> ctrans('texts.success')]);
} }
public function bulk() public function bulk()
@ -136,7 +136,7 @@ class DocumentController extends BaseController
$documents = Document::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get(); $documents = Document::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get();
if (! $invoices) { if (! $invoices) {
return response()->json(['message' => 'No Documents Found']); return response()->json(['message' => ctrans('texts.no_documents_found')]);
} }
/* /*

View File

@ -481,7 +481,7 @@ class GroupSettingController extends BaseController
$group_settings = GroupSetting::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get(); $group_settings = GroupSetting::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get();
if (! $group_settings) { if (! $group_settings) {
return response()->json(['message' => 'No Group Settings Found']); return response()->json(['message' => ctrans('texts.no_group_settings_found')]);
} }
/* /*

View File

@ -95,7 +95,7 @@ class ImportController extends Controller
{ {
CSVImport::dispatch($request->all(), auth()->user()->company()); CSVImport::dispatch($request->all(), auth()->user()->company());
return response()->json(['message' => 'Importing data, email will be sent on completion'], 200); return response()->json(['message' => ctrans('texts.import_started')], 200);
} }
private function getEntityMap($entity_type) private function getEntityMap($entity_type)

View File

@ -387,7 +387,7 @@ class InvoiceController extends BaseController
} }
if ($invoice->isLocked()) { if ($invoice->isLocked()) {
return response()->json(['message' => 'Invoice is locked, no modifications allowed']); return response()->json(['message' => ctrans('texts.locked_invoice')]);
} }
$invoice = $this->invoice_repo->save($request->all(), $invoice); $invoice = $this->invoice_repo->save($request->all(), $invoice);
@ -526,13 +526,13 @@ class InvoiceController extends BaseController
if ($action == 'download' && $invoices->count() > 1) { if ($action == 'download' && $invoices->count() > 1) {
$invoices->each(function ($invoice) { $invoices->each(function ($invoice) {
if (auth()->user()->cannot('view', $invoice)) { if (auth()->user()->cannot('view', $invoice)) {
return response()->json(['message' => 'Insufficient privileges to access invoice '.$invoice->number]); return response()->json(['message' => ctrans('text.access_denied')]);
} }
}); });
ZipInvoices::dispatch($invoices, $invoices->first()->company, auth()->user()->email); ZipInvoices::dispatch($invoices, $invoices->first()->company, auth()->user()->email);
return response()->json(['message' => 'Email Sent!'], 200); return response()->json(['message' => ctrans('texts.sent_message')], 200);
} }
/* /*
@ -649,7 +649,7 @@ class InvoiceController extends BaseController
break; break;
case 'mark_paid': case 'mark_paid':
if ($invoice->balance < 0 || $invoice->status_id == Invoice::STATUS_PAID || $invoice->is_deleted === true) { if ($invoice->balance < 0 || $invoice->status_id == Invoice::STATUS_PAID || $invoice->is_deleted === true) {
return $this->errorResponse(['message' => 'Invoice cannot be marked as paid'], 400); return $this->errorResponse(['message' => ctrans('texts.invoice_cannot_be_marked_paid')], 400);
} }
$invoice = $invoice->service()->markPaid(); $invoice = $invoice->service()->markPaid();
@ -686,9 +686,7 @@ class InvoiceController extends BaseController
} }
break; break;
case 'delete': case 'delete':
//need to make sure the invoice is cancelled first!!
//$invoice->service()->handleCancellation()s->save();
nlog("inside delete");
$this->invoice_repo->delete($invoice); $this->invoice_repo->delete($invoice);
if (! $bulk) { if (! $bulk) {
@ -735,7 +733,7 @@ nlog("inside delete");
break; break;
default: 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; break;
} }
} }

View File

@ -3408,6 +3408,16 @@ return [
'attempted_refund_failed' => 'Attempting to refund :amount only :refundable_amount available for refund', 'attempted_refund_failed' => 'Attempting to refund :amount only :refundable_amount available for refund',
'user_not_associated_with_this_account' => 'This user is unable to be attached to this company. Perhaps they have already registered a user on another account?', 'user_not_associated_with_this_account' => 'This user is unable to be attached to this company. Perhaps they have already registered a user on another account?',
'migration_completed' => 'Migration completed', 'migration_completed' => 'Migration completed',
'migration_completed_description' => 'Your migration has completed, please review your data after logging in.' 'migration_completed_description' => 'Your migration has completed, please review your data after logging in.',
'api_404' => '404 | Nothing to see here!',
'large_account_update_parameter' => 'Cannot load a large account without a updated_at parameter',
'no_backup_exists' => 'No backup exists for this activity',
'company_user_not_found' => 'Company User record not found',
'no_credits_found' => 'No credits found.',
'action_unavailable' => 'The requested action :action is not available.',
'no_documents_found' => 'No Documents Found',
'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',
]; ];