1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-06-05 22:09:38 +02:00

Correzioni per gestione delle traduzioni

This commit is contained in:
Dasc3er
2021-03-03 08:26:20 +01:00
parent 566f268a8c
commit 0c7f49362e
15 changed files with 33520 additions and 10 deletions

View File

@ -1,4 +1,4 @@
APP_NAME=Laravel APP_NAME=OpenSTAManager
APP_ENV=local APP_ENV=local
APP_KEY= APP_KEY=
APP_DEBUG=true APP_DEBUG=true

View File

@ -3,6 +3,7 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
class ConfigurationController extends Controller class ConfigurationController extends Controller
@ -109,6 +110,9 @@ class ConfigurationController extends Controller
$this->updateEnv($key, $value); $this->updateEnv($key, $value);
} }
// Refresh della cache sulla configurazione
Artisan::call('config:clear');
return redirect(route('configuration')); return redirect(route('configuration'));
} }

View File

@ -6,6 +6,7 @@ use App\Http\Middleware\EnsureCalendarPeriod;
use App\Http\Middleware\EnsureConfiguration; use App\Http\Middleware\EnsureConfiguration;
use App\Http\Middleware\EnsureEnvFile; use App\Http\Middleware\EnsureEnvFile;
use App\Http\Middleware\HTMLBuilder; use App\Http\Middleware\HTMLBuilder;
use App\Http\Middleware\Language;
use Illuminate\Foundation\Http\Kernel as HttpKernel; use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel class Kernel extends HttpKernel
@ -42,8 +43,8 @@ class Kernel extends HttpKernel
\Illuminate\View\Middleware\ShareErrorsFromSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class, \App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class, \Illuminate\Routing\Middleware\SubstituteBindings::class,
\Xinax\LaravelGettext\Middleware\GettextMiddleware::class,
Language::class,
EnsureCalendarPeriod::class, EnsureCalendarPeriod::class,
EnsureConfiguration::class, EnsureConfiguration::class,
HTMLBuilder::class, HTMLBuilder::class,
@ -63,8 +64,8 @@ class Kernel extends HttpKernel
\Illuminate\View\Middleware\ShareErrorsFromSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class,
// \App\Http\Middleware\VerifyCsrfToken::class, // \App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class, \Illuminate\Routing\Middleware\SubstituteBindings::class,
\Xinax\LaravelGettext\Middleware\GettextMiddleware::class,
Language::class,
EnsureCalendarPeriod::class, EnsureCalendarPeriod::class,
EnsureConfiguration::class, EnsureConfiguration::class,
HTMLBuilder::class, HTMLBuilder::class,

View File

@ -0,0 +1,27 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Xinax\LaravelGettext\Facades\LaravelGettext;
class Language
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle(Request $request, Closure $next)
{
$manager = LaravelGettext::getFacadeRoot();
$locale = env('APP_LOCALE', 'it_IT');
$manager->setLocale($locale);
return $next($request);
}
}

24
app/helpers.php Normal file
View File

@ -0,0 +1,24 @@
<?php
/**
* Gets the current locale.
*
* @return string
*/
function locale(): string
{
return app()->getLocale();
}
/**
* Get the language portion of the locale.
* (ex. en_GB returns en)
*
* @return string
*/
function localeLanguage(): string
{
$locale = locale();
return substr($locale, 0, strpos($locale, "_"));
}

View File

@ -121,6 +121,7 @@
"Database\\Seeders\\": "database/seeders/" "Database\\Seeders\\": "database/seeders/"
}, },
"files": [ "files": [
"app/helpers.php",
"legacy/lib/functions.php", "legacy/lib/functions.php",
"legacy/lib/common.php", "legacy/lib/common.php",
"legacy/lib/helpers.php", "legacy/lib/helpers.php",

View File

@ -20,7 +20,7 @@ return [
* Default locale: this will be the default for your application. * Default locale: this will be the default for your application.
* Is to be supposed that all strings are written in this language. * Is to be supposed that all strings are written in this language.
*/ */
'locale' => env('APP_LOCALE', 'it_IT'), 'locale' => 'it_IT',
/* /*
* Supported locales: An array containing all allowed languages * Supported locales: An array containing all allowed languages
@ -78,7 +78,7 @@ return [
/* /*
* Translator contact data (used on .po headers too) * Translator contact data (used on .po headers too)
*/ */
'translator' => 'James Translator <james@translations.colm>', 'translator' => 'DevCode s.r.l. <info@devcode.it>',
/* /*
* Paths where Poedit will search recursively for strings to translate. * Paths where Poedit will search recursively for strings to translate.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

4
resources/lang/i18n/it_IT/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@ -34,8 +34,8 @@
decimals: "{{ formatter()->getNumberSeparators()['decimals'] }}", decimals: "{{ formatter()->getNumberSeparators()['decimals'] }}",
thousands: "{{ formatter()->getNumberSeparators()['thousands'] }}", thousands: "{{ formatter()->getNumberSeparators()['thousands'] }}",
locale: '{{ substr(app()->getLocale(), 0, strpos(app()->getLocale(), "_")) }}', locale: '{{ localeLanguage() }}',
full_locale: '{{ app()->getLocale() }}', full_locale: '{{ locale() }}',
search: search, search: search,
translations: { translations: {

View File

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="="fr">">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>@yield('title') - {{ tr('OpenSTAManager') }}</title> <title>@yield('title') - {{ tr('OpenSTAManager') }}</title>
@ -47,8 +47,8 @@
decimals: "{{ formatter()->getNumberSeparators()['decimals'] }}", decimals: "{{ formatter()->getNumberSeparators()['decimals'] }}",
thousands: "{{ formatter()->getNumberSeparators()['thousands'] }}", thousands: "{{ formatter()->getNumberSeparators()['thousands'] }}",
locale: '{{ substr(app()->getLocale(), 0, strpos(app()->getLocale(), "_")) }}', locale: '{{ localeLanguage() }}',
full_locale: '{{ app()->getLocale() }}', full_locale: '{{ locale() }}',
translations: { translations: {
password: { password: {