Translations

This commit is contained in:
David Bomba 2021-01-25 11:57:49 +11:00
parent af19afedb5
commit 269f83f317
9 changed files with 10 additions and 240 deletions

View File

@ -7,9 +7,9 @@ class SchedulerController extends Controller
public function index()
{
if (auth()->user()->company()->account->latest_version == '0.0.0') {
return response()->json(['message' => 'Scheduler has never run'], 400);
return response()->json(['message' => ctrans('texts.scheduler_has_never_run')], 400);
} else {
return response()->json(['message' => 'Scheduler has run'], 200);
return response()->json(['message' => ctrans('texts.scheduler_has_run')], 200);
}
}
}

View File

@ -59,7 +59,7 @@ class SelfUpdateController extends BaseController
define('STDIN', fopen('php://stdin', 'r'));
if (Ninja::isNinja()) {
return response()->json(['message' => 'Self update not available on this system.'], 403);
return response()->json(['message' => ctrans('texts.self_update_not_available')], 403);
}
/* .git MUST be owned/writable by the webserver user */

View File

@ -1,101 +0,0 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Http\Controllers;
use Illuminate\Http\Request;
/**
* Class SettingsController.
*/
class SettingsController extends BaseController
{
public function __construct()
{
parent::__construct();
}
/**
* Display a listing of the resource.
*
* @return void
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return void
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return void
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param int $id
* @return void
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return void
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param Request $request
* @param int $id
* @return void
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return void
*/
public function destroy($id)
{
//
}
}

View File

@ -1,123 +0,0 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
/**
* Class TranslationController.
*/
class TranslationController extends BaseController
{
public function __construct()
{
parent::__construct();
}
/**
* Display a listing of the resource.
*
* @return void
*/
public function index()
{
$strings = Cache::rememberForever('lang.js', function () {
$lang = config('app.locale');
$files = glob(resource_path('lang/'.$lang.'/*.php'));
$strings = [];
foreach ($files as $file) {
$name = basename($file, '.php');
$strings[$name] = require $file;
}
return $strings;
});
header('Content-Type: text/javascript');
echo 'i18n = '.$this->easyMinify(json_encode($strings)).';';
exit();
}
private function easyMinify($javascript)
{
return preg_replace(["/\s+\n/", "/\n\s+/", '/ +/'], ["\n", "\n ", ' '], $javascript);
}
/**
* Show the form for creating a new resource.
*
* @return void
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return void
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param int $id
* @return void
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return void
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param Request $request
* @param int $id
* @return void
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return void
*/
public function destroy($id)
{
//
}
}

View File

@ -668,6 +668,6 @@ class UserController extends BaseController
$company_user->delete();
}
return response()->json(['message' => 'User detached from company'], 200);
return response()->json(['message' => ctrans('texts.user_detached')], 200);
}
}

View File

@ -364,7 +364,7 @@ class WebhookController extends BaseController
$webhook->save();
if (! $webhook->id) {
return response()->json('Failed to create Webhook', 400);
return response()->json(ctrans('texts.create_webhook_failure'), 400);
}
return $this->itemResponse($webhook);

View File

@ -25,13 +25,4 @@ class EditClientRequest extends Request
return auth()->user()->can('edit', $this->client);
}
// public function prepareForValidation()
// {
// $input = $this->all();
// //$input['id'] = $this->encodePrimaryKey($input['id']);
// $this->replace($input);
// }
}

View File

@ -3424,4 +3424,9 @@ return [
'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.',
'scheduler_has_run' => 'Scheduler has run',
'scheduler_has_never_run' => 'Scheduler has never run',
'self_update_not_available' => 'Self update not available on this system.',
'user_detached' => 'User detached from company',
'create_webhook_failure' => 'Failed to create Webhook',
];

View File

@ -178,8 +178,6 @@ Route::group(['middleware' => ['api_db', 'token_auth', 'locale'], 'prefix' => 'a
Route::post('tasks/bulk', 'TaskController@bulk')->name('tasks.bulk');
Route::get('settings', 'SettingsController@index')->name('user.settings');
*/
Route::get('scheduler', 'SchedulerController@index');
Route::post('support/messages/send', 'Support\Messages\SendingController');