From 5597992d6373f8b565141c0a36fdaa708e567366 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 9 Jul 2024 13:17:46 +0100 Subject: [PATCH] Fixed API key missing translations Signed-off-by: snipe --- .../Controllers/Api/ProfileController.php | 2 +- resources/lang/en-US/account/general.php | 4 + resources/lang/en-US/general.php | 4 + .../livewire/personal-access-tokens.blade.php | 88 +++++++++---------- 4 files changed, 53 insertions(+), 45 deletions(-) diff --git a/app/Http/Controllers/Api/ProfileController.php b/app/Http/Controllers/Api/ProfileController.php index fb7335145..f7f91e094 100644 --- a/app/Http/Controllers/Api/ProfileController.php +++ b/app/Http/Controllers/Api/ProfileController.php @@ -110,7 +110,7 @@ class ProfileController extends Controller $accessTokenData['id'] = $token->id; $accessTokenData['token'] = $accessToken; $accessTokenData['name'] = $accessTokenName; - return response()->json(Helper::formatStandardApiResponse('success', $accessTokenData, 'Personal access token '.$accessTokenName.' created successfully')); + return response()->json(Helper::formatStandardApiResponse('success', $accessTokenData, trans('account/general.personal_api_keys_success', ['key' => $accessTokenName]))); } return response()->json(Helper::formatStandardApiResponse('error', null, 'Token could not be created.')); diff --git a/resources/lang/en-US/account/general.php b/resources/lang/en-US/account/general.php index 1a9e2c03b..d99e36df8 100644 --- a/resources/lang/en-US/account/general.php +++ b/resources/lang/en-US/account/general.php @@ -2,10 +2,14 @@ return array( 'personal_api_keys' => 'Personal API Keys', + 'personal_access_token' => 'Personal Access Token', + 'personal_api_keys_success' => 'Personal API Key :key created sucessfully', + 'here_is_api_key' => 'Here is your new personal access token. This is the only time it will be shown so do not lose it! You may now use this token to make API requests.', 'api_key_warning' => 'When generating an API token, be sure to copy it down immediately as they will not be visible to you again.', 'api_base_url' => 'Your API base url is located at:', 'api_base_url_endpoint' => '/<endpoint>', 'api_token_expiration_time' => 'API tokens are set to expire in:', 'api_reference' => 'Please check the API reference to find specific API endpoints and additional API documentation.', 'profile_updated' => 'Account successfully updated', + 'no_tokens' => 'You have not created any personal access tokens.', ); diff --git a/resources/lang/en-US/general.php b/resources/lang/en-US/general.php index 98748282f..60f9af30e 100644 --- a/resources/lang/en-US/general.php +++ b/resources/lang/en-US/general.php @@ -552,5 +552,9 @@ return [ ], 'more_info' => 'More Info', 'quickscan_bulk_help' => 'Checking this box will edit the asset record to reflect this new location. Leaving it unchecked will simply note the location in the audit log. Note that if this asset is checked out, it will not change the location of the person, asset or location it is checked out to.', + 'whoops' => 'Whoops!', + 'something_went_wrong' => 'Something went wrong with your request.', + 'close' => 'Close', + 'expires' => 'Expires', ]; diff --git a/resources/views/livewire/personal-access-tokens.blade.php b/resources/views/livewire/personal-access-tokens.blade.php index 8cae9d264..d4242c7a3 100644 --- a/resources/views/livewire/personal-access-tokens.blade.php +++ b/resources/views/livewire/personal-access-tokens.blade.php @@ -1,62 +1,65 @@
-
-
-
- + -
+
@if($tokens->count() === 0) -

- You have not created any personal access tokens. +

+ {{ trans('account/general.no_tokens') }}

@endif - +
+
@if($tokens->count() > 0) - - - - + + + + + @endif @foreach($tokens as $token) - + - - - - - - - + @endforeach +
NameCreatedExpiresDelete{{ trans('general.name') }}{{ trans('general.created_at') }}{{ trans('general.expires') }}{{ trans('general.delete') }}
+ {{ $token->name }} + {{ $token->created_at }} + {{ $token->expires_at }} + - + wire:loading.attr="disabled" data-tooltip="true" title="{{ trans('general.delete') }}"> + + + {{ trans('general.delete') }} +
+
@@ -74,22 +77,23 @@