1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

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;
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);

View File

@ -150,7 +150,7 @@ class BaseController extends Controller
*/
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-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;
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);

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();
if (! $company_user) {
throw new ModelNotFoundException('Company User record not found');
throw new ModelNotFoundException(ctrans('texts.company_user_not_found'));
return;
}

View File

@ -484,7 +484,7 @@ class CreditController extends BaseController
$credits = Credit::withTrashed()->whereIn('id', $this->transformKeys($ids));
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) {
@ -561,7 +561,7 @@ class CreditController 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

@ -124,7 +124,7 @@ class DocumentController extends BaseController
{
$this->document_repo->delete($document);
return response()->json(['message'=>'success']);
return response()->json(['message'=> ctrans('texts.success')]);
}
public function bulk()
@ -136,7 +136,7 @@ class DocumentController extends BaseController
$documents = Document::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get();
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();
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());
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)

View File

@ -387,7 +387,7 @@ class InvoiceController extends BaseController
}
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);
@ -526,13 +526,13 @@ class InvoiceController extends BaseController
if ($action == 'download' && $invoices->count() > 1) {
$invoices->each(function ($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);
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;
case 'mark_paid':
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();
@ -686,9 +686,7 @@ class InvoiceController extends BaseController
}
break;
case 'delete':
//need to make sure the invoice is cancelled first!!
//$invoice->service()->handleCancellation()s->save();
nlog("inside delete");
$this->invoice_repo->delete($invoice);
if (! $bulk) {
@ -735,7 +733,7 @@ nlog("inside delete");
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

@ -3408,6 +3408,16 @@ return [
'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?',
'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',
];