mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Custom Translations
This commit is contained in:
parent
efb40f1777
commit
58ef5240cd
@ -12,7 +12,9 @@
|
|||||||
namespace App\Http\ViewComposers;
|
namespace App\Http\ViewComposers;
|
||||||
|
|
||||||
use App\Models\ClientContact;
|
use App\Models\ClientContact;
|
||||||
|
use App\Utils\Ninja;
|
||||||
use App\Utils\TranslationHelper;
|
use App\Utils\TranslationHelper;
|
||||||
|
use Illuminate\Support\Facades\Lang;
|
||||||
use Illuminate\View\View;
|
use Illuminate\View\View;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -29,6 +31,9 @@ class PortalComposer
|
|||||||
public function compose(View $view) :void
|
public function compose(View $view) :void
|
||||||
{
|
{
|
||||||
$view->with($this->portalData());
|
$view->with($this->portalData());
|
||||||
|
|
||||||
|
if(auth()->user())
|
||||||
|
Lang::replace(Ninja::transformTranslations(auth()->user()->client->getMergedSettings()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -121,4 +121,22 @@ class Ninja
|
|||||||
'is_system' => app()->runningInConsole(),
|
'is_system' => app()->runningInConsole(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function transformTranslations($settings) :array
|
||||||
|
{
|
||||||
|
$translations = [];
|
||||||
|
|
||||||
|
$trans = (array)$settings->translations;
|
||||||
|
|
||||||
|
if(count($trans) == 0)
|
||||||
|
return $translations;
|
||||||
|
|
||||||
|
foreach($trans as $key => $value)
|
||||||
|
{
|
||||||
|
$translations['texts.'.$key] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $translations;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user