Skip to content

Commit 496f924

Browse files
committed
Refactor translations to use keyed strings
1 parent 792dc5e commit 496f924

64 files changed

Lines changed: 798 additions & 368 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/Console/Commands/CreateAdminUser.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ class CreateAdminUser extends Command
2828

2929
public function handle(): int
3030
{
31-
$name = $this->option('name') ?? $this->ask('Name');
32-
$email = $this->option('email') ?? $this->ask('Email');
31+
$name = $this->option('name') ?? $this->ask(__('general.name'));
32+
$email = $this->option('email') ?? $this->ask(__('general.email'));
3333
$password = $this->option('password');
3434

3535
if (! $password) {
36-
$password = $this->secret('Password');
36+
$password = $this->secret(__('general.password'));
3737
$confirm = $this->secret('Confirm Password');
3838

3939
if ($password !== $confirm) {

app/Enums/Permission.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ enum Permission: string
1111
public function getLabel(): string
1212
{
1313
return match ($this) {
14-
self::ManageApplicationSettings => __('Manage Application Settings'),
15-
self::ManageApplicationUsers => __('Manage Application Users'),
16-
self::ManageTenants => __('Manage Tenants'),
14+
self::ManageApplicationSettings => __('settings.manage_application_settings'),
15+
self::ManageApplicationUsers => __('user.manage_application_users'),
16+
self::ManageTenants => __('tenant.manage_tenants'),
1717
};
1818
}
1919
}

app/Enums/Role.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ enum Role: string
99
public function getLabel(): string
1010
{
1111
return match ($this) {
12-
self::Administrator => __('Administrator'),
12+
self::Administrator => __('general.administrator'),
1313
};
1414
}
1515
}

app/Enums/Tenant/Permission.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ enum Permission: string
1010
public function getLabel(): string
1111
{
1212
return match ($this) {
13-
self::ManageApplicationSettings => __('Manage Application Settings'),
14-
self::ManageApplicationUsers => __('Manage Application Users'),
13+
self::ManageApplicationSettings => __(__('settings.manage_application_settings')),
14+
self::ManageApplicationUsers => __(__('user.manage_application_users')),
1515
};
1616
}
1717
}

app/Enums/Tenant/Role.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ enum Role: string
1010
public function getLabel(): string
1111
{
1212
return match ($this) {
13-
self::CentralAdministrator => __('Central Administrator'),
14-
self::Administrator => __('Administrator'),
13+
self::CentralAdministrator => __('general.central_administrator'),
14+
self::Administrator => __('general.administrator'),
1515
};
1616
}
1717
}

app/Notifications/Tenant/UserInvitation.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ public function via(object $notifiable): array
3535
public function toMail(object $notifiable): MailMessage
3636
{
3737
return (new MailMessage)
38-
->greeting(__('Hello!'))
39-
->line(__('You have been invited to join').' '.config('app.name'))
40-
->line(__('Visit the link below and reset your password to log in.'))
38+
->greeting(__('general.hello'))
39+
->line(__('messages.you_have_been_invited_to_join').' '.config('app.name'))
40+
->line(__('messages.visit_link_to_reset_password'))
4141
->action('Visit application', $this->url);
4242
}
4343

app/Notifications/UserInvitation.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ public function via(object $notifiable): array
3535
public function toMail(object $notifiable): MailMessage
3636
{
3737
return (new MailMessage)
38-
->greeting(__('Hello!'))
39-
->line(__('You have been invited to join').' '.config('app.name'))
40-
->line(__('Visit the link below and reset your password to log in.'))
38+
->greeting(__('general.hello'))
39+
->line(__('messages.you_have_been_invited_to_join').' '.config('app.name'))
40+
->line(__('messages.visit_link_to_reset_password'))
4141
->action('Visit application', $this->url);
4242
}
4343

app/Providers/AppServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function boot(): void
3030
Model::preventLazyLoading(! app()->isProduction());
3131
Model::automaticallyEagerLoadRelationships();
3232

33-
// Implicitly grant "Administrator" role all permissions.
33+
// Implicitly grant __('general.administrator') role all permissions.
3434
// This works in the app by using gate-related functions like auth()->user->can() and @can()
3535
Gate::before(function (Authenticatable $user, $ability) {
3636
return $user?->hasRole([\App\Enums\Tenant\Role::CentralAdministrator, Role::Administrator]) ? true : null;

database/migrations/2025_09_06_203225_create_base_permissions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function up(): void
4242
if (! app()->environment('production')) {
4343
$admininistrator = User::create([
4444
'name' => 'Admini Strator',
45-
'email' => 'admin@example.com',
45+
'email' => __('forms.admin_example_com'),
4646
'password' => Hash::make('password'),
4747
'email_verified_at' => now(),
4848
]);

database/migrations/tenant/2025_09_06_203225_create_base_permissions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function up(): void
4545
// Seed your first administrator
4646
$admininistrator = User::create([
4747
'name' => 'Admin',
48-
'email' => 'admin@example.com',
48+
'email' => __('forms.admin_example_com'),
4949
'password' => Hash::make(Str::random(16)),
5050
'email_verified_at' => now(),
5151
]);

0 commit comments

Comments
 (0)