1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-19 17:42:44 +01:00
invoiceninja/app/Http/Controllers/TranslationController.php

124 lines
2.4 KiB
PHP
Raw Normal View History

<?php
2019-05-11 05:32:07 +02:00
/**
* Invoice Ninja (https://invoiceninja.com).
2019-05-11 05:32:07 +02:00
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
2019-05-11 05:32:07 +02:00
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
2019-01-27 00:22:57 +01:00
/**
* Class TranslationController.
2019-01-27 00:22:57 +01:00
*/
2019-03-28 22:34:58 +01:00
class TranslationController extends BaseController
{
2019-03-28 22:34:58 +01:00
public function __construct()
{
parent::__construct();
}
/**
* Display a listing of the resource.
*
2020-10-28 11:10:49 +01:00
* @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.
*
2020-10-28 11:10:49 +01:00
* @return void
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
2020-10-28 11:10:49 +01:00
* @param Request $request
* @return void
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
2020-10-28 11:10:49 +01:00
* @param int $id
* @return void
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
2020-10-28 11:10:49 +01:00
* @param int $id
* @return void
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
2020-10-28 11:10:49 +01:00
* @param Request $request
* @param int $id
* @return void
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
2020-10-28 11:10:49 +01:00
* @param int $id
* @return void
*/
public function destroy($id)
{
//
}
}