mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Custom Translations
This commit is contained in:
parent
efb40f1777
commit
58ef5240cd
@ -12,7 +12,9 @@
|
||||
namespace App\Http\ViewComposers;
|
||||
|
||||
use App\Models\ClientContact;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\TranslationHelper;
|
||||
use Illuminate\Support\Facades\Lang;
|
||||
use Illuminate\View\View;
|
||||
|
||||
/**
|
||||
@ -29,6 +31,9 @@ class PortalComposer
|
||||
public function compose(View $view) :void
|
||||
{
|
||||
$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(),
|
||||
];
|
||||
}
|
||||
|
||||
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…
x
Reference in New Issue
Block a user