Translated internal notifications

This commit is contained in:
Julian Prieber 2023-06-15 13:11:20 +02:00
parent 761ebe401f
commit d4c383ea00
2 changed files with 46 additions and 12 deletions

View File

@ -127,6 +127,7 @@ return [
'Reason:' => 'Reason:+', 'Reason:' => 'Reason:+',
'Close' => 'Close+', 'Close' => 'Close+',
'Dismiss' => 'Dismiss+',
'All Notifications' => 'All Notifications+', 'All Notifications' => 'All Notifications+',
@ -546,7 +547,38 @@ return [
'Warn.Disable.Maintenance' => 'You are about to disable Maintenance Mode. Are you sure?+', 'Warn.Disable.Maintenance' => 'You are about to disable Maintenance Mode. Are you sure?+',
/*
|--------------------------------------------------------------------------
| Notification messages
|--------------------------------------------------------------------------
|
| All internal notifications.
| resources/views/layouts/notifications.blade.php
|
*/
'No notifications' => 'No notifications+',
'Your security is at risk!' => 'Your security is at risk!+',
'Immediate action is required!' => 'Immediate action is required!+',
'Your security is at risk!' => 'Your security is at risk!+',
'security.msg1' => 'Your security is at risk.+',
'security.msg2' => 'Some files can be accessed by everyone. Immediate action is required!+',
'security.msg3' => 'Some important files, are publicly accessible, putting your security at risk. Please take immediate action to revoke public access to these files to prevent unauthorized access to your sensitive information.+',
'security.msg4' => 'Learn more+',
'Hide this notification' => 'Hide this notification+',
'Help Us Out' => 'Help Us Out+',
'Enjoying Linkstack?' => 'Enjoying Linkstack?+',
'Support Linkstack' => 'Support Linkstack+',
'support.msg1' => 'If you\'re enjoying using Linkstack, we would greatly appreciate it if you could take a moment to+',
'support.msg2' => 'give our project a star on GitHub+',
'support.msg3' => 'Your support will help us reach a wider audience and improve the quality of our project.+',
'support.msg4' => 'If you\'re able to+',
'support.msg5' => 'make a financial contribution</a>, even a small amount would help us cover the costs of maintaining and improving Linkstack.+',
'support.msg6' => 'Thank you for your support and for being a part of the LinkStack community!+',
'' => '+', '' => '+',
]; ];

View File

@ -3,9 +3,11 @@ use App\Models\UserData;
$GLOBALS['activenotify'] = true; $GLOBALS['activenotify'] = true;
$compromised = false; $compromised = false;
function notification($dismiss = '', $ntid, $heading, $body) { function notification($dismiss = '', $ntid, $heading, $body) {
$closeMSG = __('messages.Close');
$dismissMSG = __('messages.Dismiss');
$dismissBtn = ''; $dismissBtn = '';
if ($dismiss) { if ($dismiss) {
$dismissBtn = '<a href="' . url()->current() . '?dismiss=' . $dismiss . '" class="btn btn-danger">Dismiss</a>'; $dismissBtn = '<a href="' . url()->current() . '?dismiss=' . $dismiss . '" class="btn btn-danger">'.$dismissMSG.'</a>';
} }
echo <<<MODAL echo <<<MODAL
<div class="modal fade" id="$ntid" data-bs-backdrop="true" data-bs-keyboard="false" tabindex="-1" aria-labelledby="${ntid}-label" aria-hidden="true"> <div class="modal fade" id="$ntid" data-bs-backdrop="true" data-bs-keyboard="false" tabindex="-1" aria-labelledby="${ntid}-label" aria-hidden="true">
@ -22,7 +24,7 @@ function notification($dismiss = '', $ntid, $heading, $body) {
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
$dismissBtn $dismissBtn
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">$closeMSG</button>
</div> </div>
</div> </div>
</div> </div>
@ -84,19 +86,19 @@ $notifyID = Auth::user()->id;
[ [
'id' => 'modal-1', 'id' => 'modal-1',
'icon' => 'bi bi-exclamation-triangle-fill text-danger', 'icon' => 'bi bi-exclamation-triangle-fill text-danger',
'title' => 'Your security is at risk!', 'title' => __('messages.Your security is at risk!'),
'message' => 'Immediate action is required!', 'message' => __('messages.Immediate action is required!'),
'condition' => $compromised, 'condition' => $compromised,
'dismiss' => 'Dismiss this notification', 'dismiss' => '',
'adminonly' => true, 'adminonly' => true,
], ],
[ [
'id' => 'modal-star', 'id' => 'modal-star',
'icon' => 'bi bi-heart-fill', 'icon' => 'bi bi-heart-fill',
'title' => 'Enjoying Linkstack?', 'title' => __('messages.Enjoying Linkstack?'),
'message' => 'Help Us Out', 'message' => __('messages.Help Us Out'),
'condition' => UserData::getData($notifyID, 'hide-star-notification') !== true, 'condition' => UserData::getData($notifyID, 'hide-star-notification') !== true,
'dismiss' => 'Hide this notification', 'dismiss' => __('messages.Hide this notification'),
'adminonly' => true, 'adminonly' => true,
], ],
]; ];
@ -115,7 +117,7 @@ $notifyID = Auth::user()->id;
@else @else
@php $GLOBALS['activenotify'] = false; @endphp @php $GLOBALS['activenotify'] = false; @endphp
@push('notifications') @push('notifications')
<center class='p-2'><i>No notifications</i></center> <center class='p-2'><i>{{__('messages.No notifications')}}</i></center>
@endpush @endpush
@endif @endif
@ -123,8 +125,8 @@ $notifyID = Auth::user()->id;
{{-- Notification Modals --}} {{-- Notification Modals --}}
@push('sidebar-scripts') @php @push('sidebar-scripts') @php
notification('', 'modal-1', 'Your security is at risk!', '<b>Your security is at risk.</b> Some files can be accessed by everyone. Immediate action is required!<br><br>Some important files, are publicly accessible, putting your security at risk. Please take immediate action to revoke public access to these files to prevent unauthorized access to your sensitive information.<br><a href="'.url('admin/config#5').'">Learn more</a>.'); notification('', 'modal-1', __('messages.Your security is at risk!'), '<b>'.__('messages.security.msg1').'</b> '.__('messages.security.msg2').'<br><br>'.__('messages.security.msg3').'<br><a href="'.url('admin/config#5').'">'.__('messages.security.msg3').'</a>.');
notification('hide-star-notification', 'modal-star', 'Support Linkstack', 'If you\'re enjoying using Linkstack, we would greatly appreciate it if you could take a moment to <a target="_blank" href="https://github.com/linkstackorg/linkstack">give our project a star on GitHub</a>. Your support will help us reach a wider audience and improve the quality of our project.<br><br>If you\'re able to <a target="_blank" href="https://linkstack.org/donate">make a financial contribution</a>, even a small amount would help us cover the costs of maintaining and improving Linkstack.<br><br>Thank you for your support and for being a part of the LinkStack community!'); notification('hide-star-notification', 'modal-star', __('messages.Support Linkstack'), ''.__('messages.support.msg1').' <a target="_blank" href="https://github.com/linkstackorg/linkstack">'.__('messages.support.msg2').'</a>. '.__('messages.support.msg3').'<br><br>'.__('messages.support.msg4').' <a target="_blank" href="https://linkstack.org/donate">'.__('messages.support.msg5').'<br><br>'.__('messages.support.msg6').'');
@endphp @endpush @endphp @endpush
@php @php