Skip to content

Commit 0e89bd1

Browse files
committed
Load translations from JSON
1 parent b94d75d commit 0e89bd1

12 files changed

+50
-51
lines changed

resources/lang/en.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"Secure your account": "Secure your account",
3+
"Your account has been secured with two factor authentication": "Your account has been secured with two factor authentication",
4+
"Add additional security to your account using two factor authentication": "Add additional security to your account using two factor authentication",
5+
"You have three options to confirm your identity, please choose one of the options below to continue": "You have three options to confirm your identity, please choose one of the options below to continue",
6+
"Two-Factor Authentication enabled": "Two-Factor Authentication enabled",
7+
"Or scan the QR code with your authenticator app": "Or scan the QR code with your authenticator app",
8+
"The secret key to setup the authenticator app is": "The secret key to setup the authenticator app is",
9+
"Save these recovery codes in a secure place as they can be used to recover access to your account if you lose your device.": "Save these recovery codes in a secure place as they can be used to recover access to your account if you lose your device.",
10+
"Cancel": "Cancel",
11+
"Login": "Login",
12+
"Authenticate with your Authentication code": "Authenticate with your Authentication code",
13+
"Reset Password": "Reset Password",
14+
"Submit": "Submit",
15+
"Resend": "Resend",
16+
"Successfully resend the OTP code": "Successfully resend the OTP code",
17+
"Recovery code": "Recovery code",
18+
"Password Confirmation": "Password Confirmation",
19+
"Confirm": "Confirm",
20+
"Verify": "Verify",
21+
"Code": "Code",
22+
"Two-Factor Authentication": "Two-Factor Authentication"
23+
}

resources/lang/en/two-factor-auth.php

Lines changed: 0 additions & 25 deletions
This file was deleted.

resources/views/auth/login-two-factor.blade.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class="relative z-10 flex flex-1 flex-col bg-white px-4 py-10 shadow-2xl sm:just
99
</a>
1010
</div>
1111
<h2 class="mt-20 text-lg font-semibold text-gray-900 text-center">
12-
{{ __('filament-two-factor-auth::Authenticate with your Authentication code') }}
12+
{{ __('Authenticate with your Authentication code') }}
1313
</h2>
1414
{{ $this->resend() }}
1515

@@ -21,10 +21,10 @@ class="relative z-10 flex flex-1 flex-col bg-white px-4 py-10 shadow-2xl sm:just
2121
<div class="flex items-center justify-between">
2222
<x-filament::button color="secondary" class="w-full" type="button" tag="a" outlined
2323
href="{{ route('login') }}">
24-
{{ __('filament-two-factor-auth::Cancel') }}
24+
{{ __('Cancel') }}
2525
</x-filament::button>
2626
<x-filament::button type="submit" class="w-full" color="info">
27-
{{ __('filament-two-factor-auth::Login') }}
27+
{{ __('Login') }}
2828
</x-filament::button>
2929
</div>
3030
</form>

resources/views/auth/password-confirmation.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
])>
1010

1111
<h2 class="font-bold tracking-tight text-center text-2xl">
12-
{{ __('filament-two-factor-auth::Confirm') }}
12+
{{ __('Confirm') }}
1313
</h2>
1414

1515
@csrf
1616
{{ $this->form }}
1717

1818
<x-filament::button type="submit" class="w-full">
19-
{{ __('filament-two-factor-auth::Confirm') }}
19+
{{ __('Confirm') }}
2020
</x-filament::button>
2121
</form>
2222

resources/views/auth/password-reset.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class="relative z-10 flex flex-1 flex-col bg-white px-4 py-10 shadow-2xl sm:just
99
</a>
1010
</div>
1111
<h2 class="mt-20 text-lg font-semibold text-gray-900">
12-
{{ __('filament-two-factor-auth::Reset Password') }}
12+
{{ __('Reset Password') }}
1313
</h2>
1414

1515
<form method="POST" action="{{ route('password.update') }}" class="space-y-8">
@@ -18,7 +18,7 @@ class="relative z-10 flex flex-1 flex-col bg-white px-4 py-10 shadow-2xl sm:just
1818
{{ $this->form }}
1919

2020
<x-filament::button type="submit" class="w-full mt-4" color="info">
21-
{{ __('filament-two-factor-auth::Reset Password') }}
21+
{{ __('Reset Password') }}
2222
</x-filament::button>
2323
</form>
2424

resources/views/auth/request-password-reset.blade.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class="relative z-10 flex flex-1 flex-col bg-white px-4 py-10 shadow-2xl sm:just
99
</a>
1010
</div>
1111
<h2 class="mt-20 text-lg font-semibold text-gray-900">
12-
{{ __('filament-two-factor-auth::Reset Password') }}
12+
{{ __('Reset Password') }}
1313
</h2>
1414

1515
<form method="POST" action="{{ route('password.email') }}" class="space-y-8">
@@ -19,11 +19,11 @@ class="relative z-10 flex flex-1 flex-col bg-white px-4 py-10 shadow-2xl sm:just
1919
<div class="flex items-center justify-between">
2020
<x-filament::button color="secondary" class="w-full" type="button" tag="a" outlined
2121
href="{{ route('login') }}">
22-
{{ __('filament-two-factor-auth::Cancel')}}
22+
{{ __('Cancel')}}
2323
</x-filament::button>
2424

2525
<x-filament::button type="submit" class="w-full" color="info">
26-
{{ __('filament-two-factor-auth::Submit') }}
26+
{{ __('Submit') }}
2727
</x-filament::button>
2828

2929

resources/views/auth/verify-email.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
<x-filament::layouts.card title="{{__('filament-two-factor-auth::Verify')}}">
1+
<x-filament::layouts.card title="{{__('Verify')}}">
22
<div class="filament-fortify-verify-email-page">
33
<form method="POST" action="{{ route('verification.send') }}" class="space-y-8">
44

55
@csrf
66
<x-filament::button type="submit" class="w-full">
7-
{{ __('filament-two-factor-auth::Verifyl') }}
7+
{{ __('Verifyl') }}
88
</x-filament::button>
99
</form>
1010
</div>

resources/views/two-factor.blade.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
@if (!$showingRecoveryCodes && auth()->user()->two_factor_confirmed_at)
88
<p class="mt-1 text-sm leading-6 text-gray-600 mb-4">
9-
{{ __('filament-two-factor-auth::Your account has been secured with two factor authentication') }}.
9+
{{ __('Your account has been secured with two factor authentication') }}.
1010
</p>
1111
{{ $this->disableAction() }}
1212
@else
1313
<p class="mt-1 text-sm leading-6 text-gray-600 mb-4">
14-
{{ __('filament-two-factor-auth::Add additional security to your account using two factor authentication') }}.
14+
{{ __('Add additional security to your account using two factor authentication') }}.
1515
</p>
1616
@endif
1717
</div>
@@ -24,7 +24,7 @@
2424

2525

2626
<p class="text-sm">
27-
{{ __('filament-two-factor-auth::You have three options to confirm your identity, please choose one of the options below to continue') }}.
27+
{{ __('You have three options to confirm your identity, please choose one of the options below to continue') }}.
2828
</p>
2929
<hr class="my-4" />
3030

@@ -46,18 +46,18 @@
4646
<div>
4747
@unless ($showingQrCode)
4848
<div class="font-bold">
49-
{!! __('filament-two-factor-auth::Two-Factor Authentication enabled') !!}
49+
{!! __('Two-Factor Authentication enabled') !!}
5050
</div>
5151
@else
5252
<div class="font-bold">
53-
{!! __('filament-two-factor-auth::Or scan the QR code with your authenticator app') !!}.
53+
{!! __('Or scan the QR code with your authenticator app') !!}.
5454
</div>
5555
<div class="flex items-center justify-center mt-2">
5656
{!! auth()->user()->twoFactorQrCodeSvg() !!}
5757
</div>
5858
<br />
5959
<p class="text-sm">
60-
{!! __('filament-two-factor-auth::The secret key to setup the authenticator app is') !!}: <br />
60+
{!! __('The secret key to setup the authenticator app is') !!}: <br />
6161
<span
6262
class="font-bold mt-4">{{ decrypt(auth()->user()->two_factor_secret) }}</span>
6363
</p>

src/Http/Livewire/Auth/LoginTwoFactor.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function hasLogo(): bool
4545
public function resend(): ?Action
4646
{
4747
return Action::make('resend')
48-
->label(__('filament-two-factor-auth::Resend'))
48+
->label(__('Resend'))
4949
->color('info')
5050
->extraAttributes(['class' => 'w-full text-xs'])
5151
->link()
@@ -57,7 +57,7 @@ public function resend(): ?Action
5757
$this->challengedUser->notify(app(SendOTP::class));
5858

5959
Notification::make()
60-
->title(__('filament-two-factor-auth::Successfully resend the OTP code'))
60+
->title(__('Successfully resend the OTP code'))
6161
->success()
6262
->send();
6363
});
@@ -91,10 +91,10 @@ protected function getFormSchema(): array
9191
return [
9292
TextInput::make('code')
9393
->extraInputAttributes(['name' => 'code'])
94-
->label(__('filament-two-factor-auth::Code')),
94+
->label(__('Code')),
9595
TextInput::make('recovery_code')
9696
->extraInputAttributes(['name' => 'recovery_code'])
97-
->label(__('filament-two-factor-auth::Recovery code')),
97+
->label(__('Recovery code')),
9898

9999
];
100100
}

src/Http/Livewire/Auth/PasswordConfirmation.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ protected function getFormSchema(): array
3030
return [
3131
TextInput::make('password')
3232
->extraInputAttributes(['name' => 'password'])
33-
->label(__('filament-two-factor-auth::Password'))
33+
->label(__('Password'))
3434
->password()
3535
->required(),
3636
];
@@ -40,9 +40,9 @@ public function render(): View
4040
{
4141
return view('filament-two-factor-auth::auth.password-confirmation')
4242
->layout('filament::components.layouts.app', [
43-
'title' => __('filament-two-factor-auth::Password Confirmation'),
43+
'title' => __('Password Confirmation'),
4444
'breadcrumbs' => [
45-
__('filament-two-factor-auth::Password Confirmation'),
45+
__('Password Confirmation'),
4646
],
4747
]);
4848
}

src/TwoFactorAuthPlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function register(Panel $panel): void
2020
->userMenuItems([
2121
'two-factor-authentication' => MenuItem::make()
2222
->icon('heroicon-o-lock-closed')
23-
->label(__('filament-two-factor-auth::Two-Factor Authentication'))
23+
->label(__('Two-Factor Authentication'))
2424
->url(fn (): string => TwoFactor::getUrl()),
2525
])
2626
->pages([

src/TwoFactorAuthServiceProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public function configurePackage(Package $package): void
7575

7676
if (file_exists($package->basePath('/../resources/lang'))) {
7777
$package->hasTranslations();
78+
$this->loadJsonTranslationsFrom($package->basePath('/../resources/lang'));
7879
}
7980

8081
if (file_exists($package->basePath('/../resources/views'))) {

0 commit comments

Comments
 (0)