From 7ee3757a57b91ce014633bf79c94229dba93c6bc Mon Sep 17 00:00:00 2001 From: Sky Mulley Date: Mon, 23 Nov 2026 14:51:03 +0000 Subject: [PATCH] frontend translations --- .oxlintrc.json | 7 + app/Actions/Allocations/AssignAllocation.php | 2 +- app/Actions/Allocations/CreateAllocations.php | 2 +- .../Allocations/UnassignAllocation.php | 4 +- app/Actions/Api/CreateAccountApiKey.php | 2 +- .../Backups/GenerateBackupDownloadLink.php | 2 +- app/Actions/Backups/InitiateBackup.php | 2 +- app/Actions/Backups/RestoreBackup.php | 4 +- app/Actions/Databases/CreateDatabase.php | 2 +- .../Databases/DeployServerDatabase.php | 2 +- app/Actions/Eggs/Sharing/ImportCatalogEgg.php | 4 +- app/Actions/Schedules/CreateSchedule.php | 2 +- app/Actions/Schedules/CreateScheduleTask.php | 4 +- app/Actions/Schedules/ProcessSchedule.php | 4 +- app/Actions/Schedules/UpdateSchedule.php | 2 +- app/Actions/Schedules/UpdateScheduleTask.php | 2 +- app/Actions/Servers/ReinstallServer.php | 2 +- app/Actions/Servers/SendServerCommand.php | 2 +- .../Servers/ToggleServerInstallStatus.php | 2 +- .../Servers/ToggleServerSuspension.php | 2 +- app/Actions/Servers/UpdateServerBuild.php | 4 +- app/Actions/Tags/DeleteTag.php | 2 +- app/Actions/Tags/SyncTags.php | 2 +- app/Actions/Tags/UpdateTag.php | 2 +- app/Actions/Transfers/InitiateTransfer.php | 4 +- app/Actions/Users/DeleteUser.php | 2 +- app/Actions/Users/UpdateUserEmail.php | 2 +- .../Commands/Translations/CoverageCommand.php | 9 +- app/Data/EggCatalogEntry.php | 10 +- app/Data/EggImportData.php | 8 +- app/Exceptions/ApiErrorResponse.php | 4 +- .../Connection/DaemonConnectionException.php | 6 +- .../Http/Server/FileSizeTooLargeException.php | 2 +- .../Server/ServerStateConflictException.php | 12 +- .../Http/TwoFactorAuthRequiredException.php | 2 +- .../AutoAllocationNotEnabledException.php | 2 +- ...oAutoAllocationSpaceAvailableException.php | 2 +- .../Service/Backup/BackupLockedException.php | 2 +- .../Backup/TooManyBackupsException.php | 2 +- ...tabaseClientFeatureNotEnabledException.php | 2 +- .../NoSuitableDatabaseHostException.php | 2 +- .../Database/TooManyDatabasesException.php | 2 +- .../TwoFactorAuthenticationTokenInvalid.php | 2 +- app/Http/Concerns/ResolvesRequestContext.php | 2 +- .../DatabaseHosts/DatabaseHostController.php | 2 +- .../Api/Admin/Servers/DatabaseController.php | 2 +- .../Admin/Servers/ServerMountController.php | 2 +- .../Api/Admin/Settings/MailController.php | 2 +- .../Api/Admin/Users/UserController.php | 2 +- .../Api/Client/Servers/SettingsController.php | 2 +- .../Api/Client/Servers/StartupController.php | 2 +- .../Client/Servers/WebsocketController.php | 4 +- .../Api/Client/TwoFactorController.php | 2 +- .../Auth/LoginCheckpointController.php | 14 +- .../Api/Admin/AuthenticateAdmin.php | 4 +- .../AuthenticateApplicationUser.php | 2 +- .../AuthorizeExtensionApplicationRequest.php | 2 +- .../Middleware/Api/AuthenticateIPAccess.php | 6 +- .../Api/Client/RequireClientApiKey.php | 2 +- .../Client/Server/ResourceBelongsToServer.php | 2 +- app/Http/Middleware/Api/IsValidJson.php | 2 +- app/Http/Middleware/VerifyReCaptcha.php | 2 +- .../Servers/Backups/ViewBackupRequest.php | 2 +- .../Databases/StoreDatabaseRequest.php | 2 +- .../Servers/Subusers/DeleteSubuserRequest.php | 2 +- .../Servers/Subusers/SubuserRequest.php | 2 +- .../Concerns/ValidatesNodeAcceptsEgg.php | 7 +- app/Models/Permission.php | 130 +--- app/Notifications/AccountCreated.php | 11 +- app/Notifications/AddedToServer.php | 9 +- app/Notifications/MailTested.php | 6 +- app/Notifications/RemovedFromServer.php | 9 +- app/Notifications/SendPasswordReset.php | 8 +- app/Notifications/ServerInstalled.php | 9 +- app/Rules/DockerImageList.php | 4 +- app/Rules/ExtensionFieldValue.php | 2 +- app/Rules/Fqdn.php | 6 +- app/Rules/NotInPathHierarchy.php | 6 +- app/Rules/TagSlug.php | 2 +- app/Rules/UnreservedEnvironmentVariable.php | 2 +- app/Rules/UserEmail.php | 2 +- app/Rules/Username.php | 2 +- app/Rules/ValidExtensionSettingColor.php | 2 +- app/Rules/ValidExtensionSettingType.php | 8 +- app/Services/Eggs/EggCatalogService.php | 4 +- app/Services/Extensions/ExtensionFields.php | 2 +- packages/sdk/THEMES.md | 14 + packages/sdk/types/api/http.d.ts | 1 + packages/sdk/types/lib/dates.d.ts | 2 +- .../types/plugins/useNavigationBlocker.d.ts | 2 +- .../sdk/types/views/server/schedules.d.ts | 3 +- resources/lang/en.json | 599 +++++++++++++++++- resources/lang/en/admin/node.php | 18 - resources/lang/en/admin/server.php | 30 - resources/lang/en/admin/user.php | 14 - resources/lang/en/auth.php | 2 + resources/lang/en/dashboard/account.php | 30 - resources/lang/en/dashboard/index.php | 10 - resources/lang/en/exceptions.php | 105 +++ resources/lang/en/notifications.php | 51 ++ resources/lang/en/permissions.php | 101 +++ resources/lang/en/server/users.php | 35 - resources/lang/en/strings.php | 97 --- resources/lang/en/validation.php | 19 + .../scripts/api/account/api-keys/queries.ts | 9 +- resources/scripts/api/account/queries.ts | 19 +- .../scripts/api/account/ssh-keys/queries.ts | 9 +- .../scripts/api/account/two-factor/queries.ts | 9 +- resources/scripts/api/auth/queries.ts | 11 +- resources/scripts/api/http.ts | 54 +- .../scripts/api/server/backups/queries.ts | 17 +- .../scripts/api/server/databases/queries.ts | 19 +- resources/scripts/api/server/files/queries.ts | 50 +- .../scripts/api/server/network/queries.ts | 19 +- resources/scripts/api/server/power/queries.ts | 5 +- resources/scripts/api/server/queries.ts | 9 +- .../scripts/api/server/schedules/queries.ts | 29 +- .../scripts/api/server/startup/queries.ts | 7 +- resources/scripts/api/server/users/queries.ts | 7 +- .../components/admin/api/ApiKeyTable.tsx | 4 +- .../databases/DatabaseHostDetailContainer.tsx | 2 +- .../admin/databases/DatabaseHostTable.tsx | 2 +- .../admin/locations/LocationTable.tsx | 2 +- .../components/admin/nodes/NodeTable.tsx | 2 +- .../admin/servers/ServerManageTab.tsx | 4 +- .../admin/servers/ServerStartupTab.spec.tsx | 5 +- .../components/admin/servers/ServerTable.tsx | 2 +- .../components/admin/tags/helpers.spec.ts | 19 +- .../scripts/components/admin/tags/helpers.ts | 9 +- .../components/admin/users/UserTable.tsx | 2 +- .../components/elements/CodemirrorEditor.tsx | 45 +- .../components/elements/CopyOnClick.tsx | 17 +- .../components/elements/ErrorBoundary.tsx | 5 +- .../components/elements/PageFooter.tsx | 20 +- .../components/elements/PermissionRoute.tsx | 11 +- .../components/elements/ScreenBlock.tsx | 89 +-- .../components/elements/SecretInput.spec.tsx | 10 +- .../components/elements/SecretInput.tsx | 6 +- .../components/elements/SubNavigation.tsx | 6 +- .../elements/dialog/ConfirmationDialog.tsx | 8 +- .../components/elements/dialog/Dialog.tsx | 3 + .../elements/table/DataTableColumnHeader.tsx | 11 +- .../elements/table/PaginationFooter.tsx | 17 +- .../components/elements/table/RowActions.tsx | 25 +- resources/scripts/components/form/fields.tsx | 6 +- .../components/server/WebsocketHandler.tsx | 29 +- .../server/console/useConsoleSocketLogs.ts | 5 +- .../components/server/files/FileNameModal.tsx | 10 +- .../server/files/useFileUploader.ts | 3 +- resources/scripts/components/ui/Select.tsx | 30 +- .../scripts/extensions/ExtensionMount.tsx | 18 +- resources/scripts/i18n.ts | 4 + resources/scripts/lib/dates.ts | 2 +- resources/scripts/lib/dayjs.spec.ts | 26 + resources/scripts/lib/dayjs.ts | 27 + resources/scripts/lib/formatters.spec.ts | 16 +- resources/scripts/lib/formatters.ts | 15 +- resources/scripts/lib/serverStatus.ts | 8 +- .../plugins/useNavigationBlocker.spec.tsx | 4 +- .../scripts/plugins/useNavigationBlocker.ts | 6 +- resources/scripts/router/RouteError.tsx | 17 +- resources/scripts/router/routeTree.ts | 33 +- resources/scripts/sdk/table.tsx | 7 +- .../classic/views/account/AccountOverview.tsx | 15 +- .../classic/views/account/ApiKeyCreate.tsx | 29 +- .../classic/views/account/ApiKeyList.tsx | 36 +- .../classic/views/account/ApiKeysPage.tsx | 6 +- .../classic/views/account/AvatarCard.tsx | 16 +- .../views/account/DisableTwoFactorDialog.tsx | 15 +- .../classic/views/account/EmailCard.tsx | 12 +- .../classic/views/account/LanguageCard.tsx | 10 +- .../classic/views/account/PasswordCard.tsx | 21 +- .../views/account/RecoveryTokensDialog.tsx | 13 +- .../views/account/SetupTwoFactorDialog.tsx | 33 +- .../classic/views/account/SshKeyCreate.tsx | 14 +- .../classic/views/account/SshKeyList.tsx | 40 +- .../classic/views/account/SshKeysPage.tsx | 6 +- .../classic/views/account/TwoFactorCard.tsx | 18 +- .../views/activity/AccountActivityPage.tsx | 6 +- .../classic/views/activity/ActivityLog.tsx | 43 +- .../views/activity/ActivityLogEntry.tsx | 12 +- .../views/activity/ActivityMetadataButton.tsx | 10 +- .../views/activity/ServerActivityPage.tsx | 6 +- .../themes/classic/views/auth/AuthCard.tsx | 6 +- .../classic/views/auth/CheckpointPage.tsx | 19 +- .../classic/views/auth/ForgotPasswordPage.tsx | 13 +- .../classic/views/auth/PterodactylMark.tsx | 6 +- .../classic/views/auth/ResetPasswordPage.tsx | 17 +- .../classic/views/dashboard/Dashboard.tsx | 6 +- .../views/dashboard/ServerCardMetrics.tsx | 41 +- .../classic/views/dashboard/ServerList.tsx | 15 +- .../classic/views/layout/AdminLayout.tsx | 7 +- .../themes/classic/views/layout/AppLayout.tsx | 33 +- .../themes/classic/views/layout/Search.tsx | 21 +- .../classic/views/layout/ServerLayout.tsx | 8 +- .../classic/views/server/ServerConflict.tsx | 61 +- .../views/server/backups/BackupActions.tsx | 35 +- .../views/server/backups/BackupList.tsx | 43 +- .../views/server/backups/BackupsPage.tsx | 6 +- .../server/backups/CreateBackupButton.tsx | 37 +- .../views/server/console/ConsolePage.tsx | 19 +- .../classic/views/server/console/Graphs.tsx | 13 +- .../classic/views/server/console/Power.tsx | 17 +- .../classic/views/server/console/Stats.tsx | 56 +- .../classic/views/server/console/Terminal.tsx | 13 +- .../server/console/prompts/EulaPrompt.tsx | 33 +- .../server/console/prompts/GslTokenPrompt.tsx | 22 +- .../console/prompts/HytaleOauthPrompt.tsx | 15 +- .../console/prompts/JavaVersionPrompt.tsx | 17 +- .../server/console/prompts/PidLimitPrompt.tsx | 29 +- .../console/prompts/SteamDiskSpacePrompt.tsx | 24 +- .../views/server/console/prompts/parts.tsx | 20 +- .../views/server/databases/Databases.tsx | 146 +++-- .../views/server/databases/DatabasesPage.tsx | 6 +- .../views/server/files/Breadcrumbs.tsx | 4 +- .../views/server/files/FileDetails.tsx | 2 +- .../views/server/files/FileDialogs.tsx | 77 ++- .../views/server/files/FileEditorActions.tsx | 6 +- .../views/server/files/FileEditorNotice.tsx | 12 +- .../views/server/files/FileManagerList.tsx | 14 +- .../server/files/FileManagerSelection.tsx | 25 +- .../views/server/files/FileManagerToolbar.tsx | 7 +- .../classic/views/server/files/FileRows.tsx | 56 +- .../classic/views/server/files/FilesPage.tsx | 6 +- .../classic/views/server/files/Uploads.tsx | 24 +- .../views/server/network/Allocations.tsx | 48 +- .../views/server/network/NetworkPage.tsx | 6 +- .../views/server/schedules/NewTaskButton.tsx | 6 +- .../server/schedules/ScheduleCheatsheet.tsx | 42 +- .../server/schedules/ScheduleCronRow.tsx | 14 +- .../server/schedules/ScheduleDetailPage.tsx | 6 +- .../server/schedules/ScheduleDetails.tsx | 54 +- .../views/server/schedules/ScheduleDialog.tsx | 44 +- .../views/server/schedules/ScheduleList.tsx | 41 +- .../views/server/schedules/ScheduleTasks.tsx | 61 +- .../views/server/schedules/SchedulesPage.tsx | 6 +- .../views/server/schedules/TaskDialog.tsx | 31 +- .../views/server/settings/ServerDebug.tsx | 10 +- .../views/server/settings/ServerReinstall.tsx | 27 +- .../views/server/settings/ServerRename.tsx | 11 +- .../views/server/settings/ServerSftp.tsx | 14 +- .../views/server/settings/SettingsPage.tsx | 6 +- .../views/server/startup/StartupCommand.tsx | 8 +- .../views/server/startup/StartupImage.tsx | 16 +- .../views/server/startup/StartupPage.tsx | 6 +- .../views/server/startup/StartupVariables.tsx | 13 +- .../views/server/users/CreateSubuserPage.tsx | 8 +- .../views/server/users/SubuserForm.tsx | 44 +- .../views/server/users/SubuserList.tsx | 46 +- .../classic/views/server/users/UsersPage.tsx | 6 +- resources/scripts/views/a11y.tsx | 5 +- resources/scripts/views/account/keys.ts | 9 +- resources/scripts/views/account/overview.ts | 25 +- resources/scripts/views/auth/captcha.ts | 6 +- resources/scripts/views/auth/login.ts | 10 +- resources/scripts/views/auth/password.ts | 9 +- resources/scripts/views/boot.tsx | 18 +- resources/scripts/views/definitions.ts | 29 +- resources/scripts/views/layouts.ts | 28 +- resources/scripts/views/search.ts | 22 +- resources/scripts/views/server/backups.ts | 11 +- resources/scripts/views/server/databases.ts | 13 +- .../scripts/views/server/schedules.spec.tsx | 4 +- resources/scripts/views/server/schedules.ts | 37 +- .../scripts/views/server/settings.spec.tsx | 4 +- resources/scripts/views/server/settings.ts | 9 +- resources/scripts/views/server/users.ts | 15 +- .../notifications/email-plain.blade.php | 4 +- .../vendor/notifications/email.blade.php | 11 +- .../api/admin/servers.store.tag-check.json | 2 +- .../servers/startup.update.tag-check.json | 2 +- .../Actions/Users/DeleteUserTest.php | 2 +- .../Admin/Servers/ServerManagementTest.php | 2 +- .../Api/Admin/Servers/ServerTagCheckTest.php | 3 + .../Servers/ServerManagementTest.php | 4 +- .../Client/Server/SettingsControllerTest.php | 2 +- .../Translations/LanguagePackTest.php | 11 + tests/Unit/Lang/TranslationKeysTest.php | 85 +++ tools/oxlint/rules/index.ts | 2 + tools/oxlint/rules/lint.spec.ts | 23 + tools/oxlint/rules/rules/no-literal-text.ts | 85 +++ 281 files changed, 3239 insertions(+), 1662 deletions(-) delete mode 100644 resources/lang/en/admin/node.php delete mode 100644 resources/lang/en/admin/server.php delete mode 100644 resources/lang/en/admin/user.php delete mode 100644 resources/lang/en/dashboard/account.php delete mode 100644 resources/lang/en/dashboard/index.php create mode 100644 resources/lang/en/notifications.php create mode 100644 resources/lang/en/permissions.php delete mode 100644 resources/lang/en/server/users.php delete mode 100644 resources/lang/en/strings.php create mode 100644 resources/scripts/lib/dayjs.spec.ts create mode 100644 tests/Unit/Lang/TranslationKeysTest.php create mode 100644 tools/oxlint/rules/rules/no-literal-text.ts diff --git a/.oxlintrc.json b/.oxlintrc.json index 56a300066..ddecb8692 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -317,6 +317,13 @@ "rules/literal-translation-keys": "error" } }, + { + "files": ["resources/scripts/**"], + "excludeFiles": ["**/generated/**", "**/*.spec.{ts,tsx}", "resources/scripts/sdk/testing.tsx"], + "rules": { + "rules/no-literal-text": "error" + } + }, { // ESTree literals are discriminated only by the runtime type of `value`; this helper is that decoder. "files": ["tools/oxlint/rules/shared/literals.ts"], diff --git a/app/Actions/Allocations/AssignAllocation.php b/app/Actions/Allocations/AssignAllocation.php index ca2ddfaf9..2f91ca20b 100644 --- a/app/Actions/Allocations/AssignAllocation.php +++ b/app/Actions/Allocations/AssignAllocation.php @@ -18,7 +18,7 @@ final readonly class AssignAllocation implements AssignsAllocations public function assign(Server $server): Allocation { return DB::transaction(function () use ($server): Allocation { - throw_if($server->allocations()->lockForUpdate()->count() >= $server->allocation_limit, DisplayException::class, 'Cannot assign additional allocations to this server: limit has been reached.'); + throw_if($server->allocations()->lockForUpdate()->count() >= $server->allocation_limit, DisplayException::class, __('exceptions.allocations.limit_reached')); return $this->assignable->assignAvailable($server); }); diff --git a/app/Actions/Allocations/CreateAllocations.php b/app/Actions/Allocations/CreateAllocations.php index c32a844cc..08c07cf10 100644 --- a/app/Actions/Allocations/CreateAllocations.php +++ b/app/Actions/Allocations/CreateAllocations.php @@ -83,7 +83,7 @@ final readonly class CreateAllocations implements CreatesAllocations } catch (Exception $exception) { report($exception); - throw new DisplayException("Could not parse provided allocation IP address ({$underlying}): {$exception->getMessage()}", $exception); + throw new DisplayException(__('exceptions.allocations.invalid_ip', ['ip' => $underlying, 'error' => $exception->getMessage()]), $exception); } DB::transaction(function () use ($node, $ports, $alias, $parsed): void { diff --git a/app/Actions/Allocations/UnassignAllocation.php b/app/Actions/Allocations/UnassignAllocation.php index 6136ce0d6..fe2f05192 100644 --- a/app/Actions/Allocations/UnassignAllocation.php +++ b/app/Actions/Allocations/UnassignAllocation.php @@ -14,8 +14,8 @@ final class UnassignAllocation implements UnassignsAllocations { public function unassign(Server $server, Allocation $allocation): Allocation { - throw_if(empty($server->allocation_limit), DisplayException::class, 'You cannot delete allocations for this server: no allocation limit is set.'); - throw_if($allocation->id === $server->allocation_id, DisplayException::class, 'You cannot delete the primary allocation for this server.'); + throw_if(empty($server->allocation_limit), DisplayException::class, __('exceptions.allocations.no_limit_set')); + throw_if($allocation->id === $server->allocation_id, DisplayException::class, __('exceptions.allocations.delete_primary')); Allocation::query()->where('id', $allocation->id)->update([ 'notes' => null, diff --git a/app/Actions/Api/CreateAccountApiKey.php b/app/Actions/Api/CreateAccountApiKey.php index 3e7772099..d0664401d 100644 --- a/app/Actions/Api/CreateAccountApiKey.php +++ b/app/Actions/Api/CreateAccountApiKey.php @@ -38,7 +38,7 @@ final readonly class CreateAccountApiKey implements CreatesAccountApiKeys $token = DB::transaction(function () use ($user, $description, $allowedIps): NewAccessToken { $user = User::query()->lockForUpdate()->findOrFail($user->id); - throw_if($user->apiKeys()->count() >= 25, DisplayException::class, 'You have reached the account limit for number of API keys.'); + throw_if($user->apiKeys()->count() >= 25, DisplayException::class, __('exceptions.account.api_key_limit')); return $user->createToken($description, $allowedIps); }); diff --git a/app/Actions/Backups/GenerateBackupDownloadLink.php b/app/Actions/Backups/GenerateBackupDownloadLink.php index 2e3e639cf..03f2a7028 100644 --- a/app/Actions/Backups/GenerateBackupDownloadLink.php +++ b/app/Actions/Backups/GenerateBackupDownloadLink.php @@ -21,7 +21,7 @@ final readonly class GenerateBackupDownloadLink implements GeneratesBackupDownlo public function generate(Backup $backup, User $user): string { - throw_if($backup->disk !== Backup::ADAPTER_AWS_S3 && $backup->disk !== Backup::ADAPTER_WINGS, BadRequestHttpException::class, 'The backup requested references an unknown disk driver type and cannot be downloaded.'); + throw_if($backup->disk !== Backup::ADAPTER_AWS_S3 && $backup->disk !== Backup::ADAPTER_WINGS, BadRequestHttpException::class, __('exceptions.backups.unknown_disk')); if ($backup->disk === Backup::ADAPTER_AWS_S3) { return $this->getS3BackupUrl($backup); diff --git a/app/Actions/Backups/InitiateBackup.php b/app/Actions/Backups/InitiateBackup.php index 66703a6f2..a2e0766b7 100644 --- a/app/Actions/Backups/InitiateBackup.php +++ b/app/Actions/Backups/InitiateBackup.php @@ -73,7 +73,7 @@ final class InitiateBackup implements InitiatesBackups ->lockForUpdate() ->count(); if ($previousCount >= $limit) { - $message = sprintf('Only %d backups may be generated within a %d second span of time.', $limit, $period); + $message = __('exceptions.backups.throttled', ['limit' => $limit, 'period' => $period]); $latest = $server->backups() ->withTrashed() ->nonFailed() diff --git a/app/Actions/Backups/RestoreBackup.php b/app/Actions/Backups/RestoreBackup.php index 5661f3052..e6ef89f6b 100644 --- a/app/Actions/Backups/RestoreBackup.php +++ b/app/Actions/Backups/RestoreBackup.php @@ -34,8 +34,8 @@ final readonly class RestoreBackup implements RestoresBackups public function restore(Server $server, Backup $backup, User $user, bool $truncate): void { - throw_if(($server->status) !== null, BadRequestHttpException::class, 'This server is not currently in a state that allows for a backup to be restored.'); - throw_if(! $backup->is_successful || ($backup->completed_at) === null, BadRequestHttpException::class, 'This backup cannot be restored at this time: not completed or failed.'); + throw_if(($server->status) !== null, BadRequestHttpException::class, __('exceptions.backups.restore_unavailable')); + throw_if(! $backup->is_successful || ($backup->completed_at) === null, BadRequestHttpException::class, __('exceptions.backups.restore_incomplete')); DB::transaction(function () use ($server, $backup, $user, $truncate): void { $url = $backup->disk === Backup::ADAPTER_AWS_S3 diff --git a/app/Actions/Databases/CreateDatabase.php b/app/Actions/Databases/CreateDatabase.php index ff92b84a9..c2eb2708c 100644 --- a/app/Actions/Databases/CreateDatabase.php +++ b/app/Actions/Databases/CreateDatabase.php @@ -131,7 +131,7 @@ final class CreateDatabase implements CreatesDatabases ->where('database', $data['database']) ->exists(); - throw_if($exists, DuplicateDatabaseNameException::class, 'A database with that name already exists for this server.'); + throw_if($exists, DuplicateDatabaseNameException::class, __('exceptions.databases.name_exists')); $database = (new Database)->forceFill($data); $database->saveOrFail(); diff --git a/app/Actions/Databases/DeployServerDatabase.php b/app/Actions/Databases/DeployServerDatabase.php index 67ee511f0..78bbf95fd 100644 --- a/app/Actions/Databases/DeployServerDatabase.php +++ b/app/Actions/Databases/DeployServerDatabase.php @@ -41,7 +41,7 @@ final readonly class DeployServerDatabase implements DeploysServerDatabases $validated = Validator::make($input, self::rules())->safe(); return DB::transaction(function () use ($server, $validated): Database { - throw_if($server->databases()->lockForUpdate()->count() >= $server->database_limit, DisplayException::class, 'Cannot create additional databases on this server: limit has been reached.'); + throw_if($server->databases()->lockForUpdate()->count() >= $server->database_limit, DisplayException::class, __('exceptions.databases.limit_reached')); $hosts = DatabaseHost::query()->get()->toBase(); throw_if($hosts->isEmpty(), NoSuitableDatabaseHostException::class); diff --git a/app/Actions/Eggs/Sharing/ImportCatalogEgg.php b/app/Actions/Eggs/Sharing/ImportCatalogEgg.php index 79a285508..fc3c0744e 100644 --- a/app/Actions/Eggs/Sharing/ImportCatalogEgg.php +++ b/app/Actions/Eggs/Sharing/ImportCatalogEgg.php @@ -30,12 +30,12 @@ final readonly class ImportCatalogEgg implements ImportsCatalogEggs try { $parsed = EggImportData::fromJson($contents); } catch (JsonException|UnexpectedValueException|InvalidFileUploadException $exception) { - throw new HttpException(502, 'The selected catalog egg contains an invalid definition.', $exception); + throw new HttpException(502, __('exceptions.egg.catalog.invalid_definition'), $exception); } return $this->importer->importParsed($parsed); } - throw new NotFoundHttpException('The selected egg is no longer in the Pterodactyl catalog. Refresh the catalog and try again.'); + throw new NotFoundHttpException(__('exceptions.egg.catalog.egg_missing')); } } diff --git a/app/Actions/Schedules/CreateSchedule.php b/app/Actions/Schedules/CreateSchedule.php index d2e93bd69..85e4a7d1f 100644 --- a/app/Actions/Schedules/CreateSchedule.php +++ b/app/Actions/Schedules/CreateSchedule.php @@ -47,7 +47,7 @@ final class CreateSchedule implements CreatesSchedules try { $schedule->next_run_at = $schedule->getNextRunDate(); } catch (Throwable) { - throw new DisplayException('The cron data provided does not evaluate to a valid expression.'); + throw new DisplayException(__('exceptions.schedules.invalid_cron')); } $schedule->save(); diff --git a/app/Actions/Schedules/CreateScheduleTask.php b/app/Actions/Schedules/CreateScheduleTask.php index b63892131..9588e9e0c 100644 --- a/app/Actions/Schedules/CreateScheduleTask.php +++ b/app/Actions/Schedules/CreateScheduleTask.php @@ -40,7 +40,7 @@ final readonly class CreateScheduleTask implements CreatesScheduleTasks public function create(Schedule $schedule, array $input): Task { $validated = Validator::make($input, self::rules(($input['action'] ?? null) === Task::ACTION_POWER))->safe(); - throw_if($validated['action'] === Task::ACTION_BACKUP && $schedule->server->backup_limit === 0, HttpForbiddenException::class, "A backup task cannot be created when the server's backup limit is set to 0."); + throw_if($validated['action'] === Task::ACTION_BACKUP && $schedule->server->backup_limit === 0, HttpForbiddenException::class, __('exceptions.schedules.backup_limit_zero')); $attributes = [ 'action' => $validated['action'], @@ -54,7 +54,7 @@ final readonly class CreateScheduleTask implements CreatesScheduleTasks $task = DB::transaction(function () use ($schedule, $attributes, $requested): Task { $schedule = $schedule->newQuery()->whereKey($schedule->getKey())->lockForUpdate()->firstOrFail(); $limit = config('pterodactyl.client_features.schedules.per_schedule_task_limit'); - throw_if($schedule->tasks()->count() >= $limit, ServiceLimitExceededException::class, "Schedules may not have more than $limit tasks associated with them. Creating this task would put this schedule over the limit."); + throw_if($schedule->tasks()->count() >= $limit, ServiceLimitExceededException::class, __('exceptions.schedules.too_many_tasks', ['limit' => $limit])); $next = ($schedule->tasks()->orderByDesc('sequence_id')->first()->sequence_id ?? 0) + 1; $requested ??= $next; diff --git a/app/Actions/Schedules/ProcessSchedule.php b/app/Actions/Schedules/ProcessSchedule.php index 53df4c86b..39652e6f1 100644 --- a/app/Actions/Schedules/ProcessSchedule.php +++ b/app/Actions/Schedules/ProcessSchedule.php @@ -87,10 +87,10 @@ final readonly class ProcessSchedule implements ProcessesSchedules { return DB::transaction(function () use ($schedule, $now): array { $claimed = Schedule::query()->without('tasks')->lockForUpdate()->findOrFail($schedule->id); - throw_if($claimed->is_processing, DisplayException::class, 'This schedule is already being processed.'); + throw_if($claimed->is_processing, DisplayException::class, __('exceptions.schedules.already_processing')); $task = $claimed->tasks()->orderBy('sequence_id')->first(); - throw_if($task === null, DisplayException::class, 'Cannot process schedule for task execution: no tasks are registered.'); + throw_if($task === null, DisplayException::class, __('exceptions.schedules.no_tasks')); $run = ['job' => new RunTaskJob($task->setRelation('schedule', $claimed), $now), 'next_run_at' => $claimed->next_run_at, 'last_run_at' => $claimed->last_run_at]; $claimed->forceFill(['is_processing' => true, 'next_run_at' => $claimed->getNextRunDate()])->saveOrFail(); diff --git a/app/Actions/Schedules/UpdateSchedule.php b/app/Actions/Schedules/UpdateSchedule.php index 5f31ef4e3..dc9cff066 100644 --- a/app/Actions/Schedules/UpdateSchedule.php +++ b/app/Actions/Schedules/UpdateSchedule.php @@ -31,7 +31,7 @@ final class UpdateSchedule implements UpdatesSchedules try { $schedule->next_run_at = $schedule->getNextRunDate(); } catch (Throwable) { - throw new DisplayException('The cron data provided does not evaluate to a valid expression.'); + throw new DisplayException(__('exceptions.schedules.invalid_cron')); } // A schedule switched on or off is no longer mid-run. diff --git a/app/Actions/Schedules/UpdateScheduleTask.php b/app/Actions/Schedules/UpdateScheduleTask.php index 87c212472..5155fb247 100644 --- a/app/Actions/Schedules/UpdateScheduleTask.php +++ b/app/Actions/Schedules/UpdateScheduleTask.php @@ -17,7 +17,7 @@ final readonly class UpdateScheduleTask implements UpdatesScheduleTasks public function update(Schedule $schedule, Task $task, array $input): Task { $validated = Validator::make($input, CreateScheduleTask::rules(($input['action'] ?? null) === Task::ACTION_POWER))->safe(); - throw_if($validated['action'] === Task::ACTION_BACKUP && $schedule->server->backup_limit === 0, HttpForbiddenException::class, "A backup task cannot be created when the server's backup limit is set to 0."); + throw_if($validated['action'] === Task::ACTION_BACKUP && $schedule->server->backup_limit === 0, HttpForbiddenException::class, __('exceptions.schedules.backup_limit_zero')); $attributes = [ 'action' => $validated['action'], diff --git a/app/Actions/Servers/ReinstallServer.php b/app/Actions/Servers/ReinstallServer.php index b194e17fe..ee54ad3c2 100644 --- a/app/Actions/Servers/ReinstallServer.php +++ b/app/Actions/Servers/ReinstallServer.php @@ -15,7 +15,7 @@ final readonly class ReinstallServer implements ReinstallsServers { public function reinstall(Server $server): Server { - throw_unless($server->canBeReinstalled(), DisplayException::class, trans('admin/server.exceptions.skipping_install_script')); + throw_unless($server->canBeReinstalled(), DisplayException::class, __('exceptions.server.skipping_install_script')); DB::transaction(function () use ($server): void { $server->fill(['status' => Server::STATUS_INSTALLING])->save(); diff --git a/app/Actions/Servers/SendServerCommand.php b/app/Actions/Servers/SendServerCommand.php index 6b185a19a..ab8051e46 100644 --- a/app/Actions/Servers/SendServerCommand.php +++ b/app/Actions/Servers/SendServerCommand.php @@ -19,7 +19,7 @@ final readonly class SendServerCommand implements SendsServerCommands try { Daemon::server($server)->commands($command); } catch (DaemonConnectionException $daemonConnectionException) { - throw_if($daemonConnectionException->getStatusCode() === Response::HTTP_BAD_GATEWAY, HttpException::class, Response::HTTP_BAD_GATEWAY, 'Server must be online in order to send commands.', $daemonConnectionException); + throw_if($daemonConnectionException->getStatusCode() === Response::HTTP_BAD_GATEWAY, HttpException::class, Response::HTTP_BAD_GATEWAY, __('exceptions.server.offline_command'), $daemonConnectionException); throw $daemonConnectionException; } diff --git a/app/Actions/Servers/ToggleServerInstallStatus.php b/app/Actions/Servers/ToggleServerInstallStatus.php index e495050be..fc1162bc7 100644 --- a/app/Actions/Servers/ToggleServerInstallStatus.php +++ b/app/Actions/Servers/ToggleServerInstallStatus.php @@ -13,7 +13,7 @@ final readonly class ToggleServerInstallStatus implements TogglesServerInstallSt public function toggle(Server $server): void { if ($server->status === Server::STATUS_INSTALL_FAILED) { - throw new DisplayException(trans('admin/server.exceptions.marked_as_failed')); + throw new DisplayException(__('exceptions.server.marked_as_failed')); } $server->forceFill([ diff --git a/app/Actions/Servers/ToggleServerSuspension.php b/app/Actions/Servers/ToggleServerSuspension.php index 291635d5f..f0d441229 100644 --- a/app/Actions/Servers/ToggleServerSuspension.php +++ b/app/Actions/Servers/ToggleServerSuspension.php @@ -29,7 +29,7 @@ final readonly class ToggleServerSuspension implements TogglesServerSuspension } // A transfer can race with Wings state synchronization, so reject it first. - throw_if($server->transfer !== null, ConflictHttpException::class, 'Cannot toggle suspension status on a server that is currently being transferred.'); + throw_if($server->transfer !== null, ConflictHttpException::class, __('exceptions.server.transfer_suspension')); $server->update(['status' => $isSuspending ? Server::STATUS_SUSPENDED : null]); try { diff --git a/app/Actions/Servers/UpdateServerBuild.php b/app/Actions/Servers/UpdateServerBuild.php index fab7c9b8b..d279fbf74 100644 --- a/app/Actions/Servers/UpdateServerBuild.php +++ b/app/Actions/Servers/UpdateServerBuild.php @@ -78,7 +78,7 @@ final readonly class UpdateServerBuild implements UpdatesServerBuild if (isset($attributes['allocation_id']) && $attributes['allocation_id'] !== $server->allocation_id) { $allocationExists = Allocation::query()->where('id', $attributes['allocation_id']) ->where('server_id', $server->id)->exists(); - throw_if(! $allocationExists, DisplayException::class, 'The requested default allocation is not currently assigned to this server.'); + throw_if(! $allocationExists, DisplayException::class, __('exceptions.server.default_allocation_not_assigned')); } $server->forceFill($attributes)->saveOrFail(); @@ -122,7 +122,7 @@ final readonly class UpdateServerBuild implements UpdatesServerBuild if ($remove !== []) { foreach ($remove as $allocation) { if ($allocation === ($attributes['allocation_id'] ?? $server->allocation_id)) { - throw_if(empty($freshlyAllocated), DisplayException::class, 'You are attempting to delete the default allocation for this server but there is no fallback allocation to use.'); + throw_if(empty($freshlyAllocated), DisplayException::class, __('exceptions.server.no_new_default_allocation')); $attributes['allocation_id'] = $freshlyAllocated; } } diff --git a/app/Actions/Tags/DeleteTag.php b/app/Actions/Tags/DeleteTag.php index 553bf5340..2999839f8 100644 --- a/app/Actions/Tags/DeleteTag.php +++ b/app/Actions/Tags/DeleteTag.php @@ -15,7 +15,7 @@ final readonly class DeleteTag implements DeletesTags { // The cascading pivot cleanup would discard every egg and node assignment of a built-in // tag, and recreating the tag later cannot restore them. - throw_if(EggSpecificTags::isSpecial($tag->slug), DisplayException::class, 'Built-in game tags cannot be deleted.'); + throw_if(EggSpecificTags::isSpecial($tag->slug), DisplayException::class, __('exceptions.tags.builtin_delete')); $tag->delete(); } diff --git a/app/Actions/Tags/SyncTags.php b/app/Actions/Tags/SyncTags.php index 7f1305759..949882559 100644 --- a/app/Actions/Tags/SyncTags.php +++ b/app/Actions/Tags/SyncTags.php @@ -66,7 +66,7 @@ final readonly class SyncTags implements SyncsTags // A node holds each tag either as a game or as a reservation, never both. $clashing = $otherKind?->whereKey($resolved->modelKeys())->pluck('tags.name') ?? collect(); if ($clashing->isNotEmpty()) { - throw ValidationException::withMessages(['tags' => "These tags are already on the node as the other kind: {$clashing->implode(', ')}."]); + throw ValidationException::withMessages(['tags' => __('exceptions.tags.kind_clash', ['tags' => $clashing->implode(', ')])]); } $tags->sync($resolved); diff --git a/app/Actions/Tags/UpdateTag.php b/app/Actions/Tags/UpdateTag.php index 019a6e30a..77199069a 100644 --- a/app/Actions/Tags/UpdateTag.php +++ b/app/Actions/Tags/UpdateTag.php @@ -17,7 +17,7 @@ final readonly class UpdateTag implements UpdatesTags { // Feature gating matches on a built-in tag's slug and EggSpecificTags owns its // presentation, so it is never renamed or relabelled. - throw_if(EggSpecificTags::isSpecial($tag->slug), DisplayException::class, 'Built-in game tags cannot be edited.'); + throw_if(EggSpecificTags::isSpecial($tag->slug), DisplayException::class, __('exceptions.tags.builtin_edit')); // Nor may a custom tag take a built-in slug and become one. $rules = CreateTag::rules($tag); diff --git a/app/Actions/Transfers/InitiateTransfer.php b/app/Actions/Transfers/InitiateTransfer.php index 878848974..98874a3d9 100644 --- a/app/Actions/Transfers/InitiateTransfer.php +++ b/app/Actions/Transfers/InitiateTransfer.php @@ -77,7 +77,7 @@ final readonly class InitiateTransfer implements InitiatesTransfers $transfer = DB::transaction(function () use ($server, $node, $allocationId, $additionalAllocations): ServerTransfer { $server = $server->newQuery()->whereKey($server->getKey())->lockForUpdate()->firstOrFail(); - throw_unless($node->isViable($server->memory, $server->disk), DisplayException::class, trans('admin/server.alerts.transfer_not_viable')); + throw_unless($node->isViable($server->memory, $server->disk), DisplayException::class, __('exceptions.server.transfer_not_viable')); $server->validateTransferState(); $allocationIds = array_values(array_unique([$allocationId, ...$additionalAllocations])); @@ -89,7 +89,7 @@ final readonly class InitiateTransfer implements InitiatesTransfers ->lockForUpdate() ->get(); - throw_unless($allocations->count() === count($allocationIds), DisplayException::class, 'The selected allocations are no longer available on the target node.'); + throw_unless($allocations->count() === count($allocationIds), DisplayException::class, __('exceptions.server.transfer_allocations_unavailable')); $transfer = ServerTransfer::query()->create([ 'server_id' => $server->id, diff --git a/app/Actions/Users/DeleteUser.php b/app/Actions/Users/DeleteUser.php index 5becd0867..084901647 100644 --- a/app/Actions/Users/DeleteUser.php +++ b/app/Actions/Users/DeleteUser.php @@ -13,7 +13,7 @@ final class DeleteUser implements DeletesUsers public function delete(User $user): ?bool { if ($user->servers()->exists()) { - throw new DisplayException(trans('admin/user.exceptions.user_has_servers')); + throw new DisplayException(__('exceptions.users.has_servers')); } return $user->delete(); diff --git a/app/Actions/Users/UpdateUserEmail.php b/app/Actions/Users/UpdateUserEmail.php index 73a2d05c1..4d12d9b82 100644 --- a/app/Actions/Users/UpdateUserEmail.php +++ b/app/Actions/Users/UpdateUserEmail.php @@ -21,7 +21,7 @@ final readonly class UpdateUserEmail implements UpdatesUserEmails public function update(User $user, string $email): array { - throw_if(RateLimiter::tooManyAttempts($key = $this->throttleKey($user), self::THROTTLE_MAX), TooManyRequestsHttpException::class, 'Your email address has been changed too many times today. Please try again later.'); + throw_if(RateLimiter::tooManyAttempts($key = $this->throttleKey($user), self::THROTTLE_MAX), TooManyRequestsHttpException::class, null, __('exceptions.users.email_change_throttled')); $original = $user->email; if (mb_strtolower($original) === mb_strtolower($email)) { diff --git a/app/Console/Commands/Translations/CoverageCommand.php b/app/Console/Commands/Translations/CoverageCommand.php index 30790e448..f0b2e2ee0 100644 --- a/app/Console/Commands/Translations/CoverageCommand.php +++ b/app/Console/Commands/Translations/CoverageCommand.php @@ -10,6 +10,7 @@ use Illuminate\Console\Command; use Pterodactyl\Services\Extensions\ExtensionManifest; use Pterodactyl\Services\Translations\LanguageRegistry; use Pterodactyl\Services\Translations\TranslationCoverage; +use Symfony\Component\Console\Formatter\OutputFormatter; #[Description('Compare a locale with the English translations: missing and stale keys, placeholder mistakes and conflicts between language packs.')] #[Signature('p:lang:coverage @@ -75,7 +76,8 @@ class CoverageCommand extends Command { $lines = []; foreach ($placeholders as $key => $names) { - $lines[] = $key.': '.implode(', ', array_map(fn (string $name): string => ':'.$name, $names)); + $json = str_starts_with($key, LanguageRegistry::JSON_PREFIX); + $lines[] = $key.': '.implode(', ', array_map(fn (string $name): string => $json ? '{{'.$name.'}}' : ':'.$name, $names)); } return $lines; @@ -92,6 +94,9 @@ class CoverageCommand extends Command $this->newLine(); $this->components->twoColumnDetail("{$title}", (string) count($lines)); - $this->components->bulletList($lines); + // bulletList() strips trailing punctuation, which is part of a JSON key. + foreach ($lines as $line) { + $this->line(' ⇂ '.OutputFormatter::escape($line)); + } } } diff --git a/app/Data/EggCatalogEntry.php b/app/Data/EggCatalogEntry.php index 5cdf39bc2..2e74c915e 100644 --- a/app/Data/EggCatalogEntry.php +++ b/app/Data/EggCatalogEntry.php @@ -25,10 +25,10 @@ final readonly class EggCatalogEntry try { $data = json_decode($contents, true, flags: JSON_THROW_ON_ERROR); } catch (JsonException $jsonException) { - throw new HttpException(502, 'Pterodactyl returned an invalid egg catalog. Please try again later.', $jsonException); + throw new HttpException(502, __('exceptions.egg.catalog.invalid_catalog'), $jsonException); } - throw_unless(is_array($data) && array_is_list($data), HttpException::class, 502, 'Pterodactyl returned an invalid egg catalog. Please try again later.'); + throw_unless(is_array($data) && array_is_list($data), HttpException::class, 502, __('exceptions.egg.catalog.invalid_catalog')); $entries = []; foreach ($data as $value) { @@ -38,7 +38,7 @@ final readonly class EggCatalogEntry } } - throw_if($data !== [] && $entries === [], HttpException::class, 502, 'Pterodactyl returned an invalid egg catalog. Please try again later.'); + throw_if($data !== [] && $entries === [], HttpException::class, 502, __('exceptions.egg.catalog.invalid_catalog')); return $entries; } @@ -64,12 +64,12 @@ final readonly class EggCatalogEntry try { $uri = new Uri($this->downloadUrl); } catch (InvalidArgumentException $invalidArgumentException) { - throw new HttpException(502, 'The catalog egg has an invalid download URL.', $invalidArgumentException); + throw new HttpException(502, __('exceptions.egg.catalog.invalid_download_url'), $invalidArgumentException); } throw_if($uri->getScheme() !== 'https' || $uri->getHost() !== 'raw.githubusercontent.com' || ! str_starts_with($uri->getPath(), '/pterodactyl/') || $uri->getUserInfo() !== '' - || $uri->getPort() !== null || $uri->getQuery() !== '' || $uri->getFragment() !== '', HttpException::class, 502, 'The catalog egg does not have an official Pterodactyl download URL.'); + || $uri->getPort() !== null || $uri->getQuery() !== '' || $uri->getFragment() !== '', HttpException::class, 502, __('exceptions.egg.catalog.unofficial_download_url')); return $uri->__toString(); } diff --git a/app/Data/EggImportData.php b/app/Data/EggImportData.php index 2b9eac230..13dcd36a6 100644 --- a/app/Data/EggImportData.php +++ b/app/Data/EggImportData.php @@ -49,10 +49,10 @@ final readonly class EggImportData */ public static function fromFile(UploadedFile $file): self { - throw_if($file->getError() !== UPLOAD_ERR_OK || ! $file->isFile(), InvalidFileUploadException::class, 'The selected file is not valid and cannot be imported.'); + throw_if($file->getError() !== UPLOAD_ERR_OK || ! $file->isFile(), InvalidFileUploadException::class, __('exceptions.egg.importer.invalid_file')); $contents = $file->openFile()->fread($file->getSize()); - throw_if($contents === false, InvalidFileUploadException::class, 'The selected file could not be read.'); + throw_if($contents === false, InvalidFileUploadException::class, __('exceptions.egg.importer.unreadable_file')); return self::fromJson($contents); } @@ -276,7 +276,7 @@ final readonly class EggImportData private static function invalid(string $field): InvalidFileUploadException { - return new InvalidFileUploadException(sprintf('The egg field "%s" is missing or invalid.', $field)); + return new InvalidFileUploadException(__('exceptions.egg.importer.invalid_field', ['field' => $field])); } /** @@ -338,7 +338,7 @@ final readonly class EggImportData $errors = $validator->errors(); $field = $errors->keys()[0]; - throw new InvalidFileUploadException(sprintf('The egg field "%s" is invalid: %s', $field, $errors->first($field))); + throw new InvalidFileUploadException(__('exceptions.egg.importer.field_error', ['field' => $field, 'error' => $errors->first($field)])); } } } diff --git a/app/Exceptions/ApiErrorResponse.php b/app/Exceptions/ApiErrorResponse.php index a139dbcf4..a86010f81 100644 --- a/app/Exceptions/ApiErrorResponse.php +++ b/app/Exceptions/ApiErrorResponse.php @@ -89,14 +89,14 @@ final class ApiErrorResponse 'status' => (string) self::status($e), 'detail' => $e instanceof HttpExceptionInterface || self::mappedStatus($e) !== null ? $e->getMessage() - : 'An unexpected error was encountered while processing this request, please try again.', + : __('exceptions.api.unexpected_error'), ]; if ($e instanceof ModelNotFoundException || $e->getPrevious() instanceof ModelNotFoundException) { // Show a nicer error message compared to the standard "No query results for model" // response that is normally returned. If we are in debug mode this will get overwritten // with a more specific error message to help narrow down things. - $error['detail'] = 'The requested resource could not be found on the server.'; + $error['detail'] = __('exceptions.api.model_not_found'); } if (config('app.debug')) { diff --git a/app/Exceptions/Http/Connection/DaemonConnectionException.php b/app/Exceptions/Http/Connection/DaemonConnectionException.php index ec152fa15..4b144ca3f 100644 --- a/app/Exceptions/Http/Connection/DaemonConnectionException.php +++ b/app/Exceptions/Http/Connection/DaemonConnectionException.php @@ -61,10 +61,10 @@ class DaemonConnectionException extends HttpException private function messageFor(?ClientResponse $response, int $statusCode): string { if (! $response instanceof ClientResponse) { - return 'Could not establish a connection to the machine running this server. Please try again.'; + return __('exceptions.daemon.unreachable'); } - $message = sprintf('There was an error while communicating with the machine running this server. This error has been logged, please try again. (code: %s) (request_id: %s)', $response->status(), $this->requestId ?? ''); + $message = __('exceptions.daemon.communication_error', ['code' => $response->status(), 'request_id' => $this->requestId ?? '']); if ($statusCode >= 500) { return $message; } @@ -72,6 +72,6 @@ class DaemonConnectionException extends HttpException $body = $response->json(); $remoteError = is_array($body) && is_string($body['error'] ?? null) ? $body['error'] : $message; - return sprintf('An error occurred on the remote host: %s. (request id: %s)', $remoteError, $this->requestId ?? ''); + return __('exceptions.daemon.remote_error', ['error' => $remoteError, 'request_id' => $this->requestId ?? '']); } } diff --git a/app/Exceptions/Http/Server/FileSizeTooLargeException.php b/app/Exceptions/Http/Server/FileSizeTooLargeException.php index 88a7e08e1..4c17e7385 100644 --- a/app/Exceptions/Http/Server/FileSizeTooLargeException.php +++ b/app/Exceptions/Http/Server/FileSizeTooLargeException.php @@ -13,6 +13,6 @@ class FileSizeTooLargeException extends DisplayException */ public function __construct() { - parent::__construct('The file you are attempting to open is too large to view in the file editor.'); + parent::__construct(__('exceptions.files.too_large')); } } diff --git a/app/Exceptions/Http/Server/ServerStateConflictException.php b/app/Exceptions/Http/Server/ServerStateConflictException.php index 91dd26752..0030c14a5 100644 --- a/app/Exceptions/Http/Server/ServerStateConflictException.php +++ b/app/Exceptions/Http/Server/ServerStateConflictException.php @@ -16,17 +16,17 @@ class ServerStateConflictException extends ConflictHttpException */ public function __construct(Server $server, ?Throwable $previous = null) { - $message = 'This server is currently in an unsupported state, please try again later.'; + $message = __('exceptions.server.unsupported_state'); if ($server->isSuspended()) { - $message = 'This server is currently suspended and the functionality requested is unavailable.'; + $message = __('exceptions.server.suspended'); } elseif ($server->node->isUnderMaintenance()) { - $message = 'The node of this server is currently under maintenance and the functionality requested is unavailable.'; + $message = __('exceptions.server.node_maintenance'); } elseif (! $server->isInstalled()) { - $message = 'This server has not yet completed its installation process, please try again later.'; + $message = __('exceptions.server.not_installed'); } elseif ($server->status === Server::STATUS_RESTORING_BACKUP) { - $message = 'This server is currently restoring from a backup, please try again later.'; + $message = __('exceptions.server.restoring_backup'); } elseif (($server->transfer) !== null) { - $message = 'This server is currently being transferred to a new machine, please try again later.'; + $message = __('exceptions.server.transferring'); } parent::__construct($message, $previous); diff --git a/app/Exceptions/Http/TwoFactorAuthRequiredException.php b/app/Exceptions/Http/TwoFactorAuthRequiredException.php index 5f9d07f7b..f9c4b26da 100644 --- a/app/Exceptions/Http/TwoFactorAuthRequiredException.php +++ b/app/Exceptions/Http/TwoFactorAuthRequiredException.php @@ -16,6 +16,6 @@ class TwoFactorAuthRequiredException extends HttpException implements HttpExcept */ public function __construct(?Throwable $previous = null) { - parent::__construct(Response::HTTP_BAD_REQUEST, 'Two-factor authentication is required on this account in order to access this endpoint.', $previous); + parent::__construct(Response::HTTP_BAD_REQUEST, __('exceptions.account.two_factor_required'), $previous); } } diff --git a/app/Exceptions/Service/Allocation/AutoAllocationNotEnabledException.php b/app/Exceptions/Service/Allocation/AutoAllocationNotEnabledException.php index 9af4b36ad..5d7d4fcab 100644 --- a/app/Exceptions/Service/Allocation/AutoAllocationNotEnabledException.php +++ b/app/Exceptions/Service/Allocation/AutoAllocationNotEnabledException.php @@ -14,7 +14,7 @@ class AutoAllocationNotEnabledException extends DisplayException public function __construct() { parent::__construct( - 'Server auto-allocation is not enabled for this instance.' + __('exceptions.allocations.auto_allocation_disabled') ); } } diff --git a/app/Exceptions/Service/Allocation/NoAutoAllocationSpaceAvailableException.php b/app/Exceptions/Service/Allocation/NoAutoAllocationSpaceAvailableException.php index 708d6dcae..c1b7a65fd 100644 --- a/app/Exceptions/Service/Allocation/NoAutoAllocationSpaceAvailableException.php +++ b/app/Exceptions/Service/Allocation/NoAutoAllocationSpaceAvailableException.php @@ -14,7 +14,7 @@ class NoAutoAllocationSpaceAvailableException extends DisplayException public function __construct() { parent::__construct( - 'Cannot assign additional allocation: no more space available on node.' + __('exceptions.allocations.no_auto_allocation_space') ); } } diff --git a/app/Exceptions/Service/Backup/BackupLockedException.php b/app/Exceptions/Service/Backup/BackupLockedException.php index b60a03203..40d3c80ae 100644 --- a/app/Exceptions/Service/Backup/BackupLockedException.php +++ b/app/Exceptions/Service/Backup/BackupLockedException.php @@ -10,6 +10,6 @@ class BackupLockedException extends DisplayException { public function __construct() { - parent::__construct('Cannot delete a backup that is marked as locked.'); + parent::__construct(__('exceptions.backups.locked')); } } diff --git a/app/Exceptions/Service/Backup/TooManyBackupsException.php b/app/Exceptions/Service/Backup/TooManyBackupsException.php index 2839f9269..e8c352af7 100644 --- a/app/Exceptions/Service/Backup/TooManyBackupsException.php +++ b/app/Exceptions/Service/Backup/TooManyBackupsException.php @@ -14,7 +14,7 @@ class TooManyBackupsException extends DisplayException public function __construct(int $backupLimit) { parent::__construct( - sprintf('Cannot create a new backup, this server has reached its limit of %d backups.', $backupLimit) + __('exceptions.backups.limit_reached', ['limit' => $backupLimit]) ); } } diff --git a/app/Exceptions/Service/Database/DatabaseClientFeatureNotEnabledException.php b/app/Exceptions/Service/Database/DatabaseClientFeatureNotEnabledException.php index 8faa2444b..5d13e491c 100644 --- a/app/Exceptions/Service/Database/DatabaseClientFeatureNotEnabledException.php +++ b/app/Exceptions/Service/Database/DatabaseClientFeatureNotEnabledException.php @@ -10,6 +10,6 @@ class DatabaseClientFeatureNotEnabledException extends PterodactylException { public function __construct() { - parent::__construct('Client database creation is not enabled in this Panel.'); + parent::__construct(__('exceptions.databases.client_creation_disabled')); } } diff --git a/app/Exceptions/Service/Database/NoSuitableDatabaseHostException.php b/app/Exceptions/Service/Database/NoSuitableDatabaseHostException.php index 13669494b..e7976922e 100644 --- a/app/Exceptions/Service/Database/NoSuitableDatabaseHostException.php +++ b/app/Exceptions/Service/Database/NoSuitableDatabaseHostException.php @@ -13,6 +13,6 @@ class NoSuitableDatabaseHostException extends DisplayException */ public function __construct() { - parent::__construct('No database host was found that meets the requirements for this server.'); + parent::__construct(__('exceptions.databases.no_suitable_host')); } } diff --git a/app/Exceptions/Service/Database/TooManyDatabasesException.php b/app/Exceptions/Service/Database/TooManyDatabasesException.php index 632a029e9..191f84989 100644 --- a/app/Exceptions/Service/Database/TooManyDatabasesException.php +++ b/app/Exceptions/Service/Database/TooManyDatabasesException.php @@ -10,6 +10,6 @@ class TooManyDatabasesException extends DisplayException { public function __construct() { - parent::__construct('Operation aborted: creating a new database would put this server over the defined limit.'); + parent::__construct(__('exceptions.databases.too_many')); } } diff --git a/app/Exceptions/Service/User/TwoFactorAuthenticationTokenInvalid.php b/app/Exceptions/Service/User/TwoFactorAuthenticationTokenInvalid.php index e8d795931..d3aca06f9 100644 --- a/app/Exceptions/Service/User/TwoFactorAuthenticationTokenInvalid.php +++ b/app/Exceptions/Service/User/TwoFactorAuthenticationTokenInvalid.php @@ -13,6 +13,6 @@ class TwoFactorAuthenticationTokenInvalid extends DisplayException */ public function __construct() { - parent::__construct('The provided two-factor authentication token was not valid.'); + parent::__construct(__('exceptions.account.two_factor_token_invalid')); } } diff --git a/app/Http/Concerns/ResolvesRequestContext.php b/app/Http/Concerns/ResolvesRequestContext.php index 6c8b2103a..92316ef16 100644 --- a/app/Http/Concerns/ResolvesRequestContext.php +++ b/app/Http/Concerns/ResolvesRequestContext.php @@ -14,7 +14,7 @@ trait ResolvesRequestContext { protected function authenticatedUser(Request $request): User { - return $request->user() ?? throw new AuthenticationException('This endpoint requires an authenticated user.'); + return $request->user() ?? throw new AuthenticationException(__('exceptions.api.unauthenticated')); } /** diff --git a/app/Http/Controllers/Api/Admin/DatabaseHosts/DatabaseHostController.php b/app/Http/Controllers/Api/Admin/DatabaseHosts/DatabaseHostController.php index e2fc65caf..e2b83af2d 100644 --- a/app/Http/Controllers/Api/Admin/DatabaseHosts/DatabaseHostController.php +++ b/app/Http/Controllers/Api/Admin/DatabaseHosts/DatabaseHostController.php @@ -231,7 +231,7 @@ class DatabaseHostController extends AdminApiController if ($exception instanceof PDOException || $exception->getPrevious() instanceof PDOException) { report($exception); - throw new DisplayException(sprintf('There was an error while trying to connect to the host or while executing a query: "%s"', $exception->getMessage()), $exception); + throw new DisplayException(__('exceptions.databases.host_connection_failed', ['error' => $exception->getMessage()]), $exception); } throw $exception; diff --git a/app/Http/Controllers/Api/Admin/Servers/DatabaseController.php b/app/Http/Controllers/Api/Admin/Servers/DatabaseController.php index b6085e21f..bc745c1ad 100644 --- a/app/Http/Controllers/Api/Admin/Servers/DatabaseController.php +++ b/app/Http/Controllers/Api/Admin/Servers/DatabaseController.php @@ -130,6 +130,6 @@ class DatabaseController extends AdminApiController private function assertServerInstalled(Server $server): void { - throw_unless($server->isInstalled(), HttpException::class, Response::HTTP_FORBIDDEN, 'Access to this resource is not allowed due to the current installation state.'); + throw_unless($server->isInstalled(), HttpException::class, Response::HTTP_FORBIDDEN, __('exceptions.server.installation_state')); } } diff --git a/app/Http/Controllers/Api/Admin/Servers/ServerMountController.php b/app/Http/Controllers/Api/Admin/Servers/ServerMountController.php index 2597c0d19..409951822 100644 --- a/app/Http/Controllers/Api/Admin/Servers/ServerMountController.php +++ b/app/Http/Controllers/Api/Admin/Servers/ServerMountController.php @@ -122,6 +122,6 @@ class ServerMountController extends AdminApiController private function assertServerInstalled(Server $server): void { - throw_unless($server->isInstalled(), HttpException::class, Response::HTTP_FORBIDDEN, 'Access to this resource is not allowed due to the current installation state.'); + throw_unless($server->isInstalled(), HttpException::class, Response::HTTP_FORBIDDEN, __('exceptions.server.installation_state')); } } diff --git a/app/Http/Controllers/Api/Admin/Settings/MailController.php b/app/Http/Controllers/Api/Admin/Settings/MailController.php index f75d05dd8..fd8c2ea75 100644 --- a/app/Http/Controllers/Api/Admin/Settings/MailController.php +++ b/app/Http/Controllers/Api/Admin/Settings/MailController.php @@ -40,7 +40,7 @@ class MailController extends AdminApiController #[ScribeResponse(self::SMTP_DRIVER_ERROR, status: 400, description: 'The panel is not configured to use SMTP mail.')] public function __invoke(UpdateMailSettingsRequest $request, Kernel $kernel): Response { - throw_if(config('mail.default') !== 'smtp', DisplayException::class, 'This feature is only available if SMTP is the selected email driver for the Panel.'); + throw_if(config('mail.default') !== 'smtp', DisplayException::class, __('exceptions.mail.smtp_only')); $values = $request->normalize(); if (Arr::get($values, 'mail:mailers:smtp:password') === '!e') { diff --git a/app/Http/Controllers/Api/Admin/Users/UserController.php b/app/Http/Controllers/Api/Admin/Users/UserController.php index 1f2452941..ba87946f9 100644 --- a/app/Http/Controllers/Api/Admin/Users/UserController.php +++ b/app/Http/Controllers/Api/Admin/Users/UserController.php @@ -183,7 +183,7 @@ class UserController extends AdminApiController public function destroy(DeleteUserRequest $request, DeletesUsers $users, User $user): Response { if ($request->user()->is($user)) { - throw new DisplayException(__('admin/user.exceptions.delete_self')); + throw new DisplayException(__('exceptions.users.delete_self')); } $users->delete($user); diff --git a/app/Http/Controllers/Api/Client/Servers/SettingsController.php b/app/Http/Controllers/Api/Client/Servers/SettingsController.php index ef6a28b55..09d6601d1 100644 --- a/app/Http/Controllers/Api/Client/Servers/SettingsController.php +++ b/app/Http/Controllers/Api/Client/Servers/SettingsController.php @@ -84,7 +84,7 @@ class SettingsController extends ClientApiController public function dockerImage(SetDockerImageRequest $request, UpdatesServerDockerImage $dockerImage, Server $server): JsonResponse { $egg = $server->egg ?? throw new UnexpectedValueException('The server does not have an egg relationship.'); - throw_unless(in_array($server->image, $egg->docker_images, true), BadRequestHttpException::class, "This server's Docker image has been manually set by an administrator and cannot be updated."); + throw_unless(in_array($server->image, $egg->docker_images, true), BadRequestHttpException::class, __('exceptions.server.docker_image_locked')); $dockerImage->update($server, $request->string('docker_image')->toString()); diff --git a/app/Http/Controllers/Api/Client/Servers/StartupController.php b/app/Http/Controllers/Api/Client/Servers/StartupController.php index 0b728932a..7c6e3d4d8 100644 --- a/app/Http/Controllers/Api/Client/Servers/StartupController.php +++ b/app/Http/Controllers/Api/Client/Servers/StartupController.php @@ -62,7 +62,7 @@ class StartupController extends ClientApiController $variable = $request->variable(); throw_if(! $variable instanceof EggVariable || ! $variable->user_viewable, BadRequestHttpException::class, 'The environment variable you are trying to edit does not exist.'); - throw_unless($variable->user_editable, BadRequestHttpException::class, 'The environment variable you are trying to edit is read-only.'); + throw_unless($variable->user_editable, BadRequestHttpException::class, __('exceptions.server.variable_read_only')); $value = $request->filled('value') ? $request->string('value')->toString() : null; diff --git a/app/Http/Controllers/Api/Client/Servers/WebsocketController.php b/app/Http/Controllers/Api/Client/Servers/WebsocketController.php index 12cdad8a8..60fc92172 100644 --- a/app/Http/Controllers/Api/Client/Servers/WebsocketController.php +++ b/app/Http/Controllers/Api/Client/Servers/WebsocketController.php @@ -40,14 +40,14 @@ class WebsocketController extends ClientApiController public function __invoke(ClientApiRequest $request, NodeJwt $jwt, Server $server): JsonResponse { $user = $request->user(); - throw_if($user->cannot(Permissions::WebsocketConnect->value, $server), HttpForbiddenException::class, "You do not have permission to connect to this server's websocket."); + throw_if($user->cannot(Permissions::WebsocketConnect->value, $server), HttpForbiddenException::class, __('exceptions.server.websocket_forbidden')); $permissions = $user->permissionsOn($server); $node = $server->node; if (($server->transfer) !== null) { // Check if the user has permissions to receive transfer logs. - throw_unless(in_array('admin.websocket.transfer', $permissions), HttpForbiddenException::class, 'You do not have permission to view server transfer logs.'); + throw_unless(in_array('admin.websocket.transfer', $permissions), HttpForbiddenException::class, __('exceptions.server.transfer_logs_forbidden')); // Redirect the websocket request to the new node if the server has been archived. if ($server->transfer->archived) { diff --git a/app/Http/Controllers/Api/Client/TwoFactorController.php b/app/Http/Controllers/Api/Client/TwoFactorController.php index a435b957d..04db86224 100644 --- a/app/Http/Controllers/Api/Client/TwoFactorController.php +++ b/app/Http/Controllers/Api/Client/TwoFactorController.php @@ -74,7 +74,7 @@ class TwoFactorController extends ClientApiController public function index(Request $request, SetsUpTwoFactor $twoFactor): JsonResponse { $user = $this->authenticatedUser($request); - throw_if($user->use_totp, BadRequestHttpException::class, 'Two-factor authentication is already enabled on this account.'); + throw_if($user->use_totp, BadRequestHttpException::class, __('exceptions.account.two_factor_enabled')); return new JsonResponse([ 'data' => $twoFactor->setup($user), diff --git a/app/Http/Controllers/Auth/LoginCheckpointController.php b/app/Http/Controllers/Auth/LoginCheckpointController.php index 287003a43..fea39fe71 100644 --- a/app/Http/Controllers/Auth/LoginCheckpointController.php +++ b/app/Http/Controllers/Auth/LoginCheckpointController.php @@ -30,8 +30,6 @@ use UnexpectedValueException; #[Group('Authentication', 'Browser session authentication endpoints used by the panel frontend.', authenticated: false)] class LoginCheckpointController extends AbstractLoginController { - private const string TOKEN_EXPIRED_MESSAGE = 'The authentication token provided has expired, please refresh the page and try again.'; - private const array LOGIN_COMPLETE_EXAMPLE = [ 'data' => [ 'complete' => true, @@ -88,7 +86,7 @@ class LoginCheckpointController extends AbstractLoginController $checkpoint = $logins->pendingCheckpoint(); if (! $checkpoint instanceof LoginCheckpoint) { - $this->sendFailedLoginResponse($request, null, self::TOKEN_EXPIRED_MESSAGE); + $this->sendFailedLoginResponse($request, null, __('auth.two_factor.checkpoint_expired')); } if (! $checkpoint->matches($request->string('confirmation_token')->toString())) { @@ -98,7 +96,7 @@ class LoginCheckpointController extends AbstractLoginController try { $user = User::query()->findOrFail($checkpoint->userId); } catch (ModelNotFoundException) { - $this->sendFailedLoginResponse($request, null, self::TOKEN_EXPIRED_MESSAGE); + $this->sendFailedLoginResponse($request, null, __('auth.two_factor.checkpoint_expired')); } // Recovery tokens go through a slightly different pathway for usage. @@ -111,7 +109,7 @@ class LoginCheckpointController extends AbstractLoginController } else { $totpSecret = $user->totp_secret; if ($totpSecret === null) { - $this->sendFailedLoginResponse($request, $user, self::TOKEN_EXPIRED_MESSAGE); + $this->sendFailedLoginResponse($request, $user, __('auth.two_factor.checkpoint_expired')); } $decrypted = Crypt::decrypt($totpSecret); @@ -136,7 +134,11 @@ class LoginCheckpointController extends AbstractLoginController } } - $this->sendFailedLoginResponse($request, $user, ! empty($recoveryToken) ? 'The recovery token provided is not valid.' : null); + if (! empty($recoveryToken)) { + $this->sendFailedLoginResponse($request, $user, __('auth.two_factor.recovery_token_invalid')); + } + + $this->sendFailedLoginResponse($request, $user); } /** diff --git a/app/Http/Middleware/Api/Admin/AuthenticateAdmin.php b/app/Http/Middleware/Api/Admin/AuthenticateAdmin.php index a865dc1a1..e6e8de80f 100644 --- a/app/Http/Middleware/Api/Admin/AuthenticateAdmin.php +++ b/app/Http/Middleware/Api/Admin/AuthenticateAdmin.php @@ -26,11 +26,11 @@ class AuthenticateAdmin public function handle(Request $request, Closure $next): mixed { $user = $request->user(); - throw_if(! $user || ! $user->root_admin, AccessDeniedHttpException::class, 'This action is unauthorized.'); + throw_if(! $user || ! $user->root_admin, AccessDeniedHttpException::class, __('exceptions.api.unauthorized')); $token = $user->currentAccessToken(); if ($token instanceof HasAbilities && ! $token instanceof TransientToken) { - throw_if($token->key_type === ApiKey::TYPE_APPLICATION, AccessDeniedHttpException::class, 'You are attempting to use an application API key on an endpoint that does not accept them.'); + throw_if($token->key_type === ApiKey::TYPE_APPLICATION, AccessDeniedHttpException::class, __('exceptions.api.application_key_rejected')); } return $next($request); diff --git a/app/Http/Middleware/Api/Application/AuthenticateApplicationUser.php b/app/Http/Middleware/Api/Application/AuthenticateApplicationUser.php index 3bc306309..ae6f354f4 100644 --- a/app/Http/Middleware/Api/Application/AuthenticateApplicationUser.php +++ b/app/Http/Middleware/Api/Application/AuthenticateApplicationUser.php @@ -22,7 +22,7 @@ class AuthenticateApplicationUser public function handle(Request $request, Closure $next): mixed { $user = $request->user(); - throw_if(! $user || ! $user->root_admin, AccessDeniedHttpException::class, 'This account does not have permission to access the API.'); + throw_if(! $user || ! $user->root_admin, AccessDeniedHttpException::class, __('exceptions.api.account_forbidden')); return $next($request); } diff --git a/app/Http/Middleware/Api/Application/AuthorizeExtensionApplicationRequest.php b/app/Http/Middleware/Api/Application/AuthorizeExtensionApplicationRequest.php index 1368f7914..f58148fa3 100644 --- a/app/Http/Middleware/Api/Application/AuthorizeExtensionApplicationRequest.php +++ b/app/Http/Middleware/Api/Application/AuthorizeExtensionApplicationRequest.php @@ -40,7 +40,7 @@ final readonly class AuthorizeExtensionApplicationRequest $permission = in_array($request->getMethod(), ['GET', 'HEAD', 'OPTIONS'], true) ? AdminAcl::READ : AdminAcl::WRITE; foreach (AdminAcl::getResourceList() as $resource) { - throw_unless(AdminAcl::check($token, $resource, $permission), AccessDeniedHttpException::class, 'This API key does not have permission to access this resource.'); + throw_unless(AdminAcl::check($token, $resource, $permission), AccessDeniedHttpException::class, __('exceptions.api.key_forbidden')); } return $next($request); diff --git a/app/Http/Middleware/Api/AuthenticateIPAccess.php b/app/Http/Middleware/Api/AuthenticateIPAccess.php index 78a7eb06b..03e939c66 100644 --- a/app/Http/Middleware/Api/AuthenticateIPAccess.php +++ b/app/Http/Middleware/Api/AuthenticateIPAccess.php @@ -46,12 +46,12 @@ class AuthenticateIPAccess } $requestIp = $request->ip(); - throw_if($requestIp === null, AccessDeniedHttpException::class, 'The request did not contain a valid IP address.'); + throw_if($requestIp === null, AccessDeniedHttpException::class, __('exceptions.api.invalid_ip')); try { $find = new IP($requestIp); } catch (IpException) { - throw new AccessDeniedHttpException('The request did not contain a valid IP address.'); + throw new AccessDeniedHttpException(__('exceptions.api.invalid_ip')); } foreach ($token->allowed_ips as $ip) { @@ -71,6 +71,6 @@ class AuthenticateIPAccess ->property('identifier', $token->identifier) ->log(); - throw new AccessDeniedHttpException('This IP address ('.$request->ip().') does not have permission to access the API using these credentials.'); + throw new AccessDeniedHttpException(__('exceptions.api.ip_forbidden', ['ip' => $request->ip()])); } } diff --git a/app/Http/Middleware/Api/Client/RequireClientApiKey.php b/app/Http/Middleware/Api/Client/RequireClientApiKey.php index 438d2fa62..28c440a52 100644 --- a/app/Http/Middleware/Api/Client/RequireClientApiKey.php +++ b/app/Http/Middleware/Api/Client/RequireClientApiKey.php @@ -32,7 +32,7 @@ class RequireClientApiKey return $next($request); } - throw_if($token->key_type === ApiKey::TYPE_APPLICATION, AccessDeniedHttpException::class, 'You are attempting to use an application API key on an endpoint that requires a client API key.'); + throw_if($token->key_type === ApiKey::TYPE_APPLICATION, AccessDeniedHttpException::class, __('exceptions.api.client_key_required')); return $next($request); } diff --git a/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php b/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php index 707a1bfb2..2cfaf5e51 100644 --- a/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php +++ b/app/Http/Middleware/Api/Client/Server/ResourceBelongsToServer.php @@ -43,7 +43,7 @@ class ResourceBelongsToServer throw_if(! isset($params['server']) || ! $params['server'] instanceof Server, InvalidArgumentException::class, 'This middleware cannot be used in a context that is missing a server in the parameters.'); $server = $params['server']; - $exception = new NotFoundHttpException('The requested resource was not found for this server.'); + $exception = new NotFoundHttpException(__('exceptions.api.resource_not_on_server')); foreach ($params as $key => $model) { // Specifically skip the server, we're just trying to see if all of the // other resources are assigned to this server. Also skip anything that diff --git a/app/Http/Middleware/Api/IsValidJson.php b/app/Http/Middleware/Api/IsValidJson.php index 285405c89..97a1b249d 100644 --- a/app/Http/Middleware/Api/IsValidJson.php +++ b/app/Http/Middleware/Api/IsValidJson.php @@ -27,7 +27,7 @@ class IsValidJson try { json_decode($request->getContent(), true, 512, JSON_THROW_ON_ERROR); } catch (JsonException $exception) { - throw new BadRequestHttpException('The JSON data passed in the request appears to be malformed: '.$exception->getMessage(), $exception); + throw new BadRequestHttpException(__('exceptions.api.malformed_json', ['error' => $exception->getMessage()]), $exception); } } diff --git a/app/Http/Middleware/VerifyReCaptcha.php b/app/Http/Middleware/VerifyReCaptcha.php index fe2e20024..e9cee7093 100644 --- a/app/Http/Middleware/VerifyReCaptcha.php +++ b/app/Http/Middleware/VerifyReCaptcha.php @@ -43,7 +43,7 @@ class VerifyReCaptcha ) ); - throw new HttpException(Response::HTTP_BAD_REQUEST, 'Failed to validate reCAPTCHA data.'); + throw new HttpException(Response::HTTP_BAD_REQUEST, __('exceptions.api.recaptcha_failed')); } /** diff --git a/app/Http/Requests/Api/Client/Servers/Backups/ViewBackupRequest.php b/app/Http/Requests/Api/Client/Servers/Backups/ViewBackupRequest.php index a241343c0..2b06416a8 100644 --- a/app/Http/Requests/Api/Client/Servers/Backups/ViewBackupRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Backups/ViewBackupRequest.php @@ -26,7 +26,7 @@ class ViewBackupRequest extends ClientApiRequest implements ClientPermissionsReq $backup = $route->parameter('backup'); if ($backup instanceof Backup) { - throw_if($backup->server_id !== $server->id, NotFoundHttpException::class, 'The requested resource does not exist on the system.'); + throw_if($backup->server_id !== $server->id, NotFoundHttpException::class, __('exceptions.api.resource_not_on_system')); } return true; diff --git a/app/Http/Requests/Api/Client/Servers/Databases/StoreDatabaseRequest.php b/app/Http/Requests/Api/Client/Servers/Databases/StoreDatabaseRequest.php index 2329074c6..4ea1b84b6 100644 --- a/app/Http/Requests/Api/Client/Servers/Databases/StoreDatabaseRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Databases/StoreDatabaseRequest.php @@ -44,7 +44,7 @@ class StoreDatabaseRequest extends ClientApiRequest implements ClientPermissions public function messages(): array { return [ - 'database.unique' => 'The database name you have selected is already in use by this server.', + 'database.unique' => __('validation.internal.database_name_in_use'), ]; } } diff --git a/app/Http/Requests/Api/Client/Servers/Subusers/DeleteSubuserRequest.php b/app/Http/Requests/Api/Client/Servers/Subusers/DeleteSubuserRequest.php index 2fa074f32..18c350bd5 100644 --- a/app/Http/Requests/Api/Client/Servers/Subusers/DeleteSubuserRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Subusers/DeleteSubuserRequest.php @@ -26,7 +26,7 @@ class DeleteSubuserRequest extends SubuserRequest $exceeding = array_diff($this->subuser()->permissions, $this->requesterPermissions(), [Permissions::WebsocketConnect->value]); - throw_if(count($exceeding) > 0, HttpForbiddenException::class, 'Cannot remove a subuser that has permissions your account does not actively possess.'); + throw_if(count($exceeding) > 0, HttpForbiddenException::class, __('exceptions.subusers.remove_exceeding_permissions')); return true; } diff --git a/app/Http/Requests/Api/Client/Servers/Subusers/SubuserRequest.php b/app/Http/Requests/Api/Client/Servers/Subusers/SubuserRequest.php index a2670a5fd..728622189 100644 --- a/app/Http/Requests/Api/Client/Servers/Subusers/SubuserRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Subusers/SubuserRequest.php @@ -91,7 +91,7 @@ abstract class SubuserRequest extends ClientApiRequest implements ClientPermissi $allowed = array_merge($allowed, $target->permissions); } - throw_if(count(array_diff($permissions, $allowed)) > 0, HttpForbiddenException::class, 'Cannot assign permissions to a subuser that your account does not actively possess.'); + throw_if(count(array_diff($permissions, $allowed)) > 0, HttpForbiddenException::class, __('exceptions.subusers.assign_exceeding_permissions')); } /** diff --git a/app/Http/Requests/Concerns/ValidatesNodeAcceptsEgg.php b/app/Http/Requests/Concerns/ValidatesNodeAcceptsEgg.php index 2b9eb2f9b..36e0fa04c 100644 --- a/app/Http/Requests/Concerns/ValidatesNodeAcceptsEgg.php +++ b/app/Http/Requests/Concerns/ValidatesNodeAcceptsEgg.php @@ -24,6 +24,11 @@ trait ValidatesNodeAcceptsEgg $tags = $node->eggTags->map(fn (Tag $tag): string => $tag->effectiveName())->implode(', '); - $validator->errors()->add($field, "{$node->name} only accepts eggs tagged {$tags}."); + $validator->addReplacer( + 'node_accepts_egg', + fn (string $message): string => str_replace([':node', ':tags'], [$node->name, $tags], $message), + ); + + $validator->addFailure($field, 'NodeAcceptsEgg'); } } diff --git a/app/Models/Permission.php b/app/Models/Permission.php index 3200c96c9..b37088322 100644 --- a/app/Models/Permission.php +++ b/app/Models/Permission.php @@ -20,116 +20,20 @@ class Permission extends Model * * @see Permission::permissions() * - * @var array}> + * @var array> */ protected static array $permissions = [ - 'websocket' => [ - 'description' => 'Allows the user to connect to the server websocket, giving them access to view console output and realtime server stats.', - 'keys' => [ - 'connect' => 'Allows a user to connect to the websocket instance for a server to stream the console.', - ], - ], - - 'control' => [ - 'description' => "Permissions that control a user's ability to control the power state of a server, or send commands.", - 'keys' => [ - 'console' => 'Allows a user to send commands to the server instance via the console.', - 'start' => 'Allows a user to start the server if it is stopped.', - 'stop' => 'Allows a user to stop a server if it is running.', - 'restart' => 'Allows a user to perform a server restart. This allows them to start the server if it is offline, but not put the server in a completely stopped state.', - ], - ], - - 'user' => [ - 'description' => 'Permissions that allow a user to manage other subusers on a server. They will never be able to edit their own account, or assign permissions they do not have themselves.', - 'keys' => [ - 'create' => 'Allows a user to create new subusers for the server.', - 'read' => 'Allows the user to view subusers and their permissions for the server.', - 'update' => 'Allows a user to modify other subusers.', - 'delete' => 'Allows a user to delete a subuser from the server.', - ], - ], - - 'file' => [ - 'description' => "Permissions that control a user's ability to modify the filesystem for this server.", - 'keys' => [ - 'create' => 'Allows a user to create additional files and folders via the Panel. Uploading, pulling remote files, and decompressing archives also require the update permission.', - 'read' => 'Allows a user to view the contents of a directory, but not view the contents of or download files.', - 'read-content' => 'Allows a user to view the contents of a given file. This will also allow the user to download files.', - 'update' => 'Allows a user to update the contents of an existing file or directory.', - 'delete' => 'Allows a user to delete files or directories.', - 'archive' => 'Allows a user to archive the contents of a directory as well as decompress existing archives on the system.', - 'sftp' => 'Allows a user to connect to SFTP and manage server files using the other assigned file permissions.', - ], - ], - - 'backup' => [ - 'description' => "Permissions that control a user's ability to generate and manage server backups.", - 'keys' => [ - 'create' => 'Allows a user to create new backups for this server.', - 'read' => 'Allows a user to view all backups that exist for this server.', - 'delete' => 'Allows a user to remove backups from the system.', - 'download' => 'Allows a user to download a backup for the server. Danger: this allows a user to access all files for the server in the backup.', - 'restore' => 'Allows a user to restore a backup for the server. Danger: this allows the user to delete all of the server files in the process.', - ], - ], - - // Controls permissions for editing or viewing a server's allocations. - 'allocation' => [ - 'description' => "Permissions that control a user's ability to modify the port allocations for this server.", - 'keys' => [ - 'read' => 'Allows a user to view all allocations currently assigned to this server. Users with any level of access to this server can always view the primary allocation.', - 'create' => 'Allows a user to assign additional allocations to the server.', - 'update' => 'Allows a user to change the primary server allocation and attach notes to each allocation.', - 'delete' => 'Allows a user to delete an allocation from the server.', - ], - ], - - // Controls permissions for editing or viewing a server's startup parameters. - 'startup' => [ - 'description' => "Permissions that control a user's ability to view this server's startup parameters.", - 'keys' => [ - 'read' => 'Allows a user to view the startup variables for a server.', - 'update' => 'Allows a user to modify the startup variables for the server.', - 'docker-image' => 'Allows a user to modify the Docker image used when running the server.', - ], - ], - - 'database' => [ - 'description' => "Permissions that control a user's access to the database management for this server.", - 'keys' => [ - 'create' => 'Allows a user to create a new database for this server.', - 'read' => 'Allows a user to view the database associated with this server.', - 'update' => 'Allows a user to rotate the password on a database instance. If the user does not have the view_password permission they will not see the updated password.', - 'delete' => 'Allows a user to remove a database instance from this server.', - 'view_password' => 'Allows a user to view the password associated with a database instance for this server.', - ], - ], - - 'schedule' => [ - 'description' => "Permissions that control a user's access to the schedule management for this server.", - 'keys' => [ - 'create' => 'Allows a user to create new schedules for this server.', // task.create-schedule - 'read' => 'Allows a user to view schedules and the tasks associated with them for this server.', // task.view-schedule, task.list-schedules - 'update' => 'Allows a user to update schedules and schedule tasks for this server.', // task.edit-schedule, task.queue-schedule, task.toggle-schedule - 'delete' => 'Allows a user to delete schedules for this server.', // task.delete-schedule - ], - ], - - 'settings' => [ - 'description' => "Permissions that control a user's access to the settings for this server.", - 'keys' => [ - 'rename' => 'Allows a user to rename this server and change the description of it.', - 'reinstall' => 'Allows a user to trigger a reinstall of this server.', - ], - ], - - 'activity' => [ - 'description' => "Permissions that control a user's access to the server activity logs.", - 'keys' => [ - 'read' => 'Allows a user to view the activity logs for the server.', - ], - ], + 'websocket' => ['connect'], + 'control' => ['console', 'start', 'stop', 'restart'], + 'user' => ['create', 'read', 'update', 'delete'], + 'file' => ['create', 'read', 'read-content', 'update', 'delete', 'archive', 'sftp'], + 'backup' => ['create', 'read', 'delete', 'download', 'restore'], + 'allocation' => ['read', 'create', 'update', 'delete'], + 'startup' => ['read', 'update', 'docker-image'], + 'database' => ['create', 'read', 'update', 'delete', 'view_password'], + 'schedule' => ['create', 'read', 'update', 'delete'], + 'settings' => ['rename', 'reinstall'], + 'activity' => ['read'], ]; /** @@ -147,6 +51,14 @@ class Permission extends Model */ public static function permissions(): Collection { - return Collection::make(self::$permissions); + return Collection::make(self::$permissions)->map(fn (array $keys, string $group): array => [ + 'description' => self::translation("permissions.{$group}.description"), + 'keys' => array_combine($keys, array_map(fn (string $key): string => self::translation("permissions.{$group}.keys.{$key}"), $keys)), + ]); + } + + private static function translation(string $key): string + { + return __($key); } } diff --git a/app/Notifications/AccountCreated.php b/app/Notifications/AccountCreated.php index 38b181e41..169660152 100644 --- a/app/Notifications/AccountCreated.php +++ b/app/Notifications/AccountCreated.php @@ -38,13 +38,14 @@ class AccountCreated extends Notification implements ShouldQueue public function toMail(): MailMessage { $message = (new MailMessage) - ->greeting('Hello '.$this->user->name.'!') - ->line('You are receiving this email because an account has been created for you on '.config()->string('app.name').'.') - ->line('Username: '.$this->user->username) - ->line('Email: '.$this->user->email); + ->subject(__('notifications.account_created.subject')) + ->greeting(__('notifications.account_created.greeting', ['name' => $this->user->name])) + ->line(__('notifications.account_created.intro', ['app' => config()->string('app.name')])) + ->line(__('notifications.account_created.username', ['username' => $this->user->username])) + ->line(__('notifications.account_created.email', ['email' => $this->user->email])); if (($this->token) !== null) { - return $message->action('Setup Your Account', url('/auth/password/reset/'.$this->token.'?email='.urlencode($this->user->email))); + return $message->action(__('notifications.account_created.action'), url('/auth/password/reset/'.$this->token.'?email='.urlencode($this->user->email))); } return $message; diff --git a/app/Notifications/AddedToServer.php b/app/Notifications/AddedToServer.php index 82ec447f9..b71cfb77a 100644 --- a/app/Notifications/AddedToServer.php +++ b/app/Notifications/AddedToServer.php @@ -40,9 +40,10 @@ class AddedToServer extends Notification implements ShouldQueue public function toMail(): MailMessage { return (new MailMessage) - ->greeting('Hello '.$this->server['user'].'!') - ->line('You have been added as a subuser for the following server, allowing you certain control over the server.') - ->line('Server Name: '.$this->server['name']) - ->action('Visit Server', url('/server/'.$this->server['uuidShort'])); + ->subject(__('notifications.added_to_server.subject')) + ->greeting(__('notifications.added_to_server.greeting', ['name' => $this->server['user']])) + ->line(__('notifications.added_to_server.intro')) + ->line(__('notifications.added_to_server.server', ['server' => $this->server['name']])) + ->action(__('notifications.added_to_server.action'), url('/server/'.$this->server['uuidShort'])); } } diff --git a/app/Notifications/MailTested.php b/app/Notifications/MailTested.php index 04698c734..500701629 100644 --- a/app/Notifications/MailTested.php +++ b/app/Notifications/MailTested.php @@ -23,8 +23,8 @@ class MailTested extends Notification public function toMail(): MailMessage { return (new MailMessage) - ->subject('Pterodactyl Test Message') - ->greeting('Hello '.$this->user->name.'!') - ->line("This is a test of the Pterodactyl mail system. You're good to go!"); + ->subject(__('notifications.mail_tested.subject')) + ->greeting(__('notifications.mail_tested.greeting', ['name' => $this->user->name])) + ->line(__('notifications.mail_tested.intro')); } } diff --git a/app/Notifications/RemovedFromServer.php b/app/Notifications/RemovedFromServer.php index 5ca9da58b..ccc36683e 100644 --- a/app/Notifications/RemovedFromServer.php +++ b/app/Notifications/RemovedFromServer.php @@ -41,9 +41,10 @@ class RemovedFromServer extends Notification implements ShouldQueue { return (new MailMessage) ->error() - ->greeting('Hello '.$this->server['user'].'.') - ->line('You have been removed as a subuser for the following server.') - ->line('Server Name: '.$this->server['name']) - ->action('Visit Panel', route('index')); + ->subject(__('notifications.removed_from_server.subject')) + ->greeting(__('notifications.removed_from_server.greeting', ['name' => $this->server['user']])) + ->line(__('notifications.removed_from_server.intro')) + ->line(__('notifications.removed_from_server.server', ['server' => $this->server['name']])) + ->action(__('notifications.removed_from_server.action'), route('index')); } } diff --git a/app/Notifications/SendPasswordReset.php b/app/Notifications/SendPasswordReset.php index 0ad12e17e..60b2cdb0b 100644 --- a/app/Notifications/SendPasswordReset.php +++ b/app/Notifications/SendPasswordReset.php @@ -36,9 +36,9 @@ class SendPasswordReset extends Notification implements ShouldQueue public function toMail(mixed $notifiable): MailMessage { return (new MailMessage) - ->subject('Reset Password') - ->line('You are receiving this email because we received a password reset request for your account.') - ->action('Reset Password', url('/auth/password/reset/'.$this->token.'?email='.urlencode($notifiable->email))) - ->line('If you did not request a password reset, no further action is required.'); + ->subject(__('notifications.password_reset.subject')) + ->line(__('notifications.password_reset.intro')) + ->action(__('notifications.password_reset.action'), url('/auth/password/reset/'.$this->token.'?email='.urlencode($notifiable->email))) + ->line(__('notifications.password_reset.outro')); } } diff --git a/app/Notifications/ServerInstalled.php b/app/Notifications/ServerInstalled.php index c88fc5271..207da5188 100644 --- a/app/Notifications/ServerInstalled.php +++ b/app/Notifications/ServerInstalled.php @@ -54,9 +54,10 @@ class ServerInstalled extends Notification implements ReceivesEvents, ShouldQueu public function toMail(): MailMessage { return (new MailMessage) - ->greeting('Hello '.$this->user->username.'.') - ->line('Your server has finished installing and is now ready for you to use.') - ->line('Server Name: '.$this->server->name) - ->action('Login and Begin Using', route('index')); + ->subject(__('notifications.server_installed.subject')) + ->greeting(__('notifications.server_installed.greeting', ['name' => $this->user->username])) + ->line(__('notifications.server_installed.intro')) + ->line(__('notifications.server_installed.server', ['server' => $this->server->name])) + ->action(__('notifications.server_installed.action'), route('index')); } } diff --git a/app/Rules/DockerImageList.php b/app/Rules/DockerImageList.php index 967a0c9a0..672e42602 100644 --- a/app/Rules/DockerImageList.php +++ b/app/Rules/DockerImageList.php @@ -41,14 +41,14 @@ class DockerImageList implements ValidationRule $images = self::lines($value); if ($images === []) { - $fail('The :attribute field must list at least one image.'); + $fail(__('validation.internal.docker_images_empty')); return; } foreach ($images as $image) { if (Validator::make(['image' => $image], ['image' => CreateEgg::DOCKER_IMAGE])->fails()) { - $fail(sprintf('The :attribute entry "%s" is not a valid Docker image.', Str::limit($image, 64))); + $fail(__('validation.internal.docker_image_invalid', ['image' => Str::limit($image, 64)])); return; } diff --git a/app/Rules/ExtensionFieldValue.php b/app/Rules/ExtensionFieldValue.php index e38753c68..238788cbf 100644 --- a/app/Rules/ExtensionFieldValue.php +++ b/app/Rules/ExtensionFieldValue.php @@ -14,7 +14,7 @@ final class ExtensionFieldValue implements ValidationRule public function validate(string $attribute, mixed $value, Closure $fail): void { if (! ExtensionSettingValueGuard::isFieldValue($value)) { - $fail('The :attribute field must be a string, number, boolean, or a list of them.'); + $fail(__('validation.internal.extension_field_value')); } } } diff --git a/app/Rules/Fqdn.php b/app/Rules/Fqdn.php index 27048022e..36ce4f0a8 100644 --- a/app/Rules/Fqdn.php +++ b/app/Rules/Fqdn.php @@ -45,7 +45,7 @@ class Fqdn implements DataAwareRule, ValidationRule public function validate(string $attribute, mixed $value, Closure $fail): void { if (! is_string($value)) { - $fail('The :attribute could not be resolved to a valid IP address.'); + $fail(__('validation.internal.fqdn_unresolvable')); return; } @@ -54,7 +54,7 @@ class Fqdn implements DataAwareRule, ValidationRule // Unless someone owns their IP blocks and pays for a custom certificate, an IP // cannot serve HTTPS, so refuse the combination before the node fails to connect. if ($this->schemeField && Arr::get($this->data, $this->schemeField) === 'https') { - $fail('The :attribute must not be an IP address when HTTPS is enabled.'); + $fail(__('validation.internal.fqdn_ip_with_https')); } return; @@ -67,6 +67,6 @@ class Fqdn implements DataAwareRule, ValidationRule return; } - $fail('The :attribute could not be resolved to a valid IP address.'); + $fail(__('validation.internal.fqdn_unresolvable')); } } diff --git a/app/Rules/NotInPathHierarchy.php b/app/Rules/NotInPathHierarchy.php index 5047b35a6..15d4ef314 100644 --- a/app/Rules/NotInPathHierarchy.php +++ b/app/Rules/NotInPathHierarchy.php @@ -28,14 +28,14 @@ class NotInPathHierarchy implements ValidationRule if ($path === $blocked) { $fail($this->includeDescendants - ? "The {$attribute} path cannot be or reside within [{$blocked}]." - : "The {$attribute} path cannot be [{$blocked}]."); + ? __('validation.internal.path_within', ['field' => $attribute, 'path' => $blocked]) + : __('validation.internal.path_reserved', ['field' => $attribute, 'path' => $blocked])); return; } if ($this->includeDescendants && str_starts_with($path, $blocked.'/')) { - $fail("The {$attribute} path cannot be or reside within [{$blocked}]."); + $fail(__('validation.internal.path_within', ['field' => $attribute, 'path' => $blocked])); return; } diff --git a/app/Rules/TagSlug.php b/app/Rules/TagSlug.php index 9715cc80b..76d711b74 100644 --- a/app/Rules/TagSlug.php +++ b/app/Rules/TagSlug.php @@ -35,7 +35,7 @@ class TagSlug implements ValidationRule } if (self::isReserved($value)) { - $fail('A tag slug cannot be purely numeric (reserved for tag and legacy nest IDs).'); + $fail(__('validation.internal.tag_slug_numeric')); } } } diff --git a/app/Rules/UnreservedEnvironmentVariable.php b/app/Rules/UnreservedEnvironmentVariable.php index 4cb9adc4d..b3821b0ed 100644 --- a/app/Rules/UnreservedEnvironmentVariable.php +++ b/app/Rules/UnreservedEnvironmentVariable.php @@ -17,7 +17,7 @@ class UnreservedEnvironmentVariable implements ValidationRule public function validate(string $attribute, mixed $value, Closure $fail): void { if (is_string($value) && in_array(mb_strtoupper($value), explode(',', EggVariable::RESERVED_ENV_NAMES), true)) { - $fail(trans('exceptions.service.variables.reserved_name', ['name' => $value])); + $fail(__('exceptions.egg.variables.reserved_name', ['name' => $value])); } } diff --git a/app/Rules/UserEmail.php b/app/Rules/UserEmail.php index d5d1e1d92..c9f96c482 100644 --- a/app/Rules/UserEmail.php +++ b/app/Rules/UserEmail.php @@ -21,7 +21,7 @@ class UserEmail implements ValidationRule $local = mb_trim(explode('@', $value, 2)[0], '"'); if (str_starts_with($local, '-')) { - $fail('The :attribute must not start with a dash.'); + $fail(__('validation.internal.email_leading_dash')); } } } diff --git a/app/Rules/Username.php b/app/Rules/Username.php index 186020fc1..71b84444b 100644 --- a/app/Rules/Username.php +++ b/app/Rules/Username.php @@ -26,6 +26,6 @@ class Username implements ValidationRule return; } - $fail('The :attribute must start and end with alpha-numeric characters and contain only letters, numbers, dashes, underscores, and periods.'); + $fail(__('validation.internal.username')); } } diff --git a/app/Rules/ValidExtensionSettingColor.php b/app/Rules/ValidExtensionSettingColor.php index 99e0cdadc..c780691a1 100644 --- a/app/Rules/ValidExtensionSettingColor.php +++ b/app/Rules/ValidExtensionSettingColor.php @@ -19,7 +19,7 @@ final class ValidExtensionSettingColor implements ValidationRule public function validate(string $attribute, mixed $value, Closure $fail): void { if (! is_string($value) || ExtensionSettingValueGuard::color($value) === null) { - $fail('The :attribute must be a hex colour such as #1f2933 or an oklch() colour such as oklch(0.62 0.19 259.8).'); + $fail(__('validation.internal.extension_setting.color')); } } } diff --git a/app/Rules/ValidExtensionSettingType.php b/app/Rules/ValidExtensionSettingType.php index 5d7779eae..498b7d279 100644 --- a/app/Rules/ValidExtensionSettingType.php +++ b/app/Rules/ValidExtensionSettingType.php @@ -35,10 +35,10 @@ final readonly class ValidExtensionSettingType implements ValidationRule if (! $valid) { $fail(match ($this->field) { - 'number' => 'The :attribute must be a number.', - 'toggle' => 'The :attribute must be true or false.', - 'select' => 'The selected :attribute is not one of the options.', - default => 'The :attribute must be text.', + 'number' => __('validation.internal.extension_setting.number'), + 'toggle' => __('validation.internal.extension_setting.toggle'), + 'select' => __('validation.internal.extension_setting.select'), + default => __('validation.internal.extension_setting.text'), }); } } diff --git a/app/Services/Eggs/EggCatalogService.php b/app/Services/Eggs/EggCatalogService.php index 42a44b20b..ea0085e77 100644 --- a/app/Services/Eggs/EggCatalogService.php +++ b/app/Services/Eggs/EggCatalogService.php @@ -44,10 +44,10 @@ class EggCatalogService try { $response = Http::acceptJson()->connectTimeout(3)->timeout(10)->withoutRedirecting()->get($url); } catch (ConnectionException $connectionException) { - throw new HttpException(502, 'Could not reach the Pterodactyl egg catalog. Please try again.', $connectionException); + throw new HttpException(502, __('exceptions.egg.catalog.unreachable'), $connectionException); } - throw_unless($response->successful(), HttpException::class, 502, 'Could not download from the Pterodactyl egg catalog. Please try again.'); + throw_unless($response->successful(), HttpException::class, 502, __('exceptions.egg.catalog.download_failed')); return $response->body(); } diff --git a/app/Services/Extensions/ExtensionFields.php b/app/Services/Extensions/ExtensionFields.php index 86320f16c..983aed330 100644 --- a/app/Services/Extensions/ExtensionFields.php +++ b/app/Services/Extensions/ExtensionFields.php @@ -79,7 +79,7 @@ final readonly class ExtensionFields public function authorize(Model|string $model, array $submitted, bool $applicationApi = false): void { foreach (array_intersect_key($this->for($this->modelClass($model), $applicationApi), array_flip($submitted)) as $extension => $fields) { - throw_unless($this->authorized($fields, $model), AuthorizationException::class, sprintf('You are not allowed to change the %s fields.', $extension)); + throw_unless($this->authorized($fields, $model), AuthorizationException::class, __('exceptions.extensions.fields_forbidden', ['extension' => $extension])); } } diff --git a/packages/sdk/THEMES.md b/packages/sdk/THEMES.md index 3310ac029..8a304548f 100644 --- a/packages/sdk/THEMES.md +++ b/packages/sdk/THEMES.md @@ -721,6 +721,20 @@ A few models hold an engine component: `model.Terminal` of `server.terminal` dra canvas, `model.Editor` of `server.files.editor` is the code editor, and `page.auth.login` carries `Captcha`. Give them a sized box and colour them with the [`--terminal-*` and `--editor-*` tokens](#console). +### Text and translations + +Models already hold translated text (validation messages, labels, toasts). Text a view writes itself goes +through `useTranslation()` from `@/sdk`, keyed by its English, so language packs translate it: +`const { t } = useTranslation();` then `t('Create Backup')` or `t('Delete {{name}}?', { name })`. For a +sentence with markup inside it, use ` }} />`. Views ejected from classic keep their `t()` calls, so they stay +translated as long as their English is unchanged. + +Text your theme adds is listed in its own `resources/lang/en.json`, written by the panel's extractor: +`node /scripts/extract-translations.mjs --src src --out resources/lang/en.json`. Ship translations +as `resources/lang/.json`; they join the panel's catalogue, and a language pack can translate them +too. Dates follow the language when formatted with localized tokens, such as `formatDate(date, 'lll')`. + ### `Default` `` with no props renders the layer below as it would have rendered, so wrapping it adds a diff --git a/packages/sdk/types/api/http.d.ts b/packages/sdk/types/api/http.d.ts index 9e5e5460c..05b172c3b 100644 --- a/packages/sdk/types/api/http.d.ts +++ b/packages/sdk/types/api/http.d.ts @@ -7,3 +7,4 @@ export declare function httpErrorToHuman(cause: unknown): string; export type ValidationErrors = Record; /** The first message for each field a validation (422) response rejected. */ export declare function httpValidationErrors(cause: unknown): ValidationErrors; +export declare function httpValidationFailure(cause: unknown, field: string, rule: string): string | null; diff --git a/packages/sdk/types/lib/dates.d.ts b/packages/sdk/types/lib/dates.d.ts index 6c35694d3..62f118d7b 100644 --- a/packages/sdk/types/lib/dates.d.ts +++ b/packages/sdk/types/lib/dates.d.ts @@ -1,5 +1,5 @@ // Generated by scripts/generate-sdk-types.mjs. Do not edit. -/** Formats a date with dayjs tokens, advanced ones included, such as `MMM Do [at] h:mmA`. */ +/** Formats a date with dayjs tokens, advanced ones included, such as `lll` for a localized date and time. */ export declare function formatDate(date: string | Date, format: string): string; /** How long ago a date was, such as "3 hours ago". */ export declare function fromNow(date: string | Date): string; diff --git a/packages/sdk/types/plugins/useNavigationBlocker.d.ts b/packages/sdk/types/plugins/useNavigationBlocker.d.ts index 22761baa5..5dc37f5c4 100644 --- a/packages/sdk/types/plugins/useNavigationBlocker.d.ts +++ b/packages/sdk/types/plugins/useNavigationBlocker.d.ts @@ -17,6 +17,6 @@ export interface NavigationBlockerOptions { /** Decide instead of the default confirmation; resolve true to leave the page. */ confirm?: (transition: NavigationTransition) => boolean | Promise; } -export declare const UNSAVED_CHANGES_MESSAGE = "You have unsaved changes. Leave this page and discard them?"; +export declare const unsavedChangesMessage: () => string; /** Asks before leaving while `shouldBlock` holds, including back/forward and tab close. */ export declare function useNavigationBlocker(shouldBlock: boolean | (() => boolean), options?: NavigationBlockerOptions): void; diff --git a/packages/sdk/types/views/server/schedules.d.ts b/packages/sdk/types/views/server/schedules.d.ts index 12d8e06e4..728200d29 100644 --- a/packages/sdk/types/views/server/schedules.d.ts +++ b/packages/sdk/types/views/server/schedules.d.ts @@ -1,4 +1,5 @@ // Generated by scripts/generate-sdk-types.mjs. Do not edit. +import { type Translation } from "../../sdk/localization.js"; import { type PageStatusModel } from "../pageStatus.js"; export interface ScheduleCron { readonly minute: string; @@ -113,4 +114,4 @@ declare module '../registry' { } } /** The task form for a server allowed `backupLimit` backups. */ -export declare function scheduleTaskForm(backupLimit: number | null): ScheduleTaskForm; +export declare function scheduleTaskForm(t: Translation['t'], backupLimit: number | null): ScheduleTaskForm; diff --git a/resources/lang/en.json b/resources/lang/en.json index beb30507a..39195504e 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -1,6 +1,11 @@ { + "2-Factor Required": "2-Factor Required", + "2FA": "2FA", "2FA off": "2FA off", "2FA on": "2FA on", + "New location: {{path}}": "New location: {{path}}", + "Pterodactyl® © 2015 - {{year}}": "Pterodactyl® © 2015 - {{year}}", + "This directory will be created as ": "This directory will be created as ", "{{amount}} disk": "{{amount}} disk", "{{amount}} memory": "{{amount}} memory", "A CPU limit must be provided.": "A CPU limit must be provided.", @@ -9,6 +14,7 @@ "A JSON representation of the values the daemon should look for when booting a server to determine completion. Leave blank to inherit this block from the selected parent egg.": "A JSON representation of the values the daemon should look for when booting a server to determine completion. Leave blank to inherit this block from the selected parent egg.", "A JSON representation of where log files are stored and whether the daemon should create custom logs. Leave blank to inherit this block from the selected parent egg.": "A JSON representation of where log files are stored and whether the daemon should create custom logs. Leave blank to inherit this block from the selected parent egg.", "A backup limit must be provided.": "A backup limit must be provided.", + "A backup task cannot be created when the server's backup limit is set to 0.": "A backup task cannot be created when the server's backup limit is set to 0.", "A block IO weight must be provided.": "A block IO weight must be provided.", "A brief description of this server.": "A brief description of this server.", "A daemon SFTP port must be provided.": "A daemon SFTP port must be provided.", @@ -19,13 +25,18 @@ "A default allocation must be selected.": "A default allocation must be selected.", "A description must be provided.": "A description must be provided.", "A description must not exceed 191 characters.": "A description must not exceed 191 characters.", + "A description of at least 4 characters must be provided.": "A description of at least 4 characters must be provided.", + "A description of this API key.": "A description of this API key.", "A description of this Egg.": "A description of this Egg.", "A descriptive name for this database instance.": "A descriptive name for this database instance.", + "A descriptive name for your database instance.": "A descriptive name for your database instance.", "A disk limit must be provided.": "A disk limit must be provided.", "A disk overallocation must be provided.": "A disk overallocation must be provided.", "A first name must be provided.": "A first name must be provided.", "A host must be provided.": "A host must be provided.", + "A human readable identifier for this schedule.": "A human readable identifier for this schedule.", "A human-readable name for this variable.": "A human-readable name for this variable.", + "A key name must be provided.": "A key name must be provided.", "A last name must be provided.": "A last name must be provided.", "A location must be selected.": "A location must be selected.", "A longer description for this mount.": "A longer description for this mount.", @@ -41,6 +52,7 @@ "A panel update is available.": "A panel update is available.", "A password must be provided.": "A password must be provided.", "A port must be provided.": "A port must be provided.", + "A public key must be provided.": "A public key must be provided.", "A reserved node only takes deployments that name every one of these tags.": "A reserved node only takes deployments that name every one of these tags.", "A server name must be provided.": "A server name must be provided.", "A server owner must be selected.": "A server owner must be selected.", @@ -59,35 +71,65 @@ "A tag name cannot be only a number.": "A tag name cannot be only a number.", "A target node must be selected.": "A target node must be selected.", "A target path must be provided.": "A target path must be provided.", + "A task payload must be provided.": "A task payload must be provided.", + "A time offset must be provided.": "A time offset must be provided.", "A unique name used to identify this mount.": "A unique name used to identify this mount.", "A unique username used to identify this account.": "A unique username used to identify this account.", "A user on the database server with permission to create users and databases.": "A user on the database server with permission to create users and databases.", "A username must be provided.": "A username must be provided.", "A username must not exceed 191 characters.": "A username must not exceed 191 characters.", + "A username or email must be provided.": "A username or email must be provided.", + "A valid directory name must be provided.": "A valid directory name must be provided.", + "A valid email address must be provided to continue.": "A valid email address must be provided to continue.", "A valid email address must be provided.": "A valid email address must be provided.", + "A valid host address must be provided.": "A valid host address must be provided.", "A variable name must be provided.": "A variable name must be provided.", "A variable name must not exceed 191 characters.": "A variable name must not exceed 191 characters.", + "API Credentials": "API Credentials", "API Keys": "API Keys", + "API key created": "API key created", + "API key deleted": "API key deleted", "About": "About", + "Accept Minecraft® EULA": "Accept Minecraft® EULA", "Access": "Access", + "Access Denied": "Access Denied", "Access this variable in the startup command with {{name}}.": "Access this variable in the startup command with {{name}}.", "Access to this resource is not allowed due to the current installation state.": "Access to this resource is not allowed due to the current installation state.", + "Account": "Account", + "Account API": "Account API", + "Account Activity Log": "Account Activity Log", "Account Details": "Account Details", + "Account Overview": "Account Overview", + "Account Password": "Account Password", + "Account Settings": "Account Settings", + "Action": "Action", + "Actions": "Actions", + "Actions taken on this server will appear here.": "Actions taken on this server will appear here.", + "Actions taken on your account will appear here.": "Actions taken on your account will appear here.", + "Actions taken through the admin panel will appear here.": "Actions taken through the admin panel will appear here.", "Actions taken through the admin panel, newest first. Server and account activity stays on those screens.": "Actions taken through the admin panel, newest first. Server and account activity stays on those screens.", "Activate": "Activate", "Active": "Active", "Activity": "Activity", + "Activity Log": "Activity Log", + "Add SSH Key": "Add SSH Key", "Add a MySQL or MariaDB host so servers can create databases.": "Add a MySQL or MariaDB host so servers can create databases.", "Add a Wings node to your panel.": "Add a Wings node to your panel.", "Add a database host for server databases.": "Add a database host for server databases.", "Add a node running Wings to start hosting servers.": "Add a node running Wings to start hosting servers.", + "Add a public key to sign in to SFTP without a password.": "Add a public key to sign in to SFTP without a password.", + "Add a task to tell this schedule what to do when it runs.": "Add a task to tell this schedule what to do when it runs.", "Add alias": "Add alias", "Add item": "Add item", "Add this egg’s configuration, variables, and install script to your panel.": "Add this egg’s configuration, variables, and install script to your panel.", + "Add users to give them access to this server with the permissions you choose.": "Add users to give them access to this server with the permissions you choose.", + "Added": "Added", "Additional Allocation(s)": "Additional Allocation(s)", "Additional allocations to assign to this server on creation.": "Additional allocations to assign to this server on creation.", "Additional allocations to assign to this server.": "Additional allocations to assign to this server.", "Additional features belonging to the egg, comma-separated. Useful for configuring additional panel modifications.": "Additional features belonging to the egg, comma-separated. Useful for configuring additional panel modifications.", + "Address": "Address", + "Admin": "Admin", "Admin Overview": "Admin Overview", "Admin · Activity": "Admin · Activity", "Admin · Application API": "Admin · Application API", @@ -129,22 +171,31 @@ "Advanced: the specific CPU cores this process can run on (e.g. 0, 0-1,3). Leave blank to allow all cores.": "Advanced: the specific CPU cores this process can run on (e.g. 0, 0-1,3). Leave blank to allow all cores.", "Alias": "Alias", "Alias for {{address}}": "Alias for {{address}}", + "All": "All", + "All Permissions": "All Permissions", "All categories": "All categories", "All eggs attached": "All eggs attached", + "All events": "All events", "All nodes attached": "All nodes attached", + "All requests using the {{identifier}} key will be invalidated.": "All requests using the {{identifier}} key will be invalidated.", + "All tasks will be removed and any running processes will be terminated.": "All tasks will be removed and any running processes will be terminated.", "All unassigned allocations for {{ip}} have been deleted.": "All unassigned allocations for {{ip}} have been deleted.", + "All users": "All users", "Allocated Memory (MiB)": "Allocated Memory (MiB)", "Allocated Swap (MiB)": "Allocated Swap (MiB)", "Allocation": "Allocation", "Allocation Limit": "Allocation Limit", "Allocation Limits": "Allocation Limits", "Allocation Management": "Allocation Management", + "Allocation created": "Allocation created", + "Allocation deleted": "Allocation deleted", "Allocations": "Allocations", "Allocations assigned": "Allocations assigned", "Allocations deleted": "Allocations deleted", "Allow Automatic Allocation": "Allow Automatic Allocation", "Allow this mount to be added to servers by users.": "Allow this mount to be added to servers by users.", "Allow users to automatically create new allocations for their server.": "Allow users to automatically create new allocations for their server.", + "Allowed IPs": "Allowed IPs", "An FQDN must be provided.": "An FQDN must be provided.", "An HTTP connection timeout must be provided.": "An HTTP connection timeout must be provided.", "An HTTP request timeout must be provided.": "An HTTP request timeout must be provided.", @@ -157,11 +208,18 @@ "An egg runs here when it has one of these tags. Leave this empty to accept every egg.": "An egg runs here when it has one of these tags. Leave this empty to accept every egg.", "An email address must be provided.": "An email address must be provided.", "An environment variable must be provided.": "An environment variable must be provided.", + "An error was encountered by the application while rendering this view. Try refreshing the page.": "An error was encountered by the application while rendering this view. Try refreshing the page.", + "An unexpected error occurred.": "An unexpected error occurred.", "An upload size limit must be provided.": "An upload size limit must be provided.", "Application API": "Application API", "Application API key created": "Application API key created", "Application API key deleted": "Application API key deleted", "Application Feature Limits": "Application Feature Limits", + "Archive": "Archive", + "Archive started": "Archive started", + "Are you sure you want to delete {{number}} files? This is a permanent action and the files cannot be recovered.": "Are you sure you want to delete {{number}} files? This is a permanent action and the files cannot be recovered.", + "Are you sure you want to delete this task? This action cannot be undone.": "Are you sure you want to delete this task? This action cannot be undone.", + "Are you sure you wish to remove this subuser? They will have all access to this server revoked immediately.": "Are you sure you wish to remove this subuser? They will have all access to this server revoked immediately.", "Assign Additional Ports": "Assign Additional Ports", "Assign IP addresses and ports with the form to make them available to servers.": "Assign IP addresses and ports with the form to make them available to servers.", "Assign New Allocations": "Assign New Allocations", @@ -174,6 +232,8 @@ "Attach eggs": "Attach eggs", "Attach nodes": "Attach nodes", "Authentication": "Authentication", + "Authentication Code": "Authentication Code", + "Authentication required": "Authentication required", "Author": "Author", "Auto Create Allocations Enabled": "Auto Create Allocations Enabled", "Auto-Deploy": "Auto-Deploy", @@ -181,6 +241,7 @@ "Automatic Allocation Creation": "Automatic Allocation Creation", "Available Mounts": "Available Mounts", "Avatar": "Avatar", + "Avatar file": "Avatar file", "Avatar removed": "Avatar removed", "Avatar updated": "Avatar updated", "Back to Database Hosts": "Back to Database Hosts", @@ -190,7 +251,17 @@ "Back to Nodes": "Back to Nodes", "Back to Servers": "Back to Servers", "Back to Users": "Back to Users", + "Backup": "Backup", "Backup Limit": "Backup Limit", + "Backup deleted": "Backup deleted", + "Backup locked": "Backup locked", + "Backup name": "Backup name", + "Backup restore started": "Backup restore started", + "Backup started": "Backup started", + "Backup unlocked": "Backup unlocked", + "Backups": "Backups", + "Backups can't be created because this server's backup limit is 0.": "Backups can't be created because this server's backup limit is 0.", + "Backups cannot be created for this server because the backup limit is set to 0.": "Backups cannot be created for this server because the backup limit is set to 0.", "Base Information": "Base Information", "Behind Proxy": "Behind Proxy", "Block IO Proportion": "Block IO Proportion", @@ -202,12 +273,21 @@ "Build settings": "Build settings", "Built in": "Built in", "Built on {{theme}}": "Built on {{theme}}", + "By pressing \"I Accept\" below you are indicating your agreement to the Minecraft® EULA.": "By pressing \"I Accept\" below you are indicating your agreement to the Minecraft® EULA.", + "Bytes": "Bytes", + "CPU": "CPU", "CPU Limit": "CPU Limit", "CPU Limit (%)": "CPU Limit (%)", + "CPU Load": "CPU Load", "CPU Pinning": "CPU Pinning", "Cancel": "Cancel", + "Cancel Uploads": "Cancel Uploads", + "Cancel upload of {{name}}": "Cancel upload of {{name}}", + "Captcha verification failed, please try again.": "Captcha verification failed, please try again.", "Category": "Category", + "Change Server Details": "Change Server Details", "Change anyway": "Change anyway", + "Change item name": "Change item name", "Changes to this install script affect these eggs because they copy from this one.": "Changes to this install script affect these eggs because they copy from this one.", "Changing any of the values below will result in the server being reinstalled. The server will be stopped and will then proceed.": "Changing any of the values below will result in the server being reinstalled. The server will be stopped and will then proceed.", "Changing the owner will generate a new daemon security token automatically.": "Changing the owner will generate a new daemon security token automatically.", @@ -216,18 +296,27 @@ "Checking": "Checking", "Checking node status": "Checking node status", "Choose the theme every visitor sees, try one on yourself first, and adjust its settings.": "Choose the theme every visitor sees, try one on yourself first, and adjust its settings.", + "Clear Filters": "Clear Filters", + "Clear filters": "Clear filters", "Clear search": "Clear search", + "Clear {{title}} sorting": "Clear {{title}} sorting", "Close": "Close", + "Close (Escape)": "Close (Escape)", + "Close dialog": "Close dialog", "Color": "Color", + "Color scheme": "Color scheme", "Communicate Over SSL": "Communicate Over SSL", "Company Name": "Company Name", + "Compress item": "Compress item", "Configuration": "Configuration", "Configuration File": "Configuration File", "Configuration Files": "Configuration Files", "Configure MySQL hosts for server databases.": "Configure MySQL hosts for server databases.", "Confirm Database Name": "Confirm Database Name", "Confirm Name": "Confirm Name", + "Confirm New Password": "Confirm New Password", "Confirm Node Name": "Confirm Node Name", + "Confirm Password": "Confirm Password", "Confirm Server Name": "Confirm Server Name", "Confirm Transfer": "Confirm Transfer", "Confirm database deletion": "Confirm database deletion", @@ -241,31 +330,53 @@ "Confirm mount name": "Confirm mount name", "Confirm node deletion": "Confirm node deletion", "Confirm server deletion": "Confirm server deletion", + "Confirm server reinstallation": "Confirm server reinstallation", "Confirm short code": "Confirm short code", + "Confirm task deletion": "Confirm task deletion", "Confirm user deletion": "Confirm user deletion", "Connection Alias": "Connection Alias", + "Connection Error": "Connection Error", "Connection details": "Connection details", "Connections From": "Connections From", "Connections from": "Connections from", + "Console": "Console", + "Console command input.": "Console command input.", + "Continue": "Continue", + "Continue on Failure": "Continue on Failure", + "Continues": "Continues", + "Copied \"{{text}}\" to clipboard.": "Copied \"{{text}}\" to clipboard.", + "Copied text to clipboard.": "Copied text to clipboard.", + "Copy": "Copy", "Copy Script From": "Copy Script From", "Copy Settings From": "Copy Settings From", "Copy auto-deploy command": "Copy auto-deploy command", "Copy configuration file": "Copy configuration file", + "Copy startup command": "Copy startup command", + "Copy {{name}}": "Copy {{name}}", "Core Details": "Core Details", + "Covers everything between two values. An hour of 8-12 runs at 8, 9, 10, 11 and 12.": "Covers everything between two values. An hour of 8-12 runs at 8, 9, 10, 11 and 12.", + "Create": "Create", + "Create \"{{query}}\"": "Create \"{{query}}\"", + "Create API Key": "Create API Key", "Create Allocations": "Create Allocations", + "Create Backup": "Create Backup", "Create Database": "Create Database", "Create Database Host": "Create Database Host", "Create Egg": "Create Egg", + "Create File": "Create File", "Create Host": "Create Host", "Create Key": "Create Key", "Create Location": "Create Location", "Create Mount": "Create Mount", "Create Node": "Create Node", "Create Server": "Create Server", + "Create Subuser": "Create Subuser", + "Create Task": "Create Task", "Create User": "Create User", "Create Variable": "Create Variable", "Create a directory mount that can be attached to servers.": "Create a directory mount that can be attached to servers.", "Create a game server on one of your nodes.": "Create a game server on one of your nodes.", + "Create a key to use the client API from your own scripts and tools.": "Create a key to use the client API from your own scripts and tools.", "Create a location to group nodes by region or data center.": "Create a location to group nodes by region or data center.", "Create a mount to share a host directory with server containers.": "Create a mount to share a host directory with server containers.", "Create a node before attaching it to this mount.": "Create a node before attaching it to this mount.", @@ -278,16 +389,24 @@ "Create and manage game servers across your nodes.": "Create and manage game servers across your nodes.", "Create anyway": "Create anyway", "Create application API key": "Create application API key", + "Create backup": "Create backup", + "Create folder": "Create folder", "Create new database": "Create new database", "Create new egg variable": "Create new egg variable", "Create new location": "Create new location", + "Create new subuser": "Create new subuser", "Create or import an egg before attaching it to this mount.": "Create or import an egg before attaching it to this mount.", + "Create schedule": "Create schedule", + "Create server backup": "Create server backup", "Create tag": "Create tag", + "Create task": "Create task", "Create, edit, and remove user accounts.": "Create, edit, and remove user accounts.", "Created": "Created", "Created by": "Created by", "Credentials": "Credentials", + "Cron": "Cron", "Current Egg": "Current Egg", + "Current Password": "Current Password", "Custom Docker Image": "Custom Docker Image", "Custom Image": "Custom Image", "Custom Image…": "Custom Image…", @@ -297,6 +416,8 @@ "Daemon SFTP Port": "Daemon SFTP Port", "Daemon Version": "Daemon Version", "Danger!": "Danger!", + "Dark": "Dark", + "Dashboard": "Dashboard", "Database": "Database", "Database Host": "Database Host", "Database Hosts": "Database Hosts", @@ -309,10 +430,18 @@ "Database host created": "Database host created", "Database host deleted": "Database host deleted", "Database host updated": "Database host updated", + "Database name must be at least 3 characters.": "Database name must be at least 3 characters.", "Database name must not exceed 48 characters.": "Database name must not exceed 48 characters.", + "Database name should only contain alphanumeric characters, underscores, dashes, and/or periods.": "Database name should only contain alphanumeric characters, underscores, dashes, and/or periods.", "Database password rotated": "Database password rotated", "Databases": "Databases", + "Databases can't be created because this server's database limit is 0.": "Databases can't be created because this server's database limit is 0.", "Databases created for servers on this host will appear here.": "Databases created for servers on this host will appear here.", + "Day (Month)": "Day (Month)", + "Day (Week)": "Day (Week)", + "Day of month": "Day of month", + "Day of week": "Day of week", + "Debug Information": "Debug Information", "Default Allocation": "Default Allocation", "Default Connection": "Default Connection", "Default Language": "Default Language", @@ -321,19 +450,30 @@ "Default to the process settings from another Egg.": "Default to the process settings from another Egg.", "Default to this database host when adding databases to servers on selected node.": "Default to this database host when adding databases to servers on selected node.", "Define host → container mount points.": "Define host → container mount points.", + "Delay": "Delay", "Delete": "Delete", + "Delete \"{{name}}\"": "Delete \"{{name}}\"", + "Delete API Key": "Delete API Key", "Delete Database": "Delete Database", + "Delete Directory": "Delete Directory", "Delete Egg": "Delete Egg", + "Delete File": "Delete File", + "Delete Files": "Delete Files", "Delete Host": "Delete Host", "Delete IP block": "Delete IP block", "Delete IP block {{ip}}": "Delete IP block {{ip}}", + "Delete Key": "Delete Key", "Delete Location": "Delete Location", "Delete Mount": "Delete Mount", "Delete Node": "Delete Node", + "Delete SSH Key": "Delete SSH Key", + "Delete Schedule": "Delete Schedule", "Delete Selected": "Delete Selected", "Delete Server": "Delete Server", + "Delete Task": "Delete Task", "Delete User": "Delete User", "Delete Variable": "Delete Variable", + "Delete all files before restoring backup.": "Delete all files before restoring backup.", "Delete allocation {{address}}": "Delete allocation {{address}}", "Delete allocations for IP block?": "Delete allocations for IP block?", "Delete database host": "Delete database host", @@ -345,15 +485,19 @@ "Delete selected allocations?": "Delete selected allocations?", "Delete server": "Delete server", "Delete tag": "Delete tag", + "Delete task {{sequence}} ({{action}})": "Delete task {{sequence}} ({{action}})", "Delete this allocation?": "Delete this allocation?", + "Delete this subuser?": "Delete this subuser?", "Delete user": "Delete user", "Delete {{name}}": "Delete {{name}}", + "Delete {{name}} API key": "Delete {{name}} API key", "Deleting {{email}} is a permanent action and cannot be undone. This will remove the account and all of its associated data.": "Deleting {{email}} is a permanent action and cannot be undone. This will remove the account and all of its associated data.", "Deleting {{name}} is permanent and cannot be undone.": "Deleting {{name}} is permanent and cannot be undone.", "Deleting {{name}} is permanent and cannot be undone. Hosts with associated databases cannot be deleted.": "Deleting {{name}} is permanent and cannot be undone. Hosts with associated databases cannot be deleted.", "Deleting {{name}} is permanent and cannot be undone. Locations with assigned nodes cannot be deleted.": "Deleting {{name}} is permanent and cannot be undone. Locations with assigned nodes cannot be deleted.", "Deleting a database host is permanent. This will permanently delete {{name}}.": "Deleting a database host is permanent. This will permanently delete {{name}}.", "Deleting a database is a permanent action, it cannot be undone. This will permanently delete the {{name}} database and remove all associated data.": "Deleting a database is a permanent action, it cannot be undone. This will permanently delete the {{name}} database and remove all associated data.", + "Deleting a database is permanent. This will delete {{name}} and all associated data.": "Deleting a database is permanent. This will delete {{name}} and all associated data.", "Deleting a location is permanent. This will remove {{name}}.": "Deleting a location is permanent. This will remove {{name}}.", "Deleting a mount is a permanent action, it cannot be undone. This will permanently delete the {{name}} mount and detach it from every egg and node.": "Deleting a mount is a permanent action, it cannot be undone. This will permanently delete the {{name}} mount and detach it from every egg and node.", "Deleting a mount is permanent. This will permanently delete {{name}} and remove it from attached eggs and nodes.": "Deleting a mount is permanent. This will permanently delete {{name}} and remove it from attached eggs and nodes.", @@ -374,20 +518,37 @@ "Detach node": "Detach node", "Detach {{name}}": "Detach {{name}}", "Details": "Details", + "Device Checkpoint": "Device Checkpoint", + "Directory created": "Directory created", + "Disable": "Disable", + "Disable Two-Step": "Disable Two-Step", + "Disable Two-Step Verification": "Disable Two-Step Verification", "Disabled": "Disabled", + "Disabling two-step verification will make your account less secure.": "Disabling two-step verification will make your account less secure.", "Disk": "Disk", "Disk Overallocate (%)": "Disk Overallocate (%)", "Disk Space": "Disk Space", "Disk Space (MiB)": "Disk Space (MiB)", "Disk Space Allocated": "Disk Space Allocated", "Disk Space Limit (MiB)": "Disk Space Limit (MiB)", + "Display Language": "Display Language", "Docker Configuration": "Docker Configuration", "Docker Image": "Docker Image", "Docker Image Configuration": "Docker Image Configuration", "Docker Images": "Docker Images", "Docker container used when running this script for the server.": "Docker container used when running this script for the server.", + "Docker image updated": "Docker image updated", "Documentation": "Documentation", + "Done": "Done", + "Download": "Download", + "Drag and drop files to upload.": "Drag and drop files to upload.", + "Duplicate in place": "Duplicate in place", "Each thread on the system is 100%. Set to 0 for unlimited CPU.": "Each thread on the system is 100%. Set to 0 for unlimited CPU.", + "Edit": "Edit", + "Edit mode bits": "Edit mode bits", + "Edit schedule": "Edit schedule", + "Edit task": "Edit task", + "Edit task {{sequence}} ({{action}})": "Edit task {{sequence}} ({{action}})", "Edit {{name}}": "Edit {{name}}", "Editing is disabled until the server is installed.": "Editing is disabled until the server is installed.", "Egg": "Egg", @@ -408,8 +569,14 @@ "Eggs are powerful and can break servers when edited incorrectly. Avoid editing official eggs unless you are certain of the change.": "Eggs are powerful and can break servers when edited incorrectly. Avoid editing official eggs unless you are certain of the change.", "Eggs are the templates servers are built from. Browse the catalog for ready-made eggs or create your own.": "Eggs are the templates servers are built from. Browse the catalog for ready-made eggs or create your own.", "Eggs attached": "Eggs attached", + "Email": "Email", "Email Address": "Email Address", + "Email address updated": "Email address updated", + "Email addresses must not exceed 191 characters.": "Email addresses must not exceed 191 characters.", + "Enable": "Enable", "Enable OOM Killer": "Enable OOM Killer", + "Enable Two-Step": "Enable Two-Step", + "Enable Two-Step Verification": "Enable Two-Step Verification", "Enable after install": "Enable after install", "Enable if this node sits behind a proxy such as Cloudflare.": "Enable if this node sits behind a proxy such as Cloudflare.", "Enable the extension to load its settings.": "Enable the extension to load its settings.", @@ -419,20 +586,31 @@ "Encryption": "Encryption", "Ending Port": "Ending Port", "Endpoint": "Endpoint", + "Ensure the machine has enough disk space by typing {{command}} on the machine hosting this server. Delete files or increase the available disk space to resolve the issue.": "Ensure the machine has enough disk space by typing {{command}} on the machine hosting this server. Delete files or increase the available disk space to resolve the issue.", "Enter a docker image...": "Enter a docker image...", + "Enter a server name, uuid, or allocation to begin searching.": "Enter a server name, uuid, or allocation to begin searching.", "Enter individual ports or port ranges (e.g. 25565-25570) separated by commas or spaces.": "Enter individual ports or port ranges (e.g. 25565-25570) separated by commas or spaces.", + "Enter one of the recovery codes generated when you setup 2-Factor authentication on this account in order to continue.": "Enter one of the recovery codes generated when you setup 2-Factor authentication on this account in order to continue.", "Enter the IP address to assign ports to.": "Enter the IP address to assign ports to.", "Enter the database name to confirm deletion.": "Enter the database name to confirm deletion.", + "Enter the email address of the user you wish to invite as a subuser for this server.": "Enter the email address of the user you wish to invite as a subuser for this server.", "Enter the email address to confirm deletion.": "Enter the email address to confirm deletion.", + "Enter the files or folders to ignore while generating this backup. Leave blank to use the contents of the {{file}} file in the root of the server directory if present. Wildcard matching of files and folders is supported in addition to negating a rule by prefixing the path with an exclamation point.": "Enter the files or folders to ignore while generating this backup. Leave blank to use the contents of the {{file}} file in the root of the server directory if present. Wildcard matching of files and folders is supported in addition to negating a rule by prefixing the path with an exclamation point.", "Enter the name of this egg to confirm deletion.": "Enter the name of this egg to confirm deletion.", "Enter the name of this host to confirm deletion.": "Enter the name of this host to confirm deletion.", "Enter the name of this mount to confirm deletion.": "Enter the name of this mount to confirm deletion.", "Enter the name of this node to confirm deletion.": "Enter the name of this node to confirm deletion.", "Enter the name of this server to confirm deletion.": "Enter the name of this server to confirm deletion.", + "Enter the name that this file should be saved as.": "Enter the name that this file should be saved as.", + "Enter the new name and directory of this file or folder, relative to the current directory.": "Enter the new name and directory of this file or folder, relative to the current directory.", "Enter the short code to confirm deletion.": "Enter the short code to confirm deletion.", + "Enter the two-factor token generated by your device.": "Enter the two-factor token generated by your device.", + "Enter your account email address to receive instructions on resetting your password.": "Enter your account email address to receive instructions on resetting your password.", + "Enter your public SSH key.": "Enter your public SSH key.", "Environment Variable": "Environment Variable", "Every egg is already attached to this mount.": "Every egg is already attached to this mount.", "Every node is already attached to this mount.": "Every node is already attached to this mount.", + "Examples": "Examples", "Existing Allocations": "Existing Allocations", "Export": "Export", "Extension disabled": "Extension disabled", @@ -443,26 +621,50 @@ "Extensions": "Extensions", "Extensions are turned off on this panel, so installed extensions won't load. Set {{variable}} in your {{file}} to turn them on.": "Extensions are turned off on this panel, so installed extensions won't load. Set {{variable}} in your {{file}} to turn them on.", "External Identifier": "External Identifier", + "Extract contents": "Extract contents", "FQDN": "FQDN", + "Failed": "Failed", + "Failed to connect to the websocket after multiple attempts. Reconnecting resumes once your network or this tab is active again.": "Failed to connect to the websocket after multiple attempts. Reconnecting resumes once your network or this tab is active again.", "Failed to load": "Failed to load", + "Failed to refresh server connection": "Failed to refresh server connection", + "Failed to start server connection": "Failed to start server connection", + "Failure behavior": "Failure behavior", "Features": "Features", + "File Manager": "File Manager", + "File Mode": "File Mode", + "File Name": "File Name", + "File Uploads": "File Uploads", + "File copied": "File copied", + "File deleted": "File deleted", + "File editor": "File editor", "File removed": "File removed", + "File saved": "File saved", "File uploaded": "File uploaded", + "Files": "Files", + "Files deleted": "Files deleted", + "Files updated": "Files updated", + "Find": "Find", "Find and import server templates from eggs.pterodactyl.io.": "Find and import server templates from eggs.pterodactyl.io.", + "Fingerprint": "Fingerprint", "First Name": "First Name", "First name must not exceed 191 characters.": "First name must not exceed 191 characters.", "First page": "First page", + "Folder uploads are not supported.": "Folder uploads are not supported.", "Follow the update guide to upgrade.": "Follow the update guide to upgrade.", "Force Delete Server": "Force Delete Server", "Force Outgoing IP": "Force Outgoing IP", "Force deleting may leave dangling files on the daemon if it reports an error.": "Force deleting may leave dangling files on the daemon if it reports an error.", "Forces all outgoing network traffic to have its Source IP NATed to the IP of the server's primary allocation IP. Enabling this disables internal networking for servers using this egg.": "Forces all outgoing network traffic to have its Source IP NATed to the IP of the server's primary allocation IP. Enabling this disables internal networking for servers using this egg.", "Forcibly Delete This Server": "Forcibly Delete This Server", + "Forcibly Stop Process": "Forcibly Stop Process", "Forcibly delete server": "Forcibly delete server", + "Forcibly stopping a server can lead to data corruption.": "Forcibly stopping a server can lead to data corruption.", "Forgot password?": "Forgot password?", "Found in the extensions folder. Turn it on to finish setting it up.": "Found in the extensions folder. Turn it on to finish setting it up.", "From Address": "From Address", "From Name": "From Name", + "Future tasks will be run when this task fails.": "Future tasks will be run when this task fails.", + "GSL Token": "GSL Token", "Game Port": "Game Port", "Games": "Games", "General": "General", @@ -475,16 +677,24 @@ "Get Help": "Get Help", "Global": "Global", "Global host": "Global host", + "Go back": "Go back", "Grant this account full administrative access to the Panel.": "Grant this account full administrative access to the Panel.", "Group nodes into physical locations.": "Group nodes into physical locations.", "HTTP Connection Timeout": "HTTP Connection Timeout", "HTTP Connections": "HTTP Connections", "HTTP Request Timeout": "HTTP Request Timeout", "HTTP node connections cannot be used when the Panel is loaded over HTTPS.": "HTTP node connections cannot be used when the Panel is loaded over HTTPS.", + "Help protect your account from unauthorized access. You'll be prompted for a verification code each time you sign in.": "Help protect your account from unauthorized access. You'll be prompted for a verification code each time you sign in.", "Hex color": "Hex color", "Hex or oklch() colour": "Hex or oklch() colour", + "Hide Replace": "Hide Replace", + "Hide {{name}}": "Hide {{name}}", "Host": "Host", "Host Details": "Host Details", + "Hour": "Hour", + "I Accept": "I Accept", + "I Have My Device": "I Have My Device", + "I've Lost My Device": "I've Lost My Device", "ID": "ID", "ID {{id}}": "ID {{id}}", "ID {{id}} · {{fqdn}}": "ID {{id}} · {{fqdn}}", @@ -492,8 +702,11 @@ "IP Alias": "IP Alias", "Identifier": "Identifier", "Identity": "Identity", + "If provided, the name that should be used to reference this backup.": "If provided, the name that should be used to reference this backup.", "If selected, the script above is ignored and the chosen egg’s script is used.": "If selected, the script above is ignored and the chosen egg’s script is used.", "If you need to change the install status from uninstalled to installed, or vice versa, you may do so with the button below.": "If you need to change the install status from uninstalled to installed, or vice versa, you may do so with the button below.", + "Ignored Files": "Ignored Files", + "Ignored Files & Directories": "Ignored Files & Directories", "Image": "Image", "Image removed": "Image removed", "Image uploaded": "Image uploaded", @@ -504,6 +717,9 @@ "In most cases you should use SSL. Use HTTP only for non-SSL nodes.": "In most cases you should use SSL. Use HTTP only for non-SSL nodes.", "In {{phase}}, {{date}}": "In {{phase}}, {{date}}", "In {{unit}}.": "In {{unit}}.", + "Inactive": "Inactive", + "Inbound": "Inbound", + "Increasing {{setting}} in the wings configuration, {{file}}, might help resolve this issue.": "Increasing {{setting}} in the wings configuration, {{file}}, might help resolve this issue.", "Information": "Information", "Input Rules": "Input Rules", "Input Rules:": "Input Rules:", @@ -517,6 +733,7 @@ "Installing": "Installing", "Internal Identifier": "Internal Identifier", "Invalid CPU limit.": "Invalid CPU limit.", + "Invalid GSL token": "Invalid GSL token", "Invalid allocation limit.": "Invalid allocation limit.", "Invalid backup limit.": "Invalid backup limit.", "Invalid database limit.": "Invalid database limit.", @@ -524,14 +741,26 @@ "Invalid memory limit.": "Invalid memory limit.", "Invalid package": "Invalid package", "Invalid swap limit.": "Invalid swap limit.", + "Invite User": "Invite User", "Issue application API credentials.": "Issue application API credentials.", + "It looks like this archive is taking a long time to be unarchived. Once completed the unarchived files will appear.": "It looks like this archive is taking a long time to be unarchived. Once completed the unarchived files will appear.", + "It looks like this archive is taking a long time to generate. It will appear once completed.": "It looks like this archive is taking a long time to generate. It will appear once completed.", + "It seems like your Gameserver Login Token (GSL token) is invalid or has expired.": "It seems like your Gameserver Login Token (GSL token) is invalid or has expired.", "JDBC Connection String": "JDBC Connection String", + "Kill": "Kill", "Language": "Language", + "Language updated": "Language updated", "Last Name": "Last Name", "Last name must not exceed 191 characters.": "Last name must not exceed 191 characters.", "Last page": "Last page", + "Last run": "Last run", + "Last run at:": "Last run at:", + "Last run never": "Last run never", + "Last run {{time}}": "Last run {{time}}", "Last used": "Last used", "Latest: {{version}}": "Latest: {{version}}", + "Launch SFTP": "Launch SFTP", + "Leave blank to allow any IP address to use this API key, otherwise provide each IP address on a new line.": "Leave blank to allow any IP address to use this API key, otherwise provide each IP address on a new line.", "Leave blank to email this user a setup link to choose their own.": "Leave blank to email this user a setup link to choose their own.", "Leave blank to keep existing password.": "Leave blank to keep existing password.", "Leave blank to keep the existing password. Enter !e to clear the password.": "Leave blank to keep the existing password. Enter !e to clear the password.", @@ -539,15 +768,22 @@ "Leave blank to keep this user's password the same. The user will not receive any notification if their password is changed.": "Leave blank to keep this user's password the same. The user will not receive any notification if their password is changed.", "Leave empty to not assign an external identifier for this server. The external ID should be unique to this server and not be in use by any other server.": "Leave empty to not assign an external identifier for this server. The external ID should be unique to this server and not be in use by any other server.", "Leave safe mode": "Leave safe mode", + "Light": "Light", "Linked Node": "Linked Node", "Linked to {{name}}": "Linked to {{name}}", + "Loading file details": "Loading file details", + "Loading server card": "Loading server card", + "Loading...": "Loading...", "Location": "Location", "Location Details": "Location Details", "Location created": "Location created", "Location deleted": "Location deleted", "Location updated": "Location updated", "Locations": "Locations", + "Lock": "Lock", + "Locked": "Locked", "Log Configuration": "Log Configuration", + "Log in": "Log in", "Login": "Login", "Login to Continue": "Login to Continue", "Mail": "Mail", @@ -558,6 +794,7 @@ "Mail settings updated": "Mail settings updated", "Maintenance": "Maintenance", "Maintenance Mode": "Maintenance Mode", + "Make Primary": "Make Primary", "Manage": "Manage", "Manage Nodes": "Manage Nodes", "Manage Wings daemons and allocations.": "Manage Wings daemons and allocations.", @@ -571,7 +808,11 @@ "Manage server templates, startup configuration, variables, and install scripts.": "Manage server templates, startup configuration, variables, and install scripts.", "Manage the database hosts available to your servers.": "Manage the database hosts available to your servers.", "Manage your panel's general, mail, and advanced settings.": "Manage your panel's general, mail, and advanced settings.", + "Manage your profile, credentials, and account security.": "Manage your profile, credentials, and account security.", "Manage your users, infrastructure, servers, and panel settings.": "Manage your users, infrastructure, servers, and panel settings.", + "Match Case (Alt+C)": "Match Case (Alt+C)", + "Match Whole Word (Alt+W)": "Match Whole Word (Alt+W)", + "Matches every value in that field. An hour of * runs the task every hour.": "Matches every value in that field. An hour of * runs the task every hour.", "Max": "Max", "Max Connections": "Max Connections", "Max connections": "Max connections", @@ -581,6 +822,12 @@ "Memory (MiB)": "Memory (MiB)", "Memory Allocated": "Memory Allocated", "Memory Overallocate (%)": "Memory Overallocate (%)", + "Memory or process limit reached": "Memory or process limit reached", + "Metadata": "Metadata", + "Minute": "Minute", + "Modify permissions for {{email}}": "Modify permissions for {{email}}", + "Month": "Month", + "More": "More", "More actions for {{name}}": "More actions for {{name}}", "Mount": "Mount", "Mount Details": "Mount Details", @@ -592,32 +839,53 @@ "Mount updated": "Mount updated", "Mounted": "Mounted", "Mounts": "Mounts", + "Move": "Move", "Move item {{number}} down": "Move item {{number}} down", "Move item {{number}} up": "Move item {{number}} up", "Move or delete all servers on this node before deleting it.": "Move or delete all servers on this node before deleting it.", + "Move to a path": "Move to a path", "Name": "Name", "Name is required.": "Name is required.", "Name must not exceed 191 characters.": "Name must not exceed 191 characters.", + "Navigation": "Navigation", "Network": "Network", + "Network (Inbound)": "Network (Inbound)", + "Network (Outbound)": "Network (Outbound)", "Never": "Never", "New API key": "New API key", + "New Password": "New Password", + "New allocation": "New allocation", "New allocations have been assigned.": "New allocations have been assigned.", + "New backup": "New backup", "New database": "New database", "New database host": "New database host", "New egg": "New egg", + "New file": "New file", + "New folder": "New folder", "New location": "New location", "New mount": "New mount", "New node": "New node", + "New schedule": "New schedule", "New server": "New server", "New tag": "New tag", + "New task": "New task", "New user": "New user", "New variable": "New variable", + "Next Match (Enter)": "Next Match (Enter)", "Next page": "Next page", + "Next run at:": "Next run at:", + "No API keys": "No API keys", "No API keys match {{filter}}.": "No API keys match {{filter}}.", "No API keys yet": "No API keys yet", "No Alias Assigned": "No Alias Assigned", + "No SSH keys": "No SSH keys", + "No activity matches the selected filters.": "No activity matches the selected filters.", + "No activity yet": "No activity yet", + "No allocations": "No allocations", "No allocations for this address.": "No allocations for this address.", "No allocations yet": "No allocations yet", + "No backups": "No backups", + "No backups on this page": "No backups on this page", "No database hosts match {{filter}}.": "No database hosts match {{filter}}.", "No database hosts yet": "No database hosts yet", "No databases": "No databases", @@ -631,6 +899,7 @@ "No locations match {{filter}}.": "No locations match {{filter}}.", "No locations yet": "No locations yet", "No matching API keys": "No matching API keys", + "No matching activity": "No matching activity", "No matching database hosts": "No matching database hosts", "No matching eggs": "No matching eggs", "No matching locations": "No matching locations", @@ -647,14 +916,22 @@ "No nodes attached": "No nodes attached", "No nodes match {{filter}}.": "No nodes match {{filter}}.", "No nodes yet": "No nodes yet", + "No other servers": "No other servers", + "No results found.": "No results found.", + "No schedules": "No schedules", "No servers": "No servers", "No servers are running on this node yet.": "No servers are running on this node yet.", + "No servers found": "No servers found", "No servers match {{filter}}.": "No servers match {{filter}}.", + "No servers match your search. Try a different name or address.": "No servers match your search. Try a different name or address.", "No servers yet": "No servers yet", "No settings": "No settings", + "No subusers": "No subusers", "No tags are assigned to this egg.": "No tags are assigned to this egg.", "No tags match {{filter}}.": "No tags match {{filter}}.", "No tags yet": "No tags yet", + "No tasks": "No tasks", + "No users have acted here yet.": "No users have acted here yet.", "No users match {{filter}}.": "No users match {{filter}}.", "No users yet": "No users yet", "No variables": "No variables", @@ -667,25 +944,43 @@ "Node deleted": "Node deleted", "Node detached": "Node detached", "Node tags updated": "Node tags updated", + "Node under Maintenance": "Node under Maintenance", "Node updated": "Node updated", "Nodes": "Nodes", "Nodes assigned to this location will appear here.": "Nodes assigned to this location will appear here.", "Nodes attached": "Nodes attached", "None": "None", + "None selected": "None selected", "Not Required": "Not Required", "Not Set": "Not Set", "Not set up": "Not set up", + "Note: Wings must be restarted for the configuration file changes to take effect": "Note: Wings must be restarted for the configuration file changes to take effect", + "Notes": "Notes", + "Notes for {{address}}": "Notes for {{address}}", + "Nothing has been recorded here yet.": "Nothing has been recorded here yet.", "OOM Killer": "OOM Killer", "Offline": "Offline", + "Okay": "Okay", "Online": "Online", + "Only When Server Is Online": "Only When Server Is Online", + "Only execute this schedule when the server is in a running state.": "Only execute this schedule when the server is in a running state.", + "Only permissions which your account is currently assigned may be selected when creating or modifying other users.": "Only permissions which your account is currently assigned may be selected when creating or modifying other users.", + "Only select this if you entirely trust the user you are inviting with all available permissions!": "Only select this if you entirely trust the user you are inviting with all available permissions!", + "Open Admin Area": "Open Admin Area", "Open Client Area": "Open Client Area", + "Open file options": "Open file options", "Open in client area": "Open in client area", + "Open popup": "Open popup", + "Open server administration": "Open server administration", "Optional default alias for these allocations.": "Optional default alias for these allocations.", "Optional hexadecimal color used for the tag indicator.": "Optional hexadecimal color used for the tag indicator.", + "Optional. Include the files and folders to be excluded in this backup. By default, the contents of your {{file}} file will be used. If you have reached your backup limit, the oldest backup will be rotated.": "Optional. Include the files and folders to be excluded in this backup. By default, the contents of your {{file}} file will be used. If you have reached your backup limit, the oldest backup will be rotated.", "Or enter a custom image...": "Or enter a custom image...", "Or enter a custom image…": "Or enter a custom image…", "Organize eggs and control which nodes can run them.": "Organize eggs and control which nodes can run them.", "Organize nodes by the regions and facilities where they run.": "Organize nodes by the regions and facilities where they run.", + "Out of available disk space": "Out of available disk space", + "Outbound": "Outbound", "Overallocate (%)": "Overallocate (%)", "Overview": "Overview", "Owner": "Owner", @@ -696,28 +991,48 @@ "Pages render without it from now on. Reload the page to see it.": "Pages render without it from now on. Reload the page to see it.", "Panel default ({{name}})": "Panel default ({{name}})", "Password": "Password", + "Password confirmation does not match the password you entered.": "Password confirmation does not match the password you entered.", "Password must be at least 8 characters.": "Password must be at least 8 characters.", "Password must not exceed 191 characters.": "Password must not exceed 191 characters.", + "Password reset email sent": "Password reset email sent", + "Passwords must be at least 8 characters in length.": "Passwords must be at least 8 characters in length.", "Paths": "Paths", + "Payload": "Payload", + "Permanently remove": "Permanently remove", "Permissions": "Permissions", + "Permissions updated": "Permissions updated", + "Picks several exact values. A minute of 0,30 runs on the hour and at half past.": "Picks several exact values. A minute of 0,30 runs on the hour and at half past.", "Place this file in your daemon's root directory (usually /etc/pterodactyl) in a file called config.yml.": "Place this file in your daemon's root directory (usually /etc/pterodactyl) in a file called config.yml.", + "Please enter at least three characters to begin searching.": "Please enter at least three characters to begin searching.", + "Please enter your account password.": "Please enter your account password.", + "Please select a supported version from the list below to continue starting the server.": "Please select a supported version from the list below to continue starting the server.", "Port": "Port", "Ports": "Ports", + "Possible resource limit reached": "Possible resource limit reached", + "Prevents this backup from being deleted until explicitly unlocked.": "Prevents this backup from being deleted until explicitly unlocked.", "Preview for me": "Preview for me", "Preview stopped": "Preview stopped", "Previewing": "Previewing", "Previewing theme": "Previewing theme", + "Previous Match (Shift+Enter)": "Previous Match (Shift+Enter)", "Previous page": "Previous page", + "Primary": "Primary", + "Primary allocation updated": "Primary allocation updated", "Private": "Private", "Privileged Installation Script": "Privileged Installation Script", "Process Management": "Process Management", + "Processing": "Processing", "Protect login and registration forms with reCAPTCHA.": "Protect login and registration forms with reCAPTCHA.", "Provision and manage game servers.": "Provision and manage game servers.", + "Pterodactyl": "Pterodactyl", + "Pterodactyl Software": "Pterodactyl Software", "Public": "Public", + "Public Key": "Public Key", "Public nodes are available for automatic server deployment.": "Public nodes are available for automatic server deployment.", "Read": "Read", "Read & Write": "Read & Write", "Read Only": "Read Only", + "Recovery Code": "Recovery Code", "Refresh": "Refresh", "Refresh Catalog": "Refresh Catalog", "Refresh catalog": "Refresh catalog", @@ -725,51 +1040,94 @@ "Refresh the catalog to download the latest eggs from eggs.pterodactyl.io.": "Refresh the catalog to download the latest eggs from eggs.pterodactyl.io.", "Reinstall": "Reinstall", "Reinstall Server": "Reinstall Server", + "Reinstalling your server will stop it, and then re-run the installation script that initially set it up. Some files may be deleted or modified during this process, please back up your data before continuing.": "Reinstalling your server will stop it, and then re-run the installation script that initially set it up. Some files may be deleted or modified during this process, please back up your data before continuing.", "Reload": "Reload", + "Reload page": "Reload page", "Remove": "Remove", "Remove Additional Ports": "Remove Additional Ports", + "Remove Allocation": "Remove Allocation", "Remove Avatar": "Remove Avatar", "Remove extension": "Remove extension", "Remove item {{number}}": "Remove item {{number}}", "Removing {{name}} deletes the extension files, published assets, settings, subuser permissions it added, and install record.": "Removing {{name}} deletes the extension files, published assets, settings, subuser permissions it added, and install record.", + "Removing the {{name}} SSH key will invalidate its usage across the Panel.": "Removing the {{name}} SSH key will invalidate its usage across the Panel.", + "Rename": "Rename", + "Repeats every nth value. A minute of */15 runs four times an hour.": "Repeats every nth value. A minute of */15 runs four times an hour.", + "Replace": "Replace", + "Replace (Enter)": "Replace (Enter)", + "Replace All": "Replace All", "Replace an installed extension?": "Replace an installed extension?", "Replace {{id}}": "Replace {{id}}", + "Request Password Reset": "Request Password Reset", "Require 2-Factor Authentication": "Require 2-Factor Authentication", + "Required": "Required", "Required for Admins": "Required for Admins", "Required for All Users": "Required for All Users", "Reservations": "Reservations", "Reset Daemon Master Key": "Reset Daemon Master Key", + "Reset Password": "Reset Password", "Resetting the daemon master key voids any request using the old key. This key is used for all sensitive daemon operations including server creation and deletion.": "Resetting the daemon master key voids any request using the old key. This key is used for all sensitive daemon operations including server creation and deletion.", "Resource Limits": "Resource Limits", "Resource Management": "Resource Management", "Resources": "Resources", + "Restart": "Restart", + "Restart the server": "Restart the server", + "Restore": "Restore", + "Restore \"{{name}}\"": "Restore \"{{name}}\"", + "Restoring Backup": "Restoring Backup", + "Restoring from Backup": "Restoring from Backup", "Retry": "Retry", + "Retry extension": "Retry extension", + "Return to Login": "Return to Login", "Root administrator": "Root administrator", "Rotate Password": "Rotate Password", + "Run Now": "Run Now", "Run the following command on the target machine to automatically configure Wings for this node.": "Run the following command on the target machine to automatically configure Wings for this node.", "Run the installation script with elevated privileges, granting access to the node's docker socket. Only enable this when you trust the script.": "Run the installation script with elevated privileges, granting access to the node's docker socket. Only enable this when you trust the script.", + "Running": "Running", + "Running Installer": "Running Installer", "Runtime error": "Runtime error", + "SFTP Details": "SFTP Details", "SMTP Host": "SMTP Host", "SMTP Port": "SMTP Port", + "SSH Key Name": "SSH Key Name", + "SSH Keys": "SSH Keys", + "SSH key created": "SSH key created", + "SSH key deleted": "SSH key deleted", "Safe mode": "Safe mode", "Safe mode is on for your session: you see the classic theme without any extension bundles.": "Safe mode is on for your session: you see the classic theme without any extension bundles.", "Safely Delete Server": "Safely Delete Server", "Safely Delete This Server": "Safely Delete This Server", "Save": "Save", "Save Changes": "Save Changes", + "Save Content": "Save Content", "Save Modifications": "Save Modifications", "Save Settings": "Save Settings", "Save changes": "Save changes", + "Save locally": "Save locally", "Save tags": "Save tags", + "Scan the QR code above using the two-step authentication app of your choice. Then, enter the 6-digit code generated into the field below.": "Scan the QR code above using the two-step authentication app of your choice. Then, enter the 6-digit code generated into the field below.", + "Schedule": "Schedule", + "Schedule Enabled": "Schedule Enabled", + "Schedule created": "Schedule created", + "Schedule deleted": "Schedule deleted", + "Schedule name": "Schedule name", + "Schedule queued": "Schedule queued", + "Schedule saved": "Schedule saved", + "Schedules": "Schedules", + "Schedules run commands, power actions and backups automatically.": "Schedules run commands, power actions and backups automatically.", "Script Configuration": "Script Configuration", "Script Container": "Script Container", "Script Entrypoint Command": "Script Entrypoint Command", + "Scroll to bottom": "Scroll to bottom", + "Search": "Search", "Search API keys…": "Search API keys…", "Search application API keys": "Search application API keys", "Search by name or description…": "Search by name or description…", "Search database hosts": "Search database hosts", "Search database hosts…": "Search database hosts…", "Search eggs": "Search eggs", + "Search events…": "Search events…", "Search locations": "Search locations", "Search locations…": "Search locations…", "Search mounts": "Search mounts", @@ -781,21 +1139,27 @@ "Search servers…": "Search servers…", "Search tags": "Search tags", "Search tags…": "Search tags…", + "Search term": "Search term", "Search users": "Search users", "Search users by name, username or email…": "Search users by name, username or email…", "Search users…": "Search users…", + "Search...": "Search...", "Searching…": "Searching…", "Section": "Section", "Secure Sockets Layer (SSL)": "Secure Sockets Layer (SSL)", "Security": "Security", "See the Servers tab for the full server list.": "See the Servers tab for the full server list.", + "Select All Matches (Alt+Enter)": "Select All Matches (Alt+Enter)", "Select a database host...": "Select a database host...", "Select a language": "Select a language", "Select a node…": "Select a node…", "Select a server owner…": "Select a server owner…", "Select a target node...": "Select a target node...", + "Select all files": "Select all files", + "Select all permissions": "Select all permissions", "Select all unassigned allocations": "Select all unassigned allocations", "Select all unassigned allocations on {{ip}}": "Select all unassigned allocations on {{ip}}", + "Select all {{group}} permissions": "Select all {{group}} permissions", "Select allocation {{address}}": "Select allocation {{address}}", "Select an allocation...": "Select an allocation...", "Select an allocation…": "Select an allocation…", @@ -806,27 +1170,42 @@ "Select or type tags": "Select or type tags", "Select the egg that will define how this server should operate.": "Select the egg that will define how this server should operate.", "Select the ports to remove from this server.": "Select the ports to remove from this server.", + "Select {{name}}": "Select {{name}}", "Selected allocations have been deleted.": "Selected allocations have been deleted.", + "Send Command": "Send Command", + "Send Email": "Send Email", + "Send Power Action": "Send Power Action", "Send Test Email": "Send Test Email", + "Send command": "Send command", + "Send power action": "Send power action", "Server": "Server", + "Server Address": "Server Address", "Server Assignment": "Server Assignment", "Server Cannot Be Managed": "Server Cannot Be Managed", "Server Databases": "Server Databases", "Server Description": "Server Description", + "Server ID": "Server ID", "Server List": "Server List", "Server Name": "Server Name", "Server Owner": "Server Owner", + "Server Suspended": "Server Suspended", + "Server connection failed": "Server connection failed", + "Server connection rejected": "Server connection rejected", "Server created": "Server created", "Server deleted": "Server deleted", "Server details updated": "Server details updated", "Server has been suspended.": "Server has been suspended.", "Server has been unsuspended.": "Server has been unsuspended.", "Server is being reinstalled.": "Server is being reinstalled.", + "Server marked as {{state}}...": "Server marked as {{state}}...", + "Server reinstall started": "Server reinstall started", + "Server reported an error": "Server reported an error", "Server transfer started": "Server transfer started", "Servers": "Servers", "Servers on a node in maintenance mode cannot be accessed.": "Servers on a node in maintenance mode cannot be accessed.", "Servers on an attached node are offered this mount.": "Servers on an attached node are offered this mount.", "Servers using an attached egg are offered this mount.": "Servers using an attached egg are offered this mount.", + "Servers you own or are invited to will appear here.": "Servers you own or are invited to will appear here.", "Service": "Service", "Service Configuration": "Service Configuration", "Service Variables": "Service Variables", @@ -841,6 +1220,9 @@ "Settings unavailable": "Settings unavailable", "Short Code": "Short Code", "Should users be allowed to use custom avatars on their profiles?": "Should users be allowed to use custom avatars on their profiles?", + "Show Cheatsheet": "Show Cheatsheet", + "Show the cron cheatsheet for some examples.": "Show the cron cheatsheet for some examples.", + "Show {{name}}": "Show {{name}}", "Showing {{start}} to {{end}} of {{count}} API keys_one": "Showing {{start}} to {{end}} of {{count}} API key", "Showing {{start}} to {{end}} of {{count}} API keys_other": "Showing {{start}} to {{end}} of {{count}} API keys", "Showing {{start}} to {{end}} of {{count}} allocations_one": "Showing {{start}} to {{end}} of {{count}} allocation", @@ -861,36 +1243,60 @@ "Showing {{start}} to {{end}} of {{count}} tags_other": "Showing {{start}} to {{end}} of {{count}} tags", "Showing {{start}} to {{end}} of {{count}} users_one": "Showing {{start}} to {{end}} of {{count}} user", "Showing {{start}} to {{end}} of {{count}} users_other": "Showing {{start}} to {{end}} of {{count}} users", + "Showing {{start}} to {{end}} of {{total}} results.": "Showing {{start}} to {{end}} of {{total}} results.", "Showing {{start}} to {{end}} of {{total}} {{items}}": "Showing {{start}} to {{end}} of {{total}} {{items}}", + "Showing others' servers": "Showing others' servers", + "Showing your servers": "Showing your servers", + "Sign Out": "Sign Out", + "Size": "Size", "Skip Egg Install Script": "Skip Egg Install Script", "Skip the egg install script during installation if one is attached.": "Skip the egg install script during installation if one is attached.", "Skip the egg install script when reinstalling the server.": "Skip the egg install script when reinstalling the server.", + "Skip to content": "Skip to content", "Slug": "Slug", "Slug is required.": "Slug is required.", "Slug must not exceed 191 characters.": "Slug must not exceed 191 characters.", + "Something went wrong": "Something went wrong", + "Sort {{title}} ascending": "Sort {{title}} ascending", + "Sort {{title}} descending": "Sort {{title}} descending", "Source": "Source", + "Special characters": "Special characters", "Standard Laravel validation rules used to validate this variable.": "Standard Laravel validation rules used to validate this variable.", + "Start": "Start", "Start Configuration": "Start Configuration", "Start Server when Installed": "Start Server when Installed", + "Start backup": "Start backup", + "Start the server": "Start the server", "Start this server automatically once the installation completes.": "Start this server automatically once the installation completes.", + "Starting": "Starting", "Starting Port": "Starting Port", "Startup": "Startup", "Startup Command": "Startup Command", "Startup Command Modification": "Startup Command Modification", "Startup Configuration": "Startup Configuration", + "Startup Settings": "Startup Settings", "Startup Variable:": "Startup Variable:", "Startup configuration updated": "Startup configuration updated", "Startup not defined": "Startup not defined", "Status": "Status", + "Stop": "Stop", "Stop Command": "Stop Command", "Stop preview": "Stop preview", + "Stop the server": "Stop the server", + "Stopping": "Stopping", + "Stops": "Stops", + "Store the codes below somewhere safe. If you lose access to your phone you can use these backup codes to sign in.": "Store the codes below somewhere safe. If you lose access to your phone you can use these backup codes to sign in.", "Stored: {{value}} - enter a new value to replace it": "Stored: {{value}} - enter a new value to replace it", + "Subuser invited": "Subuser invited", + "Subuser removed": "Subuser removed", "Support Project": "Support Project", "Suspend": "Suspend", "Suspend Server": "Suspend Server", "Suspended": "Suspended", "Swap (MiB)": "Swap (MiB)", + "System": "System", "System Information": "System Information", + "System User": "System User", "Tag": "Tag", "Tag created": "Tag created", "Tag deleted": "Tag deleted", @@ -898,15 +1304,26 @@ "Tags": "Tags", "Tags organize eggs and match them with nodes configured to accept them.": "Tags organize eggs and match them with nodes configured to accept them.", "Target": "Target", + "Task": "Task", + "Task created": "Task created", + "Task deleted": "Task deleted", + "Task saved": "Task saved", + "Terminate the server": "Terminate the server", "Terminates the server if it breaches its memory limits. Enabling the OOM killer may cause server processes to exit unexpectedly.": "Terminates the server if it breaches its memory limits. Enabling the OOM killer may cause server processes to exit unexpectedly.", + "The \"{{extensionId}}\" extension could not display this content.": "The \"{{extensionId}}\" extension could not display this content.", + "The \"{{theme}}\" theme could not load, so this page uses the classic theme.": "The \"{{theme}}\" theme could not load, so this page uses the classic theme.", + "The API key you have requested is shown below. Please store this in a safe location, it will not be shown again.": "The API key you have requested is shown below. Please store this in a safe location, it will not be shown again.", "The IO proportion must be at least 10.": "The IO proportion must be at least 10.", "The IO proportion must not exceed 1000.": "The IO proportion must not exceed 1000.", "The IP address or FQDN used when the Panel connects to this MySQL host.": "The IP address or FQDN used when the Panel connects to this MySQL host.", + "The amount of time to wait after the previous task executes before running this one. If this is the first task on a schedule this will not be applied.": "The amount of time to wait after the previous task executes before running this one. If this is the first task on a schedule this will not be applied.", "The application API key shown below will not be displayed again. Store it somewhere safe before closing this dialog.": "The application API key shown below will not be displayed again. Store it somewhere safe before closing this dialog.", "The avatar which will appear under the user's personal account. PNG, JPEG, SVG, WebP, AVIF, and ICO files are supported.": "The avatar which will appear under the user's personal account. PNG, JPEG, SVG, WebP, AVIF, and ICO files are supported.", + "The backup name must not exceed 191 characters.": "The backup name must not exceed 191 characters.", "The catalog is empty": "The catalog is empty", "The command sent to server processes to stop them gracefully. To send a SIGINT enter ^C.": "The command sent to server processes to stop them gracefully. To send a SIGINT enter ^C.", "The configured account must have WITH GRANT OPTION permission and should not reuse Panel database credentials.": "The configured account must have WITH GRANT OPTION permission and should not reuse Panel database credentials.", + "The console could not be loaded.": "The console could not be loaded.", "The database has been deleted.": "The database has been deleted.", "The database host has been deleted.": "The database host has been deleted.", "The database name must be provided.": "The database name must be provided.", @@ -934,12 +1351,14 @@ "The extension has been installed. Reload the page to apply it.": "The extension has been installed. Reload the page to apply it.", "The extension has been removed. Reload the page to apply it.": "The extension has been removed. Reload the page to apply it.", "The extension is enabled and stays enabled, so the new version runs its migrations and code right away.": "The extension is enabled and stays enabled, so the new version runs its migrations and code right away.", + "The following files are being uploaded to your server.": "The following files are being uploaded to your server.", "The following substitutes are available: {{SERVER_MEMORY}}, {{SERVER_IP}}, and {{SERVER_PORT}}.": "The following substitutes are available: {{SERVER_MEMORY}}, {{SERVER_IP}}, and {{SERVER_PORT}}.", "The following variables are available by default: {{SERVER_MEMORY}}, {{SERVER_IP}}, and {{SERVER_PORT}}.": "The following variables are available by default: {{SERVER_MEMORY}}, {{SERVER_IP}}, and {{SERVER_PORT}}.", "The host must be a valid hostname or IP address.": "The host must be a valid hostname or IP address.", "The host name must be provided.": "The host name must be provided.", "The host this database will be created on.": "The host this database will be created on.", "The hostname or IP address that this database server is reachable on.": "The hostname or IP address that this database server is reachable on.", + "The language the panel and emails use for your account.": "The language the panel and emails use for your account.", "The location has been deleted.": "The location has been deleted.", "The main allocation that will be assigned to this server.": "The main allocation that will be assigned to this server.", "The maximum amount of memory allowed. Set to 0 for unlimited.": "The maximum amount of memory allowed. Set to 0 for unlimited.", @@ -953,6 +1372,8 @@ "The node has been deleted.": "The node has been deleted.", "The node has been detached from this mount.": "The node has been detached from this mount.", "The node name must be provided.": "The node name must be provided.", + "The node of this server is currently under maintenance and all actions are unavailable.": "The node of this server is currently under maintenance and all actions are unavailable.", + "The node of this server is currently under maintenance.": "The node of this server is currently under maintenance.", "The node tag assignments have been saved.": "The node tag assignments have been saved.", "The node this server will be transferred to.": "The node this server will be transferred to.", "The node which this server will be deployed to.": "The node which this server will be deployed to.", @@ -961,6 +1382,8 @@ "The path on the host system to mount into the container.": "The path on the host system to mount into the container.", "The port must be between 1 and 65535.": "The port must be between 1 and 65535.", "The readable label shown throughout the panel.": "The readable label shown throughout the panel.", + "The requested resource was not found.": "The requested resource was not found.", + "The schedule system supports the use of Cronjob syntax when defining when tasks should begin running. Use the fields above to specify when these tasks should begin running.": "The schedule system supports the use of Cronjob syntax when defining when tasks should begin running. Use the fields above to specify when these tasks should begin running.", "The selected eggs have been attached to this mount.": "The selected eggs have been attached to this mount.", "The selected nodes have been attached to this mount.": "The selected nodes have been attached to this mount.", "The server has been deleted.": "The server has been deleted.", @@ -969,6 +1392,8 @@ "The short code must be provided.": "The short code must be provided.", "The tag has been deleted.": "The tag has been deleted.", "The theme is now active. Reload the page to see it.": "The theme is now active. Reload the page to see it.", + "The time offset must be at least 0 seconds.": "The time offset must be at least 0 seconds.", + "The time offset must be less than 900 seconds.": "The time offset must be less than 900 seconds.", "The total number of allocations a user is allowed to create for this server.": "The total number of allocations a user is allowed to create for this server.", "The total number of backups that can be created for this server.": "The total number of backups that can be created for this server.", "The total number of databases a user is allowed to create for this server.": "The total number of databases a user is allowed to create for this server.", @@ -979,33 +1404,58 @@ "Theme activated": "Theme activated", "Theme settings saved": "Theme settings saved", "Themes": "Themes", + "There are no files in this folder.": "There are no files in this folder.", + "There are no servers owned by other users.": "There are no servers owned by other users.", "There must be no servers associated with this account in order for it to be deleted.": "There must be no servers associated with this account in order for it to be deleted.", + "There was an error validating the credentials provided for the websocket. Please refresh the page.": "There was an error validating the credentials provided for the websocket. Please refresh the page.", + "These codes will not be shown again.": "These codes will not be shown again.", "These options should not be edited unless you understand how this system works. All fields are required unless you select an Egg from the \"Copy Settings From\" dropdown, in which case the process fields may be left blank to inherit from that Egg.": "These options should not be edited unless you understand how this system works. All fields are required unless you select an Egg from the \"Copy Settings From\" dropdown, in which case the process fields may be left blank to inherit from that Egg.", "This Panel is using HTTPS, so browsers require node connections to use SSL.": "This Panel is using HTTPS, so browsers require node connections to use SSL.", "This Panel reads settings from the environment only. Set {{variable}} in your environment file to load settings dynamically.": "This Panel reads settings from the environment only. Set {{variable}} in your environment file to load settings dynamically.", "This action is disabled until the server is installed.": "This action is disabled until the server is installed.", "This action will attempt to delete the server from both the panel and daemon. If either one reports an error the action will be cancelled.": "This action will attempt to delete the server from both the panel and daemon. If either one reports an error the action will be cancelled.", "This action will attempt to delete the server from both the panel and daemon. If the daemon does not respond, or reports an error, the deletion will continue.": "This action will attempt to delete the server from both the panel and daemon. If the daemon does not respond, or reports an error, the deletion will continue.", + "This allocation will be immediately removed from your server.": "This allocation will be immediately removed from your server.", + "This backup will no longer be protected from automated or accidental deletions.": "This backup will no longer be protected from automated or accidental deletions.", "This could overwrite server data.": "This could overwrite server data.", + "This directory is too large to display in the browser, limiting output to first 250 files.": "This directory is too large to display in the browser, limiting output to first 250 files.", "This egg doesn't define any environment variables.": "This egg doesn't define any environment variables.", "This egg is copying its install script from {{name}}. Changes made to the script below will not apply unless you select \"None\" from the \"Copy Script From\" dropdown.": "This egg is copying its install script from {{name}}. Changes made to the script below will not apply unless you select \"None\" from the \"Copy Script From\" dropdown.", "This egg is copying its install script from another egg. Changes made to the script below will not apply unless you select \"None\" from the \"Copy Script From\" dropdown.": "This egg is copying its install script from another egg. Changes made to the script below will not apply unless you select \"None\" from the \"Copy Script From\" dropdown.", "This extension doesn't register any settings.": "This extension doesn't register any settings.", "This feature may have bugs.": "This feature may have bugs.", + "This folder is empty": "This folder is empty", "This interface is limited to instances using SMTP as the mail driver. Use {{command}} to update mail settings, or set {{variable}} in the environment file.": "This interface is limited to instances using SMTP as the mail driver. Use {{command}} to update mail settings, or set {{variable}} in the environment file.", + "This is a permanent operation. The backup cannot be recovered once deleted.": "This is a permanent operation. The backup cannot be recovered once deleted.", + "This is an advanced feature allowing you to select a Docker image to use when running this server instance.": "This is an advanced feature allowing you to select a Docker image to use when running this server instance.", "This node accepts every egg.": "This node accepts every egg.", "This node is currently under maintenance.": "This node is currently under maintenance.", "This node is not reserved.": "This node is not reserved.", "This package is {{id}} v{{version}}, and a copy of {{id}} is already installed. Installing it replaces the installed files.": "This package is {{id}} v{{version}}, and a copy of {{id}} is already installed. Installing it replaces the installed files.", "This package is {{id}} v{{version}}, and v{{installedVersion}} of {{id}} is already installed. Installing it replaces the installed files.": "This package is {{id}} v{{version}}, and v{{installedVersion}} of {{id}} is already installed. Installing it replaces the installed files.", + "This page is past the end of the backup list.": "This page is past the end of the backup list.", "This permanently deletes {{name}} and removes it from {{eggs}} and {{nodes}}.": "This permanently deletes {{name}} and removes it from {{eggs}} and {{nodes}}.", + "This schedule will be executed automatically if enabled.": "This schedule will be executed automatically if enabled.", + "This server doesn't have any backups yet.": "This server doesn't have any backups yet.", "This server doesn't have any databases yet.": "This server doesn't have any databases yet.", + "This server doesn't have any network allocations assigned.": "This server doesn't have any network allocations assigned.", + "This server doesn't have any startup variables to configure.": "This server doesn't have any startup variables to configure.", "This server failed to install.": "This server failed to install.", + "This server has reached the maximum process or memory limit.": "This server has reached the maximum process or memory limit.", + "This server has run out of available disk space and cannot complete the install or update process.": "This server has run out of available disk space and cannot complete the install or update process.", + "This server has run out of available disk space and cannot complete the install or update process. Please get in touch with the administrator(s) and inform them of disk space issues.": "This server has run out of available disk space and cannot complete the install or update process. Please get in touch with the administrator(s) and inform them of disk space issues.", + "This server is attempting to use more resources than allocated. Please contact the administrator and give them the error below.": "This server is attempting to use more resources than allocated. Please contact the administrator and give them the error below.", "This server is being transferred and cannot be suspended.": "This server is being transferred and cannot be suspended.", + "This server is configured to skip its egg's install script. Reinstalling is not available until that setting is disabled.": "This server is configured to skip its egg's install script. Reinstalling is not available until that setting is disabled.", + "This server is currently being transferred to another node and all actions are unavailable.": "This server is currently being transferred to another node and all actions are unavailable.", "This server is currently being transferred to another node.": "This server is currently being transferred to another node.", "This server is currently installing.": "This server is currently installing.", + "This server is currently running an unsupported version of Java and cannot be started.": "This server is currently running an unsupported version of Java and cannot be started.", + "This server is currently running its installation process and most actions are unavailable.": "This server is currently running its installation process and most actions are unavailable.", "This server is currently suspended.": "This server is currently suspended.", "This server is in a failed install state and cannot be recovered. Delete and re-create the server.": "This server is in a failed install state and cannot be recovered. Delete and re-create the server.", + "This server is suspended and cannot be accessed.": "This server is suspended and cannot be accessed.", + "This server's Docker image has been manually set by an administrator and cannot be changed through this UI.": "This server's Docker image has been manually set by an administrator and cannot be changed through this UI.", "This server's database limit is 0. Raise it in the build settings to create databases.": "This server's database limit is 0. Raise it in the build settings to create databases.", "This user doesn't own any servers.": "This user doesn't own any servers.", "This value is sent to every visitor, including those who are not signed in.": "This value is sent to every visitor, including those who are not signed in.", @@ -1021,28 +1471,50 @@ "This will suspend the server, stop any running processes, and block the user from accessing their files or managing the server.": "This will suspend the server, stop any running processes, and block the user from accessing their files or managing the server.", "This will suspend the server, stop any running processes, and immediately block the user from accessing their files or managing the server.": "This will suspend the server, stop any running processes, and immediately block the user from accessing their files or managing the server.", "This will unsuspend the server and restore normal user access.": "This will unsuspend the server and restore normal user access.", + "Time offset (in seconds)": "Time offset (in seconds)", "Toggle": "Toggle", "Toggle Install Status": "Toggle Install Status", + "Toggle Replace": "Toggle Replace", + "Toggle Replace (Ctrl+H)": "Toggle Replace (Ctrl+H)", "Total CPU Threads": "Total CPU Threads", "Total Memory (MiB)": "Total Memory (MiB)", "Total Servers": "Total Servers", "Transfer Server": "Transfer Server", "Transfer anyway": "Transfer anyway", + "Transfer has failed.": "Transfer has failed.", "Transfer server": "Transfer server", "Transfer this server to another node connected to this panel.": "Transfer this server to another node connected to this panel.", + "Transferring": "Transferring", "Transferring a server requires more than one node to be configured on this panel.": "Transferring a server requires more than one node to be configured on this panel.", "Transport Layer Security (TLS)": "Transport Layer Security (TLS)", + "Try again": "Try again", + "Two-Step Authentication Enabled": "Two-Step Authentication Enabled", + "Two-Step Verification": "Two-Step Verification", + "Two-step verification disabled": "Two-step verification disabled", + "Two-step verification enabled": "Two-step verification enabled", + "Two-step verification is currently enabled on your account.": "Two-step verification is currently enabled on your account.", + "Type a command...": "Type a command...", "Type a name below to create one, or manage tags on the Tags page.": "Type a name below to create one, or manage tags on the Tags page.", "UUID / Docker Container ID": "UUID / Docker Container ID", "Unable to activate the theme": "Unable to activate the theme", + "Unable to archive files": "Unable to archive files", "Unable to assign allocations": "Unable to assign allocations", "Unable to attach eggs": "Unable to attach eggs", "Unable to attach mount": "Unable to attach mount", "Unable to attach nodes": "Unable to attach nodes", + "Unable to copy file": "Unable to copy file", + "Unable to copy text to clipboard.": "Unable to copy text to clipboard.", + "Unable to create API key": "Unable to create API key", + "Unable to create SSH key": "Unable to create SSH key", + "Unable to create allocation": "Unable to create allocation", "Unable to create application API key": "Unable to create application API key", + "Unable to create backup": "Unable to create backup", + "Unable to create backup download": "Unable to create backup download", "Unable to create database": "Unable to create database", "Unable to create database host": "Unable to create database host", + "Unable to create directory": "Unable to create directory", "Unable to create egg": "Unable to create egg", + "Unable to create file download": "Unable to create file download", "Unable to create location": "Unable to create location", "Unable to create mount": "Unable to create mount", "Unable to create node": "Unable to create node", @@ -1050,95 +1522,152 @@ "Unable to create tag": "Unable to create tag", "Unable to create user": "Unable to create user", "Unable to create variable": "Unable to create variable", + "Unable to delete API key": "Unable to delete API key", + "Unable to delete SSH key": "Unable to delete SSH key", "Unable to delete allocation": "Unable to delete allocation", "Unable to delete allocations": "Unable to delete allocations", "Unable to delete application API key": "Unable to delete application API key", + "Unable to delete backup": "Unable to delete backup", "Unable to delete database": "Unable to delete database", "Unable to delete database host": "Unable to delete database host", "Unable to delete egg": "Unable to delete egg", + "Unable to delete files": "Unable to delete files", "Unable to delete location": "Unable to delete location", "Unable to delete mount": "Unable to delete mount", "Unable to delete node": "Unable to delete node", + "Unable to delete schedule": "Unable to delete schedule", "Unable to delete server": "Unable to delete server", "Unable to delete tag": "Unable to delete tag", + "Unable to delete task": "Unable to delete task", "Unable to delete user": "Unable to delete user", "Unable to delete variable": "Unable to delete variable", "Unable to detach egg": "Unable to detach egg", "Unable to detach mount": "Unable to detach mount", "Unable to detach node": "Unable to detach node", "Unable to disable extension": "Unable to disable extension", + "Unable to disable two-step verification": "Unable to disable two-step verification", "Unable to enable extension": "Unable to enable extension", + "Unable to enable two-step verification": "Unable to enable two-step verification", "Unable to export egg": "Unable to export egg", "Unable to generate deploy token": "Unable to generate deploy token", "Unable to import catalog egg": "Unable to import catalog egg", "Unable to import egg": "Unable to import egg", "Unable to install extension": "Unable to install extension", + "Unable to invite subuser": "Unable to invite subuser", + "Unable to load QR code.": "Unable to load QR code.", + "Unable to log in": "Unable to log in", "Unable to preview the theme": "Unable to preview the theme", "Unable to refresh egg catalog": "Unable to refresh egg catalog", "Unable to reinstall server": "Unable to reinstall server", "Unable to remove avatar": "Unable to remove avatar", "Unable to remove extension": "Unable to remove extension", + "Unable to remove subuser": "Unable to remove subuser", "Unable to remove the file": "Unable to remove the file", "Unable to remove the image": "Unable to remove the image", + "Unable to request password reset": "Unable to request password reset", + "Unable to reset password": "Unable to reset password", + "Unable to restore backup": "Unable to restore backup", "Unable to rotate database password": "Unable to rotate database password", + "Unable to run schedule": "Unable to run schedule", + "Unable to save file": "Unable to save file", + "Unable to save schedule": "Unable to save schedule", + "Unable to save task": "Unable to save task", "Unable to save the theme settings": "Unable to save the theme settings", + "Unable to send command": "Unable to send command", + "Unable to send power action": "Unable to send power action", "Unable to stop the preview": "Unable to stop the preview", "Unable to suspend server": "Unable to suspend server", "Unable to test mail settings": "Unable to test mail settings", "Unable to toggle install status": "Unable to toggle install status", "Unable to transfer server": "Unable to transfer server", + "Unable to unarchive file": "Unable to unarchive file", "Unable to unsuspend server": "Unable to unsuspend server", + "Unable to update Docker image": "Unable to update Docker image", "Unable to update advanced settings": "Unable to update advanced settings", "Unable to update allocation alias": "Unable to update allocation alias", + "Unable to update allocation notes": "Unable to update allocation notes", "Unable to update avatar": "Unable to update avatar", + "Unable to update backup lock": "Unable to update backup lock", "Unable to update build configuration": "Unable to update build configuration", "Unable to update database host": "Unable to update database host", "Unable to update egg": "Unable to update egg", "Unable to update egg from file": "Unable to update egg from file", "Unable to update egg tags": "Unable to update egg tags", + "Unable to update email address": "Unable to update email address", "Unable to update extension settings": "Unable to update extension settings", + "Unable to update files": "Unable to update files", "Unable to update general settings": "Unable to update general settings", "Unable to update install script": "Unable to update install script", + "Unable to update language": "Unable to update language", "Unable to update location": "Unable to update location", "Unable to update mail settings": "Unable to update mail settings", "Unable to update mount": "Unable to update mount", "Unable to update node": "Unable to update node", "Unable to update node tags": "Unable to update node tags", + "Unable to update password": "Unable to update password", + "Unable to update permissions": "Unable to update permissions", + "Unable to update primary allocation": "Unable to update primary allocation", "Unable to update server details": "Unable to update server details", "Unable to update startup configuration": "Unable to update startup configuration", + "Unable to update startup variable": "Unable to update startup variable", + "Unable to update subuser": "Unable to update subuser", "Unable to update tag": "Unable to update tag", "Unable to update user": "Unable to update user", "Unable to update variable": "Unable to update variable", + "Unable to upload files": "Unable to upload files", "Unable to upload the file": "Unable to upload the file", "Unable to upload the image": "Unable to upload the image", + "Unable to upload {{name}}": "Unable to upload {{name}}", + "Unable to verify two-step code": "Unable to verify two-step code", + "Unarchive": "Unarchive", + "Unarchive started": "Unarchive started", "Unassigned": "Unassigned", "Unassigned ports on this node that will be assigned to the server.": "Unassigned ports on this node that will be assigned to the server.", "Unavailable": "Unavailable", + "Under Maintenance": "Under Maintenance", "Unknown": "Unknown", + "Unknown Action": "Unknown Action", "Unknown extension": "Unknown extension", "Unlimited": "Unlimited", + "Unlock": "Unlock", + "Unlock \"{{name}}\"": "Unlock \"{{name}}\"", + "Unlock this backup before deleting it.": "Unlock this backup before deleting it.", "Unmount": "Unmount", "Unmounted": "Unmounted", + "Unsupported Java version": "Unsupported Java version", "Unsuspend": "Unsuspend", "Unsuspend Server": "Unsuspend Server", + "Update": "Update", "Update Avatar": "Update Avatar", "Update Build Configuration": "Update Build Configuration", "Update Details": "Update Details", + "Update Docker Image": "Update Docker Image", "Update Egg": "Update Egg", + "Update Email": "Update Email", + "Update Email Address": "Update Email Address", "Update From File": "Update From File", + "Update GSL Token": "Update GSL Token", + "Update Password": "Update Password", "Update egg from file": "Update egg from file", "Update tag": "Update tag", + "Upload": "Upload", "Upload Size Limit (MiB)": "Upload Size Limit (MiB)", "Upload a new egg JSON file to replace this egg's settings. This will not change any existing startup strings or docker images for servers already using this egg.": "Upload a new egg JSON file to replace this egg's settings. This will not change any existing startup strings or docker images for servers already using this egg.", "Upload an egg JSON file to add a server template.": "Upload an egg JSON file to add a server template.", + "Upload complete": "Upload complete", + "Upload files": "Upload files", + "Upload files or create a new file or folder to get started.": "Upload files or create a new file or folder to get started.", "Uploads are stored as soon as they are chosen.": "Uploads are stored as soon as they are chosen.", + "Uptime": "Uptime", "Use HTTP Connection (http)": "Use HTTP Connection (http)", + "Use Regular Expression (Alt+R)": "Use Regular Expression (Alt+R)", "Use SSL Connection (https)": "Use SSL Connection (https)", "Use a hexadecimal color with 3, 4, 6, or 8 digits.": "Use a hexadecimal color with 3, 4, 6, or 8 digits.", "User": "User", "User #{{id}}": "User #{{id}}", "User Avatars": "User Avatars", "User Details": "User Details", + "User Email": "User Email", "User Mountable": "User Mountable", "User created": "User created", "User deleted": "User deleted", @@ -1149,45 +1678,107 @@ "Users Can Edit": "Users Can Edit", "Users Can View": "Users Can View", "Users who own servers cannot be deleted.": "Users who own servers cannot be deleted.", + "Using API Key": "Using API Key", + "Using SFTP": "Using SFTP", "Validation rules must be provided.": "Validation rules must be provided.", "Variable created": "Variable created", "Variable deleted": "Variable deleted", "Variable updated": "Variable updated", "Variables": "Variables", "Variables let server owners configure the startup command and environment.": "Variables let server owners configure the startup command and environment.", + "View additional event metadata": "View additional event metadata", + "View permissions for {{email}}": "View permissions for {{email}}", "View source": "View source", "View {{name}} connection details": "View {{name}} connection details", "Visible to guests": "Visible to guests", + "Visit {{url}} to generate a token.": "Visit {{url}} to generate a token.", + "Waiting for QR code to load...": "Waiting for QR code to load...", "Warning!": "Warning!", + "We're having some trouble connecting to your server, please wait...": "We're having some trouble connecting to your server, please wait...", "Where connections should be allowed from. Leave blank to allow connections from anywhere.": "Where connections should be allowed from. Leave blank to allow connections from anywhere.", + "Wings reported an error without additional details.": "Wings reported an error without additional details.", "Wings {{version}}": "Wings {{version}}", + "Yes, reinstall server": "Yes, reinstall server", + "Yes, remove subuser": "Yes, remove subuser", + "You are currently using {{used}} of {{limit}} allowed allocations for this server.": "You are currently using {{used}} of {{limit}} allowed allocations for this server.", "You are running version {{current}}.": "You are running version {{current}}.", "You are running version {{current}}; the latest available is {{latest}}.": "You are running version {{current}}; the latest available is {{latest}}.", "You are using reCAPTCHA keys that shipped with this Panel. Generate new invisible reCAPTCHA keys for this website to improve security.": "You are using reCAPTCHA keys that shipped with this Panel. Generate new invisible reCAPTCHA keys for this website to improve security.", + "You can either generate a new one and enter it below or leave the field blank to remove it completely.": "You can either generate a new one and enter it below or leave the field blank to remove it completely.", + "You do not currently have two-step verification enabled on your account. Click the button below to begin configuring it.": "You do not currently have two-step verification enabled on your account. Click the button below to begin configuring it.", + "You do not have permission to access the administrative area.": "You do not have permission to access the administrative area.", + "You do not have permission to access this page.": "You do not have permission to access this page.", + "You have unsaved changes. Leave this page and discard them?": "You have unsaved changes. Leave this page and discard them?", + "You may select a custom avatar for your personal account. PNG, JPEG, SVG, WebP, AVIF, and ICO files are supported.": "You may select a custom avatar for your personal account. PNG, JPEG, SVG, WebP, AVIF, and ICO files are supported.", + "You must enter the 6-digit code and your password to continue.": "You must enter the 6-digit code and your password to continue.", + "You must enter your account password to continue.": "You must enter your account password to continue.", "You must have at least one node configured before you can add a server to this panel.": "You must have at least one node configured before you can add a server to this panel.", + "You must provide your current account password.": "You must provide your current account password.", + "You must provide your current password.": "You must provide your current password.", + "You need to authenticate with your Hytale account to download or update server files. Please log in to continue.": "You need to authenticate with your Hytale account to download or update server files. Please log in to continue.", "You see the active theme again. Reload the page to see it.": "You see the active theme again. Reload the page to see it.", "You see the theme until you stop the preview; nobody else does. Reload the page to see it.": "You see the theme until you stop the preview; nobody else does. Reload the page to see it.", "You see {{name}} until you stop the preview; nobody else does. Reload the page to see it.": "You see {{name}} until you stop the preview; nobody else does. Reload the page to see it.", + "You will not be able to recover the contents of {{name}} once deleted.": "You will not be able to recover the contents of {{name}} once deleted.", + "You're editing a {{file}} file. Any files or directories listed in here will be excluded from backups. Wildcards are supported by using an asterisk ({{wildcard}}). You can negate a prior rule by prepending an exclamation point ({{negation}}).": "You're editing a {{file}} file. Any files or directories listed in here will be excluded from backups. Wildcards are supported by using an asterisk ({{wildcard}}). You can negate a prior rule by prepending an exclamation point ({{negation}}).", + "Your API key": "Your API key", + "Your SFTP password is the same as the password you use to access this panel.": "Your SFTP password is the same as the password you use to access this panel.", + "Your account must have two-factor authentication enabled in order to continue.": "Your account must have two-factor authentication enabled in order to continue.", "Your new API key": "Your new API key", + "Your new password does not match.": "Your new password does not match.", + "Your new password should be at least 8 characters in length and unique to this website.": "Your new password should be at least 8 characters in length and unique to this website.", + "Your new password should be at least 8 characters in length.": "Your new password should be at least 8 characters in length.", "Your panel is up-to-date.": "Your panel is up-to-date.", + "Your server is being transferred to a new node, please check back later.": "Your server is being transferred to a new node, please check back later.", + "Your server is currently being restored from a backup, please check back in a few minutes.": "Your server is currently being restored from a backup, please check back in a few minutes.", + "Your server should be ready soon, please try again in a few minutes.": "Your server should be ready soon, please try again in a few minutes.", + "Your server will be stopped and some files may be deleted or modified during this process, are you sure you wish to continue?": "Your server will be stopped and some files may be deleted or modified during this process, are you sure you wish to continue?", + "Your server will be stopped. You will not be able to control the power state, access the file manager, or create additional backups until completed.": "Your server will be stopped. You will not be able to control the power state, access the file manager, or create additional backups until completed.", + "active": "active", + "and {{number}} others": "and {{number}} others", + "any value": "any value", + "backups": "backups", "by {{author}}": "by {{author}}", + "every 5 minutes": "every 5 minutes", + "every Monday": "every Monday", + "every Monday and Friday": "every Monday and Friday", + "every hour": "every hour", + "hour range": "hour range", + "inactive": "inactive", "items": "items", + "n/a": "n/a", "new": "new", + "of {{limit}}": "of {{limit}}", + "on the hour and half past": "on the hour and half past", + "once a day": "once a day", + "processing": "processing", + "range values": "range values", "reCAPTCHA": "reCAPTCHA", "reCAPTCHA Enabled": "reCAPTCHA Enabled", "reCAPTCHA Secret Key": "reCAPTCHA Secret Key", "reCAPTCHA Website Key": "reCAPTCHA Website Key", + "step values": "step values", "suspended": "suspended", "up to {{size}} KB": "up to {{size}} KB", + "value list separator": "value list separator", + "{{address}} is available.": "{{address}} is available.", + "{{allocated}} of {{limit}} databases have been allocated to this server.": "{{allocated}} of {{limit}} databases have been allocated to this server.", "{{count}} allocations_one": "{{count}} allocation", "{{count}} allocations_other": "{{count}} allocations", + "{{count}} databases_one": "{{count}} database", + "{{count}} databases_other": "{{count}} databases", "{{count}} eggs_one": "{{count}} egg", "{{count}} eggs_other": "{{count}} eggs", "{{count}} extensions need attention_one": "{{count}} extension needs attention", "{{count}} extensions need attention_other": "{{count}} extensions need attention", "{{count}} nodes_one": "{{count}} node", "{{count}} nodes_other": "{{count}} nodes", + "{{created}} of {{limit}} backups have been created for this server.": "{{created}} of {{limit}} backups have been created for this server.", + "{{days}}d {{hours}}h {{minutes}}m": "{{days}}d {{hours}}h {{minutes}}m", "{{email}} avatar": "{{email}} avatar", + "{{email}} has been invited.": "{{email}} has been invited.", + "{{email}} no longer has access to this server.": "{{email}} no longer has access to this server.", + "{{hours}}h {{minutes}}m {{seconds}}s": "{{hours}}h {{minutes}}m {{seconds}}s", "{{image}} (custom)": "{{image}} (custom)", "{{label}} item {{number}}": "{{label}} item {{number}}", "{{label}} picker": "{{label}} picker", @@ -1206,6 +1797,7 @@ "{{name}} has been installed.": "{{name}} has been installed.", "{{name}} has been installed. Reload the page to apply it.": "{{name}} has been installed. Reload the page to apply it.", "{{name}} has been mounted to this server.": "{{name}} has been mounted to this server.", + "{{name}} has been removed.": "{{name}} has been removed.", "{{name}} has been removed. Reload the page to apply it.": "{{name}} has been removed. Reload the page to apply it.", "{{name}} has been unmounted from this server.": "{{name}} has been unmounted from this server.", "{{name}} has been updated from the uploaded file.": "{{name}} has been updated from the uploaded file.", @@ -1213,14 +1805,19 @@ "{{name}} has updated build settings.": "{{name}} has updated build settings.", "{{name}} has updated startup settings.": "{{name}} has updated startup settings.", "{{name}} is already in the other list.": "{{name}} is already in the other list.", + "{{name}} is being created.": "{{name}} is being created.", + "{{name}} is being restored.": "{{name}} is being restored.", "{{name}} is now active. Reload the page to see it.": "{{name}} is now active. Reload the page to see it.", + "{{name}} is ready to use.": "{{name}} is ready to use.", "{{name}} settings": "{{name}} settings", "{{nodes}} nodes · {{servers}} servers": "{{nodes}} nodes · {{servers}} servers", "{{node}} only accepts eggs tagged {{tags}}.": "{{node}} only accepts eggs tagged {{tags}}.", + "{{number}} files are uploading, click to view": "{{number}} files are uploading, click to view", + "{{seconds}}s later": "{{seconds}}s later", "{{selected}} selected": "{{selected}} selected", "{{title}} usage": "{{title}} usage", - "{{total}} databases": "{{total}} databases", "{{total}} granted": "{{total}} granted", + "{{total}} selected": "{{total}} selected", "{{unassigned}} unassigned": "{{unassigned}} unassigned", "{{used}} of {{limit}} databases have been allocated to this server.": "{{used}} of {{limit}} databases have been allocated to this server." } diff --git a/resources/lang/en/admin/node.php b/resources/lang/en/admin/node.php deleted file mode 100644 index c0529a116..000000000 --- a/resources/lang/en/admin/node.php +++ /dev/null @@ -1,18 +0,0 @@ - [ - 'fqdn_not_resolvable' => 'The FQDN or IP address provided does not resolve to a valid IP address.', - 'fqdn_required_for_ssl' => 'A fully qualified domain name that resolves to a public IP address is required in order to use SSL for this node.', - ], - 'notices' => [ - 'allocations_added' => 'Allocations have successfully been added to this node.', - 'node_deleted' => 'Node has been successfully removed from the panel.', - 'location_required' => 'You must have at least one location configured before you can add a node to this panel.', - 'node_created' => 'Successfully created new node. You can automatically configure the daemon on this machine by visiting the \'Configuration\' tab. Before you can add any servers you must first allocate at least one IP address and port.', - 'node_updated' => 'Node information has been updated. If any daemon settings were changed you will need to reboot it for those changes to take effect.', - 'unallocated_deleted' => 'Deleted all un-allocated ports for :ip.', - ], -]; diff --git a/resources/lang/en/admin/server.php b/resources/lang/en/admin/server.php deleted file mode 100644 index 0a7582a90..000000000 --- a/resources/lang/en/admin/server.php +++ /dev/null @@ -1,30 +0,0 @@ - [ - 'no_new_default_allocation' => 'You are attempting to delete the default allocation for this server but there is no fallback allocation to use.', - 'skipping_install_script' => "This server is configured to skip its egg's install script. Reinstalling is not available until that setting is disabled.", - 'marked_as_failed' => 'This server was marked as having failed a previous installation. Current status cannot be toggled in this state.', - 'bad_variable' => 'There was a validation error with the :name variable.', - 'daemon_exception' => 'There was an exception while attempting to communicate with the daemon resulting in a HTTP/:code response code. This exception has been logged. (request id: :request_id)', - 'default_allocation_not_found' => "The requested default allocation was not found in this server's allocations.", - ], - 'alerts' => [ - 'startup_changed' => "The startup configuration for this server has been updated. If this server's nest or egg was changed a reinstall will be occurring now.", - 'server_deleted' => 'Server has successfully been deleted from the system.', - 'server_created' => 'Server was successfully created on the panel. Please allow the daemon a few minutes to completely install this server.', - 'build_updated' => 'The build details for this server have been updated. Some changes may require a restart to take effect.', - 'suspension_toggled' => 'Server suspension status has been changed to :status.', - 'rebuild_on_boot' => 'This server has been marked as requiring a Docker Container rebuild. This will happen the next time the server is started.', - 'install_toggled' => 'The installation status for this server has been toggled.', - 'server_reinstalled' => 'This server has been queued for a reinstallation beginning now.', - 'details_updated' => 'Server details have been successfully updated.', - 'docker_image_updated' => 'Successfully changed the default Docker image to use for this server. A reboot is required to apply this change.', - 'node_required' => 'You must have at least one node configured before you can add a server to this panel.', - 'transfer_nodes_required' => 'You must have at least two nodes configured before you can transfer servers.', - 'transfer_started' => 'Server transfer has been started.', - 'transfer_not_viable' => 'The node you selected does not have the required disk space or memory available to accommodate this server.', - ], -]; diff --git a/resources/lang/en/admin/user.php b/resources/lang/en/admin/user.php deleted file mode 100644 index 02e945c0d..000000000 --- a/resources/lang/en/admin/user.php +++ /dev/null @@ -1,14 +0,0 @@ - [ - 'delete_self' => 'You cannot delete your own account.', - 'user_has_servers' => 'Cannot delete a user with active servers attached to their account. Please delete their servers before continuing.', - ], - 'notices' => [ - 'account_created' => 'Account has been created successfully.', - 'account_updated' => 'Account has been successfully updated.', - ], -]; diff --git a/resources/lang/en/auth.php b/resources/lang/en/auth.php index 68c05ee0a..295a60e28 100644 --- a/resources/lang/en/auth.php +++ b/resources/lang/en/auth.php @@ -21,6 +21,8 @@ return [ 'label' => '2-Factor Token', 'label_help' => 'This account requires a second layer of authentication in order to continue. Please enter the code generated by your device to complete this login.', 'checkpoint_failed' => 'The two-factor authentication token was invalid.', + 'checkpoint_expired' => 'The authentication token provided has expired, please refresh the page and try again.', + 'recovery_token_invalid' => 'The recovery token provided is not valid.', ], 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', diff --git a/resources/lang/en/dashboard/account.php b/resources/lang/en/dashboard/account.php deleted file mode 100644 index 2f7cb0d54..000000000 --- a/resources/lang/en/dashboard/account.php +++ /dev/null @@ -1,30 +0,0 @@ - [ - 'title' => 'Update your email', - 'updated' => 'Your email address has been updated.', - ], - 'password' => [ - 'title' => 'Change your password', - 'requirements' => 'Your new password should be at least 8 characters in length.', - 'updated' => 'Your password has been updated.', - ], - 'two_factor' => [ - 'button' => 'Configure 2-Factor Authentication', - 'disabled' => 'Two-factor authentication has been disabled on your account. You will no longer be prompted to provide a token when logging in.', - 'enabled' => 'Two-factor authentication has been enabled on your account! From now on, when logging in, you will be required to provide the code generated by your device.', - 'invalid' => 'The token provided was invalid.', - 'setup' => [ - 'title' => 'Setup two-factor authentication', - 'help' => 'Can\'t scan the code? Enter the code below into your application:', - 'field' => 'Enter token', - ], - 'disable' => [ - 'title' => 'Disable two-factor authentication', - 'field' => 'Enter token', - ], - ], -]; diff --git a/resources/lang/en/dashboard/index.php b/resources/lang/en/dashboard/index.php deleted file mode 100644 index 682534616..000000000 --- a/resources/lang/en/dashboard/index.php +++ /dev/null @@ -1,10 +0,0 @@ - 'Search for servers...', - 'no_matches' => 'There were no servers found matching the search criteria provided.', - 'cpu_title' => 'CPU', - 'memory_title' => 'Memory', -]; diff --git a/resources/lang/en/exceptions.php b/resources/lang/en/exceptions.php index 179a7c2da..362913098 100644 --- a/resources/lang/en/exceptions.php +++ b/resources/lang/en/exceptions.php @@ -4,6 +4,11 @@ declare(strict_types=1); return [ 'daemon_connection_failed' => 'There was an exception while attempting to communicate with the daemon resulting in a HTTP/:code response code. This exception has been logged.', + 'daemon' => [ + 'unreachable' => 'Could not establish a connection to the machine running this server. Please try again.', + 'communication_error' => 'There was an error while communicating with the machine running this server. This error has been logged, please try again. (code: :code) (request_id: :request_id)', + 'remote_error' => 'An error occurred on the remote host: :error. (request id: :request_id)', + ], 'node' => [ 'servers_attached' => 'A node must have no servers linked to it in order to be deleted.', 'daemon_off_config_updated' => 'The daemon configuration has been updated, however there was an error encountered while attempting to automatically update the configuration file on the Daemon. You will need to manually update the configuration file (config.yml) for the daemon to apply these changes.', @@ -14,6 +19,12 @@ return [ 'invalid_mapping' => 'The mapping provided for :port was invalid and could not be processed.', 'cidr_out_of_range' => 'CIDR notation only allows masks between /25 and /32.', 'port_out_of_range' => 'Ports in an allocation must be greater than 1024 and less than or equal to 65535.', + 'invalid_ip' => 'Could not parse provided allocation IP address (:ip): :error', + 'limit_reached' => 'Cannot assign additional allocations to this server: limit has been reached.', + 'no_limit_set' => 'You cannot delete allocations for this server: no allocation limit is set.', + 'delete_primary' => 'You cannot delete the primary allocation for this server.', + 'auto_allocation_disabled' => 'Server auto-allocation is not enabled for this instance.', + 'no_auto_allocation_space' => 'Cannot assign additional allocation: no more space available on node.', ], 'egg' => [ 'delete_has_servers' => 'An Egg with active servers attached to it cannot be deleted from the Panel.', @@ -27,24 +38,104 @@ return [ 'json_error' => 'There was an error while attempting to parse the JSON file: :error.', 'file_error' => 'The JSON file provided was not valid.', 'invalid_json_provided' => 'The JSON file provided is not in a format that can be recognized.', + 'invalid_file' => 'The selected file is not valid and cannot be imported.', + 'unreadable_file' => 'The selected file could not be read.', + 'invalid_field' => 'The egg field ":field" is missing or invalid.', + 'field_error' => 'The egg field ":field" is invalid: :error', + ], + 'catalog' => [ + 'unreachable' => 'Could not reach the Pterodactyl egg catalog. Please try again.', + 'download_failed' => 'Could not download from the Pterodactyl egg catalog. Please try again.', + 'invalid_catalog' => 'Pterodactyl returned an invalid egg catalog. Please try again later.', + 'invalid_definition' => 'The selected catalog egg contains an invalid definition.', + 'invalid_download_url' => 'The catalog egg has an invalid download URL.', + 'unofficial_download_url' => 'The catalog egg does not have an official Pterodactyl download URL.', + 'egg_missing' => 'The selected egg is no longer in the Pterodactyl catalog. Refresh the catalog and try again.', ], ], 'subusers' => [ 'editing_self' => 'Editing your own subuser account is not permitted.', 'user_is_owner' => 'You cannot add the server owner as a subuser for this server.', 'subuser_exists' => 'A user with that email address is already assigned as a subuser for this server.', + 'remove_exceeding_permissions' => 'Cannot remove a subuser that has permissions your account does not actively possess.', + 'assign_exceeding_permissions' => 'Cannot assign permissions to a subuser that your account does not actively possess.', ], 'databases' => [ 'delete_has_databases' => 'Cannot delete a database host server that has active databases linked to it.', + 'name_exists' => 'A database with that name already exists for this server.', + 'limit_reached' => 'Cannot create additional databases on this server: limit has been reached.', + 'too_many' => 'Operation aborted: creating a new database would put this server over the defined limit.', + 'no_suitable_host' => 'No database host was found that meets the requirements for this server.', + 'client_creation_disabled' => 'Client database creation is not enabled in this Panel.', + 'host_connection_failed' => 'There was an error while trying to connect to the host or while executing a query: ":error"', ], 'tasks' => [ 'chain_interval_too_long' => 'The maximum interval time for a chained task is 15 minutes.', ], + 'schedules' => [ + 'invalid_cron' => 'The cron data provided does not evaluate to a valid expression.', + 'backup_limit_zero' => "A backup task cannot be created when the server's backup limit is set to 0.", + 'too_many_tasks' => 'Schedules may not have more than :limit tasks associated with them. Creating this task would put this schedule over the limit.', + 'already_processing' => 'This schedule is already being processed.', + 'no_tasks' => 'Cannot process schedule for task execution: no tasks are registered.', + ], 'locations' => [ 'has_nodes' => 'Cannot delete a location that has active nodes attached to it.', ], 'users' => [ 'node_revocation_failed' => 'Failed to revoke keys on Node #:node. :error', + 'delete_self' => 'You cannot delete your own account.', + 'has_servers' => 'Cannot delete a user with active servers attached to their account. Please delete their servers before continuing.', + 'email_change_throttled' => 'Your email address has been changed too many times today. Please try again later.', + ], + 'account' => [ + 'api_key_limit' => 'You have reached the account limit for number of API keys.', + 'two_factor_enabled' => 'Two-factor authentication is already enabled on this account.', + 'two_factor_token_invalid' => 'The provided two-factor authentication token was not valid.', + 'two_factor_required' => 'Two-factor authentication is required on this account in order to access this endpoint.', + ], + 'server' => [ + 'unsupported_state' => 'This server is currently in an unsupported state, please try again later.', + 'suspended' => 'This server is currently suspended and the functionality requested is unavailable.', + 'node_maintenance' => 'The node of this server is currently under maintenance and the functionality requested is unavailable.', + 'not_installed' => 'This server has not yet completed its installation process, please try again later.', + 'restoring_backup' => 'This server is currently restoring from a backup, please try again later.', + 'transferring' => 'This server is currently being transferred to a new machine, please try again later.', + 'installation_state' => 'Access to this resource is not allowed due to the current installation state.', + 'marked_as_failed' => 'This server was marked as having failed a previous installation. Current status cannot be toggled in this state.', + 'skipping_install_script' => "This server is configured to skip its egg's install script. Reinstalling is not available until that setting is disabled.", + 'transfer_not_viable' => 'The node you selected does not have the required disk space or memory available to accommodate this server.', + 'transfer_allocations_unavailable' => 'The selected allocations are no longer available on the target node.', + 'transfer_suspension' => 'Cannot toggle suspension status on a server that is currently being transferred.', + 'no_new_default_allocation' => 'You are attempting to delete the default allocation for this server but there is no fallback allocation to use.', + 'default_allocation_not_assigned' => 'The requested default allocation is not currently assigned to this server.', + 'offline_command' => 'Server must be online in order to send commands.', + 'docker_image_locked' => "This server's Docker image has been manually set by an administrator and cannot be updated.", + 'variable_read_only' => 'The environment variable you are trying to edit is read-only.', + 'websocket_forbidden' => "You do not have permission to connect to this server's websocket.", + 'transfer_logs_forbidden' => 'You do not have permission to view server transfer logs.', + ], + 'backups' => [ + 'locked' => 'Cannot delete a backup that is marked as locked.', + 'limit_reached' => 'Cannot create a new backup, this server has reached its limit of :limit backups.', + 'throttled' => 'Only :limit backups may be generated within a :period second span of time.', + 'unknown_disk' => 'The backup requested references an unknown disk driver type and cannot be downloaded.', + 'restore_unavailable' => 'This server is not currently in a state that allows for a backup to be restored.', + 'restore_incomplete' => 'This backup cannot be restored at this time: not completed or failed.', + ], + 'files' => [ + 'too_large' => 'The file you are attempting to open is too large to view in the file editor.', + ], + 'tags' => [ + 'builtin_delete' => 'Built-in game tags cannot be deleted.', + 'builtin_edit' => 'Built-in game tags cannot be edited.', + 'kind_clash' => 'These tags are already on the node as the other kind: :tags.', + ], + 'mail' => [ + 'smtp_only' => 'This feature is only available if SMTP is the selected email driver for the Panel.', + ], + 'extensions' => [ + 'fields_forbidden' => 'You are not allowed to change the :extension fields.', ], 'deployment' => [ 'no_viable_nodes' => 'No nodes satisfying the requirements specified for automatic deployment could be found.', @@ -52,5 +143,19 @@ return [ ], 'api' => [ 'resource_not_found' => 'The requested resource does not exist on this server.', + 'unexpected_error' => 'An unexpected error was encountered while processing this request, please try again.', + 'model_not_found' => 'The requested resource could not be found on the server.', + 'resource_not_on_server' => 'The requested resource was not found for this server.', + 'resource_not_on_system' => 'The requested resource does not exist on the system.', + 'malformed_json' => 'The JSON data passed in the request appears to be malformed: :error', + 'unauthenticated' => 'This endpoint requires an authenticated user.', + 'unauthorized' => 'This action is unauthorized.', + 'recaptcha_failed' => 'Failed to validate reCAPTCHA data.', + 'application_key_rejected' => 'You are attempting to use an application API key on an endpoint that does not accept them.', + 'client_key_required' => 'You are attempting to use an application API key on an endpoint that requires a client API key.', + 'key_forbidden' => 'This API key does not have permission to access this resource.', + 'account_forbidden' => 'This account does not have permission to access the API.', + 'invalid_ip' => 'The request did not contain a valid IP address.', + 'ip_forbidden' => 'This IP address (:ip) does not have permission to access the API using these credentials.', ], ]; diff --git a/resources/lang/en/notifications.php b/resources/lang/en/notifications.php new file mode 100644 index 000000000..d8c4b6ea6 --- /dev/null +++ b/resources/lang/en/notifications.php @@ -0,0 +1,51 @@ + 'Hello!', + 'greeting_error' => 'Whoops!', + 'salutation' => 'Regards,', + 'action_help' => 'If you’re having trouble clicking the ":action" button, copy and paste the URL below into your web browser:', + 'copyright' => 'All rights reserved.', + 'account_created' => [ + 'subject' => 'Account Created', + 'greeting' => 'Hello :name!', + 'intro' => 'You are receiving this email because an account has been created for you on :app.', + 'username' => 'Username: :username', + 'email' => 'Email: :email', + 'action' => 'Setup Your Account', + ], + 'added_to_server' => [ + 'subject' => 'Added To Server', + 'greeting' => 'Hello :name!', + 'intro' => 'You have been added as a subuser for the following server, allowing you certain control over the server.', + 'server' => 'Server Name: :server', + 'action' => 'Visit Server', + ], + 'removed_from_server' => [ + 'subject' => 'Removed From Server', + 'greeting' => 'Hello :name.', + 'intro' => 'You have been removed as a subuser for the following server.', + 'server' => 'Server Name: :server', + 'action' => 'Visit Panel', + ], + 'mail_tested' => [ + 'subject' => 'Pterodactyl Test Message', + 'greeting' => 'Hello :name!', + 'intro' => "This is a test of the Pterodactyl mail system. You're good to go!", + ], + 'password_reset' => [ + 'subject' => 'Reset Password', + 'intro' => 'You are receiving this email because we received a password reset request for your account.', + 'action' => 'Reset Password', + 'outro' => 'If you did not request a password reset, no further action is required.', + ], + 'server_installed' => [ + 'subject' => 'Server Installed', + 'greeting' => 'Hello :name.', + 'intro' => 'Your server has finished installing and is now ready for you to use.', + 'server' => 'Server Name: :server', + 'action' => 'Login and Begin Using', + ], +]; diff --git a/resources/lang/en/permissions.php b/resources/lang/en/permissions.php new file mode 100644 index 000000000..4a5ccef17 --- /dev/null +++ b/resources/lang/en/permissions.php @@ -0,0 +1,101 @@ + [ + 'description' => 'Allows the user to connect to the server websocket, giving them access to view console output and realtime server stats.', + 'keys' => [ + 'connect' => 'Allows a user to connect to the websocket instance for a server to stream the console.', + ], + ], + 'control' => [ + 'description' => "Permissions that control a user's ability to control the power state of a server, or send commands.", + 'keys' => [ + 'console' => 'Allows a user to send commands to the server instance via the console.', + 'start' => 'Allows a user to start the server if it is stopped.', + 'stop' => 'Allows a user to stop a server if it is running.', + 'restart' => 'Allows a user to perform a server restart. This allows them to start the server if it is offline, but not put the server in a completely stopped state.', + ], + ], + 'user' => [ + 'description' => 'Permissions that allow a user to manage other subusers on a server. They will never be able to edit their own account, or assign permissions they do not have themselves.', + 'keys' => [ + 'create' => 'Allows a user to create new subusers for the server.', + 'read' => 'Allows the user to view subusers and their permissions for the server.', + 'update' => 'Allows a user to modify other subusers.', + 'delete' => 'Allows a user to delete a subuser from the server.', + ], + ], + 'file' => [ + 'description' => "Permissions that control a user's ability to modify the filesystem for this server.", + 'keys' => [ + 'create' => 'Allows a user to create additional files and folders via the Panel. Uploading, pulling remote files, and decompressing archives also require the update permission.', + 'read' => 'Allows a user to view the contents of a directory, but not view the contents of or download files.', + 'read-content' => 'Allows a user to view the contents of a given file. This will also allow the user to download files.', + 'update' => 'Allows a user to update the contents of an existing file or directory.', + 'delete' => 'Allows a user to delete files or directories.', + 'archive' => 'Allows a user to archive the contents of a directory as well as decompress existing archives on the system.', + 'sftp' => 'Allows a user to connect to SFTP and manage server files using the other assigned file permissions.', + ], + ], + 'backup' => [ + 'description' => "Permissions that control a user's ability to generate and manage server backups.", + 'keys' => [ + 'create' => 'Allows a user to create new backups for this server.', + 'read' => 'Allows a user to view all backups that exist for this server.', + 'delete' => 'Allows a user to remove backups from the system.', + 'download' => 'Allows a user to download a backup for the server. Danger: this allows a user to access all files for the server in the backup.', + 'restore' => 'Allows a user to restore a backup for the server. Danger: this allows the user to delete all of the server files in the process.', + ], + ], + 'allocation' => [ + 'description' => "Permissions that control a user's ability to modify the port allocations for this server.", + 'keys' => [ + 'read' => 'Allows a user to view all allocations currently assigned to this server. Users with any level of access to this server can always view the primary allocation.', + 'create' => 'Allows a user to assign additional allocations to the server.', + 'update' => 'Allows a user to change the primary server allocation and attach notes to each allocation.', + 'delete' => 'Allows a user to delete an allocation from the server.', + ], + ], + 'startup' => [ + 'description' => "Permissions that control a user's ability to view this server's startup parameters.", + 'keys' => [ + 'read' => 'Allows a user to view the startup variables for a server.', + 'update' => 'Allows a user to modify the startup variables for the server.', + 'docker-image' => 'Allows a user to modify the Docker image used when running the server.', + ], + ], + 'database' => [ + 'description' => "Permissions that control a user's access to the database management for this server.", + 'keys' => [ + 'create' => 'Allows a user to create a new database for this server.', + 'read' => 'Allows a user to view the database associated with this server.', + 'update' => 'Allows a user to rotate the password on a database instance. If the user does not have the view_password permission they will not see the updated password.', + 'delete' => 'Allows a user to remove a database instance from this server.', + 'view_password' => 'Allows a user to view the password associated with a database instance for this server.', + ], + ], + 'schedule' => [ + 'description' => "Permissions that control a user's access to the schedule management for this server.", + 'keys' => [ + 'create' => 'Allows a user to create new schedules for this server.', + 'read' => 'Allows a user to view schedules and the tasks associated with them for this server.', + 'update' => 'Allows a user to update schedules and schedule tasks for this server.', + 'delete' => 'Allows a user to delete schedules for this server.', + ], + ], + 'settings' => [ + 'description' => "Permissions that control a user's access to the settings for this server.", + 'keys' => [ + 'rename' => 'Allows a user to rename this server and change the description of it.', + 'reinstall' => 'Allows a user to trigger a reinstall of this server.', + ], + ], + 'activity' => [ + 'description' => "Permissions that control a user's access to the server activity logs.", + 'keys' => [ + 'read' => 'Allows a user to view the activity logs for the server.', + ], + ], +]; diff --git a/resources/lang/en/server/users.php b/resources/lang/en/server/users.php deleted file mode 100644 index bb06d0707..000000000 --- a/resources/lang/en/server/users.php +++ /dev/null @@ -1,35 +0,0 @@ - [ - 'websocket_*' => 'Allows access to the websocket for this server.', - 'control_console' => 'Allows the user to send data to the server console.', - 'control_start' => 'Allows the user to start the server instance.', - 'control_stop' => 'Allows the user to stop the server instance.', - 'control_restart' => 'Allows the user to restart the server instance.', - 'control_kill' => 'Allows the user to kill the server instance.', - 'user_create' => 'Allows the user to create new user accounts for the server.', - 'user_read' => 'Allows the user permission to view users associated with this server.', - 'user_update' => 'Allows the user to modify other users associated with this server.', - 'user_delete' => 'Allows the user to delete other users associated with this server.', - 'file_create' => 'Allows the user permission to create new files and directories.', - 'file_read' => 'Allows the user to see files and folders associated with this server instance, as well as view their contents.', - 'file_update' => 'Allows the user to update files and folders associated with the server.', - 'file_delete' => 'Allows the user to delete files and directories.', - 'file_archive' => 'Allows the user to create file archives and decompress existing archives.', - 'file_sftp' => 'Allows the user to perform the above file actions using a SFTP client.', - 'allocation_read' => 'Allows access to the server allocation management pages.', - 'allocation_update' => 'Allows user permission to make modifications to the server\'s allocations.', - 'database_create' => 'Allows user permission to create a new database for the server.', - 'database_read' => 'Allows user permission to view the server databases.', - 'database_update' => 'Allows a user permission to make modifications to a database. If the user does not have the "View Password" permission as well they will not be able to modify the password.', - 'database_delete' => 'Allows a user permission to delete a database instance.', - 'database_view_password' => 'Allows a user permission to view a database password in the system.', - 'schedule_create' => 'Allows a user to create a new schedule for the server.', - 'schedule_read' => 'Allows a user permission to view schedules for a server.', - 'schedule_update' => 'Allows a user permission to make modifications to an existing server schedule.', - 'schedule_delete' => 'Allows a user to delete a schedule for the server.', - ], -]; diff --git a/resources/lang/en/strings.php b/resources/lang/en/strings.php deleted file mode 100644 index 52622710e..000000000 --- a/resources/lang/en/strings.php +++ /dev/null @@ -1,97 +0,0 @@ - 'Email', - 'email_address' => 'Email address', - 'user_identifier' => 'Username or Email', - 'password' => 'Password', - 'new_password' => 'New password', - 'confirm_password' => 'Confirm new password', - 'login' => 'Login', - 'home' => 'Home', - 'servers' => 'Servers', - 'id' => 'ID', - 'name' => 'Name', - 'node' => 'Node', - 'connection' => 'Connection', - 'memory' => 'Memory', - 'cpu' => 'CPU', - 'disk' => 'Disk', - 'status' => 'Status', - 'search' => 'Search', - 'suspended' => 'Suspended', - 'account' => 'Account', - 'security' => 'Security', - 'ip' => 'IP Address', - 'last_activity' => 'Last Activity', - 'revoke' => 'Revoke', - '2fa_token' => 'Authentication Token', - 'submit' => 'Submit', - 'close' => 'Close', - 'settings' => 'Settings', - 'configuration' => 'Configuration', - 'sftp' => 'SFTP', - 'databases' => 'Databases', - 'memo' => 'Memo', - 'created' => 'Created', - 'expires' => 'Expires', - 'public_key' => 'Token', - 'api_access' => 'Api Access', - 'never' => 'never', - 'sign_out' => 'Sign out', - 'admin_control' => 'Admin Control', - 'required' => 'Required', - 'port' => 'Port', - 'username' => 'Username', - 'database' => 'Database', - 'new' => 'New', - 'danger' => 'Danger', - 'create' => 'Create', - 'select_all' => 'Select All', - 'select_none' => 'Select None', - 'alias' => 'Alias', - 'primary' => 'Primary', - 'make_primary' => 'Make Primary', - 'none' => 'None', - 'cancel' => 'Cancel', - 'created_at' => 'Created At', - 'action' => 'Action', - 'data' => 'Data', - 'queued' => 'Queued', - 'last_run' => 'Last Run', - 'next_run' => 'Next Run', - 'not_run_yet' => 'Not Run Yet', - 'yes' => 'Yes', - 'no' => 'No', - 'delete' => 'Delete', - '2fa' => '2FA', - 'logout' => 'Logout', - 'admin_cp' => 'Admin Control Panel', - 'optional' => 'Optional', - 'read_only' => 'Read Only', - 'relation' => 'Relation', - 'owner' => 'Owner', - 'admin' => 'Admin', - 'subuser' => 'Subuser', - 'captcha_invalid' => 'The provided captcha is invalid.', - 'tasks' => 'Tasks', - 'seconds' => 'Seconds', - 'minutes' => 'Minutes', - 'under_maintenance' => 'Under Maintenance', - 'days' => [ - 'sun' => 'Sunday', - 'mon' => 'Monday', - 'tues' => 'Tuesday', - 'wed' => 'Wednesday', - 'thurs' => 'Thursday', - 'fri' => 'Friday', - 'sat' => 'Saturday', - ], - 'last_used' => 'Last Used', - 'enable' => 'Enable', - 'disable' => 'Disable', - 'save' => 'Save', - 'copyright' => '© 2015 - :year Pterodactyl Software', -]; diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php index d4793e66d..a3238bcd5 100644 --- a/resources/lang/en/validation.php +++ b/resources/lang/en/validation.php @@ -86,6 +86,7 @@ return [ 'unique' => 'The :attribute has already been taken.', 'uploaded' => 'The :attribute failed to upload.', 'url' => 'The :attribute format is invalid.', + 'node_accepts_egg' => ':node only accepts eggs tagged :tags.', /* |-------------------------------------------------------------------------- @@ -104,5 +105,23 @@ return [ 'internal' => [ 'variable_value' => ':env variable', 'invalid_password' => 'The password provided was invalid for this account.', + 'fqdn_unresolvable' => 'The :attribute could not be resolved to a valid IP address.', + 'fqdn_ip_with_https' => 'The :attribute must not be an IP address when HTTPS is enabled.', + 'path_within' => 'The :field path cannot be or reside within [:path].', + 'path_reserved' => 'The :field path cannot be [:path].', + 'tag_slug_numeric' => 'A tag slug cannot be purely numeric (reserved for tag and legacy nest IDs).', + 'docker_images_empty' => 'The :attribute field must list at least one image.', + 'docker_image_invalid' => 'The :attribute entry ":image" is not a valid Docker image.', + 'username' => 'The :attribute must start and end with alpha-numeric characters and contain only letters, numbers, dashes, underscores, and periods.', + 'email_leading_dash' => 'The :attribute must not start with a dash.', + 'database_name_in_use' => 'The database name you have selected is already in use by this server.', + 'extension_field_value' => 'The :attribute field must be a string, number, boolean, or a list of them.', + 'extension_setting' => [ + 'color' => 'The :attribute must be a hex colour such as #1f2933 or an oklch() colour such as oklch(0.62 0.19 259.8).', + 'number' => 'The :attribute must be a number.', + 'toggle' => 'The :attribute must be true or false.', + 'select' => 'The selected :attribute is not one of the options.', + 'text' => 'The :attribute must be text.', + ], ], ]; diff --git a/resources/scripts/api/account/api-keys/queries.ts b/resources/scripts/api/account/api-keys/queries.ts index 116162dc4..d7110a04c 100644 --- a/resources/scripts/api/account/api-keys/queries.ts +++ b/resources/scripts/api/account/api-keys/queries.ts @@ -1,4 +1,5 @@ import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'; +import i18next from 'i18next'; import { toast } from 'sonner'; import { removeListItems, upsertListItem } from '@/api/queryData'; @@ -32,9 +33,9 @@ export const useCreateAccountApiKey = () => { queryClient.setQueryData(clientListAccountApiKeysQueryKey(), (current) => upsertListItem(current, created, (key) => key.attributes.identifier === created.attributes.identifier) ); - toast.success('API key created'); + toast.success(i18next.t('API key created')); }, - onError: (error) => notifyHttpError(error, 'Unable to create API key'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to create API key')), }); }; @@ -55,7 +56,7 @@ export const useDeleteAccountApiKey = () => { return { removed: previous?.data.find((item) => item.attributes.identifier === variables.path.identifier) }; }, onSuccess: () => { - toast.success('API key deleted'); + toast.success(i18next.t('API key deleted')); }, onSettled: () => { if (queryClient.isMutating({ mutationKey: clientDeleteAccountApiKeyMutation().mutationKey }) === 1) { @@ -77,7 +78,7 @@ export const useDeleteAccountApiKey = () => { ); } - notifyHttpError(error, 'Unable to delete API key'); + notifyHttpError(error, i18next.t('Unable to delete API key')); }, }); }; diff --git a/resources/scripts/api/account/queries.ts b/resources/scripts/api/account/queries.ts index fc8ff6b59..8964bea43 100644 --- a/resources/scripts/api/account/queries.ts +++ b/resources/scripts/api/account/queries.ts @@ -1,4 +1,5 @@ import { queryOptions, useMutation, useQuery, useQueryClient, type QueryClient } from '@tanstack/react-query'; +import i18next from 'i18next'; import { toast } from 'sonner'; import type { UserData } from '@/api/account/types'; import { getBootstrapUser } from '@/bootstrap'; @@ -65,9 +66,9 @@ export const useUpdateAccountEmail = () => { ...clientUpdateAccountEmailMutation(), onSuccess: (_data, variables) => { setCurrentUserQueryData(queryClient, { email: variables.body.email }); - toast.success('Email address updated'); + toast.success(i18next.t('Email address updated')); }, - onError: (error) => notifyHttpError(error, 'Unable to update email address'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to update email address')), }); }; @@ -75,7 +76,7 @@ export const useUpdateAccountPassword = () => useMutation({ ...clientUpdateAccountPasswordMutation(), onSuccess: () => window.location.assign('/auth/login'), - onError: (error) => notifyHttpError(error, 'Unable to update password'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to update password')), }); export const useUpdateAccountLanguage = () => { @@ -85,9 +86,9 @@ export const useUpdateAccountLanguage = () => { ...clientUpdateAccountLanguageMutation(), onSuccess: ({ attributes }) => { setCurrentUserQueryData(queryClient, { language: attributes.language }); - toast.success('Language updated'); + toast.success(i18next.t('Language updated')); }, - onError: (error) => notifyHttpError(error, 'Unable to update language'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to update language')), }); }; @@ -99,9 +100,9 @@ export const useUpdateAccountAvatar = () => { onSuccess: async ({ attributes }) => { setCurrentUserQueryData(queryClient, { avatar: attributes.avatar }); await queryClient.invalidateQueries({ queryKey: currentUserQueryKey }); - toast.success('Avatar updated'); + toast.success(i18next.t('Avatar updated')); }, - onError: (error) => notifyHttpError(error, 'Unable to update avatar'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to update avatar')), }); }; @@ -113,8 +114,8 @@ export const useDeleteAccountAvatar = () => { onSuccess: async () => { setCurrentUserQueryData(queryClient, { avatar: null }); await queryClient.invalidateQueries({ queryKey: currentUserQueryKey }); - toast.success('Avatar removed'); + toast.success(i18next.t('Avatar removed')); }, - onError: (error) => notifyHttpError(error, 'Unable to remove avatar'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to remove avatar')), }); }; diff --git a/resources/scripts/api/account/ssh-keys/queries.ts b/resources/scripts/api/account/ssh-keys/queries.ts index 8cc8269c2..44775f80c 100644 --- a/resources/scripts/api/account/ssh-keys/queries.ts +++ b/resources/scripts/api/account/ssh-keys/queries.ts @@ -1,4 +1,5 @@ import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'; +import i18next from 'i18next'; import { toast } from 'sonner'; import { removeListItems, upsertListItem } from '@/api/queryData'; @@ -32,9 +33,9 @@ export const useCreateSSHKey = () => { queryClient.setQueryData(clientListSshKeysQueryKey(), (current) => upsertListItem(current, key, (item) => item.attributes.fingerprint === key.attributes.fingerprint) ); - toast.success('SSH key created'); + toast.success(i18next.t('SSH key created')); }, - onError: (error) => notifyHttpError(error, 'Unable to create SSH key'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to create SSH key')), }); }; @@ -57,7 +58,7 @@ export const useDeleteSSHKey = () => { }; }, onSuccess: () => { - toast.success('SSH key deleted'); + toast.success(i18next.t('SSH key deleted')); }, onSettled: () => { if (queryClient.isMutating({ mutationKey: clientDeleteSshKeyMutation().mutationKey }) === 1) { @@ -79,7 +80,7 @@ export const useDeleteSSHKey = () => { ); } - notifyHttpError(error, 'Unable to delete SSH key'); + notifyHttpError(error, i18next.t('Unable to delete SSH key')); }, }); }; diff --git a/resources/scripts/api/account/two-factor/queries.ts b/resources/scripts/api/account/two-factor/queries.ts index cf82765bf..6d0c0ca00 100644 --- a/resources/scripts/api/account/two-factor/queries.ts +++ b/resources/scripts/api/account/two-factor/queries.ts @@ -1,4 +1,5 @@ import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'; +import i18next from 'i18next'; import { toast } from 'sonner'; import { setCurrentUserQueryData } from '@/api/account/queries'; @@ -18,9 +19,9 @@ export const useEnableAccountTwoFactor = () => { ...clientEnableTwoFactorAuthenticationMutation(), onSuccess: () => { setCurrentUserQueryData(queryClient, { useTotp: true }); - toast.success('Two-step verification enabled'); + toast.success(i18next.t('Two-step verification enabled')); }, - onError: (error) => notifyHttpError(error, 'Unable to enable two-step verification'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to enable two-step verification')), }); }; @@ -31,8 +32,8 @@ export const useDisableAccountTwoFactor = () => { ...clientDisableTwoFactorAuthenticationMutation(), onSuccess: () => { setCurrentUserQueryData(queryClient, { useTotp: false }); - toast.success('Two-step verification disabled'); + toast.success(i18next.t('Two-step verification disabled')); }, - onError: (error) => notifyHttpError(error, 'Unable to disable two-step verification'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to disable two-step verification')), }); }; diff --git a/resources/scripts/api/auth/queries.ts b/resources/scripts/api/auth/queries.ts index 8fab4c875..b39476fa1 100644 --- a/resources/scripts/api/auth/queries.ts +++ b/resources/scripts/api/auth/queries.ts @@ -1,4 +1,5 @@ import { useMutation } from '@tanstack/react-query'; +import i18next from 'i18next'; import { toast } from 'sonner'; import { authCompleteLoginCheckpointMutation, @@ -16,26 +17,26 @@ export const useLogin = () => onMutate: async () => { await authGetCsrfCookie(); }, - onError: (error) => notifyHttpError(error, 'Unable to log in'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to log in')), }); export const useLoginCheckpoint = () => useMutation({ ...authCompleteLoginCheckpointMutation(), - onError: (error) => notifyHttpError(error, 'Unable to verify two-step code'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to verify two-step code')), }); export const useRequestPasswordResetEmail = () => useMutation({ ...authRequestPasswordResetEmailMutation(), - onSuccess: (response) => toast.success(response.status || 'Password reset email sent'), - onError: (error) => notifyHttpError(error, 'Unable to request password reset'), + onSuccess: (response) => toast.success(response.status || i18next.t('Password reset email sent')), + onError: (error) => notifyHttpError(error, i18next.t('Unable to request password reset')), }); export const usePerformPasswordReset = () => useMutation({ ...authResetPasswordMutation(), - onError: (error) => notifyHttpError(error, 'Unable to reset password'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to reset password')), }); export const useLogout = () => diff --git a/resources/scripts/api/http.ts b/resources/scripts/api/http.ts index f06d40d78..7584e4614 100644 --- a/resources/scripts/api/http.ts +++ b/resources/scripts/api/http.ts @@ -1,5 +1,6 @@ import type { AxiosInstance, AxiosResponse } from 'axios'; import axios from 'axios'; +import i18next from 'i18next'; import { completeHttpProgress, startHttpProgress } from '@/state/httpProgress'; import { isObject, isString } from '@/lib/objects'; @@ -87,37 +88,66 @@ export function httpErrorToHuman(cause: unknown): string { } } - return cause instanceof Error ? cause.message : 'An unexpected error occurred.'; + return cause instanceof Error ? cause.message : i18next.t('An unexpected error occurred.'); } /** Validation messages keyed by the request path of the field they are about. */ export type ValidationErrors = Record; -/** The first message for each field a validation (422) response rejected. */ -export function httpValidationErrors(cause: unknown): ValidationErrors { +type ValidationFailure = { + field: string; + rule: string; + detail: string; +}; + +function responseErrors(cause: unknown): unknown[] { if (!axios.isAxiosError(cause) || cause.response?.status !== 422) { - return {}; + return []; } const data: unknown = cause.response.data; - if (!isObject(data) || !('errors' in data) || !Array.isArray(data.errors)) { - return {}; - } + return isObject(data) && 'errors' in data && Array.isArray(data.errors) ? data.errors : []; +} - const errors: ValidationErrors = {}; +function validationFailures(cause: unknown): ValidationFailure[] { + const failures: ValidationFailure[] = []; - for (const error of data.errors) { + for (const error of responseErrors(cause)) { if (!isObject(error) || !('detail' in error) || !isString(error.detail)) { continue; } - const field = 'meta' in error && isObject(error.meta) ? error.meta.source_field : undefined; + const meta = 'meta' in error && isObject(error.meta) ? error.meta : {}; + const field = 'source_field' in meta ? meta.source_field : undefined; - if (isString(field) && !(field in errors)) { - errors[field] = error.detail; + if (isString(field)) { + failures.push({ + field, + rule: 'rule' in meta && isString(meta.rule) ? meta.rule : '', + detail: error.detail, + }); + } + } + + return failures; +} + +/** The first message for each field a validation (422) response rejected. */ +export function httpValidationErrors(cause: unknown): ValidationErrors { + const errors: ValidationErrors = {}; + + for (const { field, detail } of validationFailures(cause)) { + if (!(field in errors)) { + errors[field] = detail; } } return errors; } + +export function httpValidationFailure(cause: unknown, field: string, rule: string): string | null { + return ( + validationFailures(cause).find((failure) => failure.field === field && failure.rule === rule)?.detail ?? null + ); +} diff --git a/resources/scripts/api/server/backups/queries.ts b/resources/scripts/api/server/backups/queries.ts index d8faeb43c..932be34f6 100644 --- a/resources/scripts/api/server/backups/queries.ts +++ b/resources/scripts/api/server/backups/queries.ts @@ -1,4 +1,5 @@ import { useQuery, useMutation, useQueryClient, type QueryClient } from '@tanstack/react-query'; +import i18next from 'i18next'; import { toast } from 'sonner'; import { useUpdateCurrentServer } from '@/api/server/queries'; @@ -100,9 +101,11 @@ export const useCreateServerBackup = () => { await queryClient.invalidateQueries({ queryKey: clientListServerBackupsQueryKey({ path: { server_uuid: path.server_uuid } }), }); - toast.success('Backup started', { description: `${backup.attributes.name} is being created.` }); + toast.success(i18next.t('Backup started'), { + description: i18next.t('{{name}} is being created.', { name: backup.attributes.name }), + }); }, - onError: (error) => notifyHttpError(error, 'Unable to create backup'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to create backup')), }); }; @@ -116,7 +119,7 @@ export const useDeleteServerBackup = () => { queryClient.invalidateQueries({ queryKey: clientListServerBackupsQueryKey({ path: { server_uuid: path.server_uuid } }), }), - onError: (error) => notifyHttpError(error, 'Unable to delete backup'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to delete backup')), }); }; @@ -132,7 +135,7 @@ export const useRestoreServerBackup = () => { attributes: { ...server.attributes, status: 'restoring_backup' }, })); }, - onError: (error) => notifyHttpError(error, 'Unable to restore backup'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to restore backup')), }); }; @@ -143,9 +146,9 @@ export const useToggleServerBackupLock = (page: number) => { ...clientToggleBackupLockMutation(), onSuccess: (updated, { path }) => { updateServerBackup(queryClient, path.server_uuid, page, path.backup_uuid, () => updated); - toast.success(updated.attributes.is_locked ? 'Backup locked' : 'Backup unlocked'); + toast.success(updated.attributes.is_locked ? i18next.t('Backup locked') : i18next.t('Backup unlocked')); }, - onError: (error) => notifyHttpError(error, 'Unable to update backup lock'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to update backup lock')), }); }; @@ -160,5 +163,5 @@ export const useBackupDownloadUrl = () => return data.attributes.url; }, - onError: (error) => notifyHttpError(error, 'Unable to create backup download'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to create backup download')), }); diff --git a/resources/scripts/api/server/databases/queries.ts b/resources/scripts/api/server/databases/queries.ts index 7ec88f405..63eee10ca 100644 --- a/resources/scripts/api/server/databases/queries.ts +++ b/resources/scripts/api/server/databases/queries.ts @@ -1,4 +1,5 @@ import { useQuery, useMutation, useQueryClient, type QueryClient } from '@tanstack/react-query'; +import i18next from 'i18next'; import { toast } from 'sonner'; import { removeListItems, upsertListItem } from '@/api/queryData'; @@ -92,9 +93,11 @@ export const useCreateServerDatabase = () => { ...clientCreateServerDatabaseMutation(), onSuccess: async (database, { path }) => { await upsertDatabase(queryClient, path.server_uuid, database); - toast.success('Database created', { description: `${database.attributes.name} is ready to use.` }); + toast.success(i18next.t('Database created'), { + description: i18next.t('{{name}} is ready to use.', { name: database.attributes.name }), + }); }, - onError: (error) => notifyHttpError(error, 'Unable to create database'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to create database')), }); }; @@ -107,9 +110,11 @@ export const useDeleteServerDatabase = () => { await removeDatabase(queryClient, variables.path.server_uuid, variables.path.database_id); const name = variables.meta?.name; - toast.success('Database deleted', { description: name ? `${name} has been removed.` : undefined }); + toast.success(i18next.t('Database deleted'), { + description: name ? i18next.t('{{name}} has been removed.', { name }) : undefined, + }); }, - onError: (error) => notifyHttpError(error, 'Unable to delete database'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to delete database')), }); }; @@ -120,10 +125,10 @@ export const useRotateDatabasePassword = () => { ...clientRotateServerDatabasePasswordMutation(), onSuccess: async (database, { path }) => { await upsertDatabase(queryClient, path.server_uuid, database); - toast.success('Database password rotated', { - description: `${database.attributes.name} has a new password.`, + toast.success(i18next.t('Database password rotated'), { + description: i18next.t('{{name}} has a new password.', { name: database.attributes.name }), }); }, - onError: (error) => notifyHttpError(error, 'Unable to rotate database password'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to rotate database password')), }); }; diff --git a/resources/scripts/api/server/files/queries.ts b/resources/scripts/api/server/files/queries.ts index 37c08f0a9..ae85a8057 100644 --- a/resources/scripts/api/server/files/queries.ts +++ b/resources/scripts/api/server/files/queries.ts @@ -1,5 +1,6 @@ import { useQuery, queryOptions, useMutation, useQueryClient, type QueryClient } from '@tanstack/react-query'; import axios, { type AxiosProgressEvent } from 'axios'; +import i18next from 'i18next'; import { toast } from 'sonner'; import { cleanDirectoryPath, fileBitsToString, newDirectoryDisplayName } from '@/helpers'; @@ -110,7 +111,9 @@ export const compressFilesInput = ( path: { server_uuid: uuid }, body: { root: directory, files }, timeout: 60000, - timeoutErrorMessage: 'It looks like this archive is taking a long time to generate. It will appear once completed.', + timeoutErrorMessage: i18next.t( + 'It looks like this archive is taking a long time to generate. It will appear once completed.' + ), }); export const decompressFileInput = ( @@ -121,8 +124,9 @@ export const decompressFileInput = ( path: { server_uuid: uuid }, body: { root: directory, file }, timeout: 300000, - timeoutErrorMessage: - 'It looks like this archive is taking a long time to be unarchived. Once completed the unarchived files will appear.', + timeoutErrorMessage: i18next.t( + 'It looks like this archive is taking a long time to be unarchived. Once completed the unarchived files will appear.' + ), }); export const writeFileContentsInput = ( @@ -268,9 +272,9 @@ export const useCreateDirectory = () => { })); } - toast.success('Directory created'); + toast.success(i18next.t('Directory created')); }, - onError: (error) => notifyHttpError(error, 'Unable to create directory'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to create directory')), }); }; @@ -296,9 +300,9 @@ export const useRenameFiles = () => { } await queryClient.invalidateQueries({ queryKey: allServerFilesQueryKey(path.server_uuid) }); - toast.success('Files updated'); + toast.success(i18next.t('Files updated')); }, - onError: (error) => notifyHttpError(error, 'Unable to update files'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to update files')), }); }; @@ -332,9 +336,9 @@ export const useChmodFiles = () => { await queryClient.invalidateQueries({ queryKey: serverFilesQueryKey(path.server_uuid, body.root) }); } - toast.success('Permissions updated'); + toast.success(i18next.t('Permissions updated')); }, - onError: (error) => notifyHttpError(error, 'Unable to update permissions'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to update permissions')), }); }; @@ -352,9 +356,9 @@ export const useDeleteFiles = () => { ); } - toast.success(body?.files?.length === 1 ? 'File deleted' : 'Files deleted'); + toast.success(body?.files?.length === 1 ? i18next.t('File deleted') : i18next.t('Files deleted')); }, - onError: (error) => notifyHttpError(error, 'Unable to delete files'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to delete files')), }); }; @@ -368,9 +372,9 @@ export const useCopyFile = (directory: string) => { await queryClient.invalidateQueries({ queryKey: serverFilesQueryKey(path.server_uuid, directory) }); } - toast.success('File copied'); + toast.success(i18next.t('File copied')); }, - onError: (error) => notifyHttpError(error, 'Unable to copy file'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to copy file')), }); }; @@ -384,9 +388,9 @@ export const useCompressFiles = () => { await queryClient.invalidateQueries({ queryKey: serverFilesQueryKey(path.server_uuid, body.root) }); } - toast.success('Archive started'); + toast.success(i18next.t('Archive started')); }, - onError: (error) => notifyHttpError(error, 'Unable to archive files'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to archive files')), }); }; @@ -400,16 +404,16 @@ export const useDecompressFile = () => { await queryClient.invalidateQueries({ queryKey: serverFilesQueryKey(path.server_uuid, body.root) }); } - toast.success('Unarchive started'); + toast.success(i18next.t('Unarchive started')); }, - onError: (error) => notifyHttpError(error, 'Unable to unarchive file'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to unarchive file')), }); }; export const useFileDownloadUrl = () => useMutation({ mutationFn: ({ uuid, file }: { uuid: string; file: string }) => getFileDownloadUrl(uuid, file), - onError: (error) => notifyHttpError(error, 'Unable to create file download'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to create file download')), }); export const useSaveFileContent = () => { @@ -419,9 +423,9 @@ export const useSaveFileContent = () => { ...clientWriteFileContentsMutation(), onSuccess: async (_data, { path, query, body }) => { await updateServerFileContent(queryClient, path.server_uuid, query.file, body); - toast.success('File saved'); + toast.success(i18next.t('File saved')); }, - onError: (error) => notifyHttpError(error, 'Unable to save file'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to save file')), }); }; @@ -499,7 +503,7 @@ export const useUploadFiles = () => { } catch (error) { if (!controller.signal.aborted && !axios.isCancel(error)) { outcome = 'failed'; - notifyHttpError(error, `Unable to upload ${file.name}`); + notifyHttpError(error, i18next.t('Unable to upload {{name}}', { name: file.name })); } } } @@ -512,10 +516,10 @@ export const useUploadFiles = () => { }, onSuccess: ({ uploaded, failed }) => { if (uploaded.length > 0 && failed.length === 0) { - toast.success('Upload complete'); + toast.success(i18next.t('Upload complete')); } }, - onError: (error) => notifyHttpError(error, 'Unable to upload files'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to upload files')), onSettled: (_data, _error, { uuid, directory }) => queryClient.invalidateQueries({ queryKey: serverFilesQueryKey(uuid, directory) }), }); diff --git a/resources/scripts/api/server/network/queries.ts b/resources/scripts/api/server/network/queries.ts index 5279a1706..d7df9e88d 100644 --- a/resources/scripts/api/server/network/queries.ts +++ b/resources/scripts/api/server/network/queries.ts @@ -1,4 +1,5 @@ import { useQuery, useMutation, useQueryClient, type QueryClient } from '@tanstack/react-query'; +import i18next from 'i18next'; import { toast } from 'sonner'; import { mapListItems, removeListItems, upsertListItem } from '@/api/queryData'; @@ -87,11 +88,13 @@ export const useCreateServerAllocation = () => { ...clientCreateServerAllocationMutation(), onSuccess: async (allocation, { path }) => { await upsertAllocation(queryClient, path.server_uuid, allocation); - toast.success('Allocation created', { - description: `${allocation.attributes.ip}:${allocation.attributes.port} is available.`, + toast.success(i18next.t('Allocation created'), { + description: i18next.t('{{address}} is available.', { + address: `${allocation.attributes.ip}:${allocation.attributes.port}`, + }), }); }, - onError: (error) => notifyHttpError(error, 'Unable to create allocation'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to create allocation')), }); }; @@ -101,7 +104,7 @@ export const useUpdateAllocationNotes = () => { return useMutation({ ...clientUpdateAllocationNotesMutation(), onSuccess: (allocation, { path }) => upsertAllocation(queryClient, path.server_uuid, allocation), - onError: (error) => notifyHttpError(error, 'Unable to update allocation notes'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to update allocation notes')), }); }; @@ -126,9 +129,9 @@ export const useSetPrimaryAllocation = () => { })) ); await queryClient.invalidateQueries(serverQueryFilters(path.server_uuid)); - toast.success('Primary allocation updated'); + toast.success(i18next.t('Primary allocation updated')); }, - onError: (error) => notifyHttpError(error, 'Unable to update primary allocation'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to update primary allocation')), }); }; @@ -139,8 +142,8 @@ export const useDeleteServerAllocation = () => { ...clientDeleteServerAllocationMutation(), onSuccess: async (_data, { path }) => { await removeAllocation(queryClient, path.server_uuid, path.allocation_id); - toast.success('Allocation deleted'); + toast.success(i18next.t('Allocation deleted')); }, - onError: (error) => notifyHttpError(error, 'Unable to delete allocation'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to delete allocation')), }); }; diff --git a/resources/scripts/api/server/power/queries.ts b/resources/scripts/api/server/power/queries.ts index 860359800..af46a81b6 100644 --- a/resources/scripts/api/server/power/queries.ts +++ b/resources/scripts/api/server/power/queries.ts @@ -1,4 +1,5 @@ import { useMutation } from '@tanstack/react-query'; +import i18next from 'i18next'; import { clientSendPowerActionMutation, @@ -28,11 +29,11 @@ export const sendServerCommandInput = (uuid: string, command: string): Options useMutation({ ...clientSendPowerActionMutation(), - onError: (error) => notifyHttpError(error, 'Unable to send power action'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to send power action')), }); export const useSendServerCommand = () => useMutation({ ...clientSendServerCommandMutation(), - onError: (error) => notifyHttpError(error, 'Unable to send command'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to send command')), }); diff --git a/resources/scripts/api/server/queries.ts b/resources/scripts/api/server/queries.ts index f68c5c275..9d01812b1 100644 --- a/resources/scripts/api/server/queries.ts +++ b/resources/scripts/api/server/queries.ts @@ -8,6 +8,7 @@ import { } from '@tanstack/react-query'; import { useServerRouteId } from '@/router/params'; import { useCallback } from 'react'; +import i18next from 'i18next'; import { toast } from 'sonner'; import { invalidateGeneratedOperations } from '@/api/mutationUtils'; import { hasGeneratedOperationId, hasPathParam } from '@/api/queryKeyGuards'; @@ -133,15 +134,15 @@ export const useRenameServer = (serverIdentifier: string) => { }, })); await invalidateGeneratedOperations(queryClient, ['clientListClientServers']); - toast.success('Server details updated'); + toast.success(i18next.t('Server details updated')); }, - onError: (error) => notifyHttpError(error, 'Unable to update server details'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to update server details')), }); }; export const useReinstallServer = () => useMutation({ ...clientReinstallServerMutation(), - onSuccess: () => toast.success('Server reinstall started'), - onError: (error) => notifyHttpError(error, 'Unable to reinstall server'), + onSuccess: () => toast.success(i18next.t('Server reinstall started')), + onError: (error) => notifyHttpError(error, i18next.t('Unable to reinstall server')), }); diff --git a/resources/scripts/api/server/schedules/queries.ts b/resources/scripts/api/server/schedules/queries.ts index 43ad4457d..f23a6c926 100644 --- a/resources/scripts/api/server/schedules/queries.ts +++ b/resources/scripts/api/server/schedules/queries.ts @@ -1,4 +1,5 @@ import { useQuery, useMutation, useQueryClient, type QueryClient } from '@tanstack/react-query'; +import i18next from 'i18next'; import { toast } from 'sonner'; import { removeListItems, upsertListItem } from '@/api/queryData'; @@ -232,9 +233,9 @@ export const useCreateServerSchedule = () => { ...clientCreateServerScheduleMutation(), onSuccess: async (schedule, { path }) => { await cacheServerSchedule(queryClient, path.server_uuid, schedule); - toast.success('Schedule created'); + toast.success(i18next.t('Schedule created')); }, - onError: (error) => notifyHttpError(error, 'Unable to save schedule'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to save schedule')), }); }; @@ -245,9 +246,9 @@ export const useUpdateServerSchedule = () => { ...clientUpdateServerScheduleMutation(), onSuccess: async (schedule, { path }) => { await cacheServerSchedule(queryClient, path.server_uuid, schedule); - toast.success('Schedule saved'); + toast.success(i18next.t('Schedule saved')); }, - onError: (error) => notifyHttpError(error, 'Unable to save schedule'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to save schedule')), }); }; @@ -261,9 +262,9 @@ export const useDeleteServerSchedule = () => { queryKey: clientGetServerScheduleQueryKey(serverScheduleInput(path.server_uuid, path.schedule_id)), }); await removeServerSchedule(queryClient, path.server_uuid, path.schedule_id); - toast.success('Schedule deleted'); + toast.success(i18next.t('Schedule deleted')); }, - onError: (error) => notifyHttpError(error, 'Unable to delete schedule'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to delete schedule')), }); }; @@ -277,9 +278,9 @@ export const useTriggerServerScheduleExecution = (schedule: Schedule) => { ...schedule, attributes: { ...schedule.attributes, is_processing: true }, }); - toast.success('Schedule queued'); + toast.success(i18next.t('Schedule queued')); }, - onError: (error) => notifyHttpError(error, 'Unable to run schedule'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to run schedule')), }); }; @@ -292,9 +293,9 @@ export const useCreateServerScheduleTask = (schedule: Schedule) => { await cacheServerSchedule(queryClient, path.server_uuid, schedule, (current) => cacheServerScheduleTask(current, task) ); - toast.success('Task created'); + toast.success(i18next.t('Task created')); }, - onError: (error) => notifyHttpError(error, 'Unable to save task'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to save task')), }); }; @@ -307,9 +308,9 @@ export const useUpdateServerScheduleTask = (schedule: Schedule) => { await cacheServerSchedule(queryClient, path.server_uuid, schedule, (current) => cacheServerScheduleTask(current, task) ); - toast.success('Task saved'); + toast.success(i18next.t('Task saved')); }, - onError: (error) => notifyHttpError(error, 'Unable to save task'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to save task')), }); }; @@ -322,8 +323,8 @@ export const useDeleteServerScheduleTask = (schedule: Schedule) => { await cacheServerSchedule(queryClient, path.server_uuid, schedule, (current) => removeServerScheduleTask(current, path.task_id) ); - toast.success('Task deleted'); + toast.success(i18next.t('Task deleted')); }, - onError: (error) => notifyHttpError(error, 'Unable to delete task'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to delete task')), }); }; diff --git a/resources/scripts/api/server/startup/queries.ts b/resources/scripts/api/server/startup/queries.ts index dd8658746..f8f8a25c4 100644 --- a/resources/scripts/api/server/startup/queries.ts +++ b/resources/scripts/api/server/startup/queries.ts @@ -1,4 +1,5 @@ import { useIsMutating, useQuery, useMutation, useQueryClient } from '@tanstack/react-query'; +import i18next from 'i18next'; import { toast } from 'sonner'; import { useUpdateCurrentServer } from '@/api/server/queries'; @@ -48,9 +49,9 @@ export const useSetSelectedDockerImage = (uuid: string) => { ...server, attributes: { ...server.attributes, docker_image: variables.body.docker_image }, })); - toast.success('Docker image updated'); + toast.success(i18next.t('Docker image updated')); }, - onError: (error) => notifyHttpError(error, 'Unable to update Docker image'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to update Docker image')), }); }; @@ -98,6 +99,6 @@ export const useUpdateStartupVariable = (uuid: string) => { } ); }, - onError: (error) => notifyHttpError(error, 'Unable to update startup variable'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to update startup variable')), }); }; diff --git a/resources/scripts/api/server/users/queries.ts b/resources/scripts/api/server/users/queries.ts index 12dac974e..6df16f857 100644 --- a/resources/scripts/api/server/users/queries.ts +++ b/resources/scripts/api/server/users/queries.ts @@ -1,4 +1,5 @@ import { useQuery, useMutation, useQueryClient, type QueryClient } from '@tanstack/react-query'; +import i18next from 'i18next'; import { removeListItems, upsertListItem } from '@/api/queryData'; import { @@ -84,7 +85,7 @@ export const useCreateSubuser = () => { return useMutation({ ...clientCreateServerSubuserMutation(), onSuccess: (subuser, { path }) => upsertSubuser(queryClient, path.server_uuid, subuser), - onError: (error) => notifyHttpError(error, 'Unable to invite subuser'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to invite subuser')), }); }; @@ -94,7 +95,7 @@ export const useUpdateSubuser = () => { return useMutation({ ...clientUpdateServerSubuserMutation(), onSuccess: (subuser, { path }) => upsertSubuser(queryClient, path.server_uuid, subuser), - onError: (error) => notifyHttpError(error, 'Unable to update subuser'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to update subuser')), }); }; @@ -105,6 +106,6 @@ export const useDeleteSubuser = () => { return useMutation({ ...clientDeleteServerSubuserMutation(), onSuccess: (_data, { path }) => removeSubuser(queryClient, path.server_uuid, path.user), - onError: (error) => notifyHttpError(error, 'Unable to remove subuser'), + onError: (error) => notifyHttpError(error, i18next.t('Unable to remove subuser')), }); }; diff --git a/resources/scripts/components/admin/api/ApiKeyTable.tsx b/resources/scripts/components/admin/api/ApiKeyTable.tsx index 9c30d2493..a675a1ec5 100644 --- a/resources/scripts/components/admin/api/ApiKeyTable.tsx +++ b/resources/scripts/components/admin/api/ApiKeyTable.tsx @@ -112,7 +112,7 @@ export const apiKeyColumns = (t: Translation['t']) => return ( - {lastUsedAt ? dayjs(lastUsedAt).format('MMM D, YYYY') : t('Never')} + {lastUsedAt ? dayjs(lastUsedAt).format('ll') : t('Never')} ); }, @@ -128,7 +128,7 @@ export const apiKeyColumns = (t: Translation['t']) => className='whitespace-nowrap text-xs text-muted-foreground' dateTime={row.original.attributes.created_at} > - {dayjs(row.original.attributes.created_at).format('MMM D, YYYY')} + {dayjs(row.original.attributes.created_at).format('ll')} ), enableSorting: true, diff --git a/resources/scripts/components/admin/databases/DatabaseHostDetailContainer.tsx b/resources/scripts/components/admin/databases/DatabaseHostDetailContainer.tsx index 260a44e33..c4ece23c1 100644 --- a/resources/scripts/components/admin/databases/DatabaseHostDetailContainer.tsx +++ b/resources/scripts/components/admin/databases/DatabaseHostDetailContainer.tsx @@ -106,7 +106,7 @@ function DatabaseHostDetailForm({ host }: { host: AdminDatabaseHost }) { />
-

{t('{{total}} databases', { total: host.attributes.databases_count })}

+

{t('{{count}} databases', { count: host.attributes.databases_count })}

{(() => { const node = relationshipAttributes(host.attributes.relationships?.node); diff --git a/resources/scripts/components/admin/databases/DatabaseHostTable.tsx b/resources/scripts/components/admin/databases/DatabaseHostTable.tsx index a04fad2c5..de520c348 100644 --- a/resources/scripts/components/admin/databases/DatabaseHostTable.tsx +++ b/resources/scripts/components/admin/databases/DatabaseHostTable.tsx @@ -186,7 +186,7 @@ export const databaseHostColumns = (t: Translation['t']) => dateTime={row.original.attributes.created_at} className='whitespace-nowrap text-xs text-muted-foreground' > - {dayjs(row.original.attributes.created_at).format('MMM D, YYYY')} + {dayjs(row.original.attributes.created_at).format('ll')} ), enableSorting: true, diff --git a/resources/scripts/components/admin/locations/LocationTable.tsx b/resources/scripts/components/admin/locations/LocationTable.tsx index f3e4426b3..d5d5b5350 100644 --- a/resources/scripts/components/admin/locations/LocationTable.tsx +++ b/resources/scripts/components/admin/locations/LocationTable.tsx @@ -157,7 +157,7 @@ export const locationColumns = (t: Translation['t']) => className='whitespace-nowrap text-xs text-muted-foreground' dateTime={row.original.attributes.created_at} > - {dayjs(row.original.attributes.created_at).format('MMM D, YYYY')} + {dayjs(row.original.attributes.created_at).format('ll')} ), enableSorting: true, diff --git a/resources/scripts/components/admin/nodes/NodeTable.tsx b/resources/scripts/components/admin/nodes/NodeTable.tsx index 0f3b7a486..854b07ee3 100644 --- a/resources/scripts/components/admin/nodes/NodeTable.tsx +++ b/resources/scripts/components/admin/nodes/NodeTable.tsx @@ -322,7 +322,7 @@ export const nodeColumns = (t: Translation['t']) => dateTime={row.original.attributes.created_at} className='whitespace-nowrap text-xs text-muted-foreground' > - {dayjs(row.original.attributes.created_at).format('MMM D, YYYY')} + {dayjs(row.original.attributes.created_at).format('ll')} ), enableSorting: true, diff --git a/resources/scripts/components/admin/servers/ServerManageTab.tsx b/resources/scripts/components/admin/servers/ServerManageTab.tsx index bd18af45f..aaa10472d 100644 --- a/resources/scripts/components/admin/servers/ServerManageTab.tsx +++ b/resources/scripts/components/admin/servers/ServerManageTab.tsx @@ -18,7 +18,7 @@ import { Dialog } from '@/components/elements/dialog'; import Tooltip from '@/components/elements/tooltip/Tooltip'; import { Alert, type AlertType } from '@/components/elements/alert'; import { isObject } from '@/lib/objects'; -import { canReinstallServer, SKIPPED_INSTALL_SCRIPT_MESSAGE } from '@/lib/serverStatus'; +import { canReinstallServer, skippedInstallScriptMessage } from '@/lib/serverStatus'; import Translate from '@/components/elements/Translate'; import { useTranslation, type Translation } from '@/sdk/localization'; @@ -72,7 +72,7 @@ const reinstallBlockedReasonFor = (attributes: AdminServer['attributes'], t: Tra return undefined; } - return SKIPPED_INSTALL_SCRIPT_MESSAGE; + return skippedInstallScriptMessage(); }; function ServerManageContent({ server }: Props) { diff --git a/resources/scripts/components/admin/servers/ServerStartupTab.spec.tsx b/resources/scripts/components/admin/servers/ServerStartupTab.spec.tsx index 9e561444d..b91809681 100644 --- a/resources/scripts/components/admin/servers/ServerStartupTab.spec.tsx +++ b/resources/scripts/components/admin/servers/ServerStartupTab.spec.tsx @@ -117,7 +117,10 @@ const tagCheckFailure = new AxiosError('Unprocessable', '422', undefined, undefi config: { headers: new AxiosHeaders() }, data: { errors: [ - { detail: 'node-alpha only accepts eggs tagged Minecraft.', meta: { source_field: 'egg_id', rule: '' } }, + { + detail: 'node-alpha only accepts eggs tagged Minecraft.', + meta: { source_field: 'egg_id', rule: 'node_accepts_egg' }, + }, ], }, }); diff --git a/resources/scripts/components/admin/servers/ServerTable.tsx b/resources/scripts/components/admin/servers/ServerTable.tsx index f898eeb89..fb54884be 100644 --- a/resources/scripts/components/admin/servers/ServerTable.tsx +++ b/resources/scripts/components/admin/servers/ServerTable.tsx @@ -251,7 +251,7 @@ export const serverColumns = (t: Translation['t']) => dateTime={row.original.attributes.created_at} className='whitespace-nowrap text-xs text-muted-foreground' > - {dayjs(row.original.attributes.created_at).format('MMM D, YYYY')} + {dayjs(row.original.attributes.created_at).format('ll')} ), enableSorting: true, diff --git a/resources/scripts/components/admin/tags/helpers.spec.ts b/resources/scripts/components/admin/tags/helpers.spec.ts index 41087d7f6..8aae50b60 100644 --- a/resources/scripts/components/admin/tags/helpers.spec.ts +++ b/resources/scripts/components/admin/tags/helpers.spec.ts @@ -24,13 +24,13 @@ const premium = tag(2, 'Premium', 'premium'); const minecraft = tag(3, 'Minecraft', 'minecraft'); const tags = [srcds, premium]; -const unprocessable = (field: string, detail: string) => +const unprocessable = (field: string, detail: string, rule = '') => new AxiosError('Unprocessable', '422', undefined, undefined, { status: 422, statusText: 'Unprocessable Content', headers: {}, config: { headers: new AxiosHeaders() }, - data: { errors: [{ code: 'ValidationException', detail, meta: { source_field: field, rule: '' } }] }, + data: { errors: [{ code: 'ValidationException', detail, meta: { source_field: field, rule } }] }, }); describe('tagValueForName', () => { @@ -70,15 +70,20 @@ describe('nodeAcceptsEgg', () => { }); describe('tagCheckError', () => { - it('returns the tag check message for the field', () => { - const message = 'node-alpha only accepts eggs tagged Minecraft.'; + it('returns the tag check message for the field, in any language', () => { + const message = 'node-alpha akzeptiert nur Eggs mit den Tags Minecraft.'; - expect(tagCheckError(unprocessable('node_id', message), 'node_id')).toBe(message); + expect(tagCheckError(unprocessable('node_id', message, 'node_accepts_egg'), 'node_id')).toBe(message); }); it('ignores other validation errors and other fields', () => { - expect(tagCheckError(unprocessable('node_id', 'The node id field is required.'), 'node_id')).toBeNull(); - expect(tagCheckError(unprocessable('egg_id', 'n only accepts eggs tagged A.'), 'node_id')).toBeNull(); + expect( + tagCheckError(unprocessable('node_id', 'The node id field is required.', 'required'), 'node_id') + ).toBeNull(); + expect(tagCheckError(unprocessable('node_id', 'n only accepts eggs tagged A.'), 'node_id')).toBeNull(); + expect( + tagCheckError(unprocessable('egg_id', 'n only accepts eggs tagged A.', 'node_accepts_egg'), 'node_id') + ).toBeNull(); expect(tagCheckError(new Error('offline'), 'node_id')).toBeNull(); }); }); diff --git a/resources/scripts/components/admin/tags/helpers.ts b/resources/scripts/components/admin/tags/helpers.ts index 5516d69dd..66eb3cfcf 100644 --- a/resources/scripts/components/admin/tags/helpers.ts +++ b/resources/scripts/components/admin/tags/helpers.ts @@ -1,5 +1,5 @@ import i18next from 'i18next'; -import { httpValidationErrors } from '@/api/http'; +import { httpValidationFailure } from '@/api/http'; import type { AdminTag } from '@/api/admin/tags/queries'; /** @@ -39,8 +39,5 @@ export interface TagCheckMeta { } /** The API's refusal of a node that does not accept the egg, which `ignore_tags` skips. */ -export const tagCheckError = (cause: unknown, field: string): string | null => { - const errors = httpValidationErrors(cause); - - return field in errors && errors[field].includes(' only accepts eggs tagged ') ? errors[field] : null; -}; +export const tagCheckError = (cause: unknown, field: string): string | null => + httpValidationFailure(cause, field, 'node_accepts_egg'); diff --git a/resources/scripts/components/admin/users/UserTable.tsx b/resources/scripts/components/admin/users/UserTable.tsx index 6f5e76726..1daf37936 100644 --- a/resources/scripts/components/admin/users/UserTable.tsx +++ b/resources/scripts/components/admin/users/UserTable.tsx @@ -230,7 +230,7 @@ export const userColumns = (t: Translation['t']) => className='whitespace-nowrap text-xs text-muted-foreground' dateTime={row.original.attributes.created_at} > - {dayjs(row.original.attributes.created_at).format('MMM D, YYYY')} + {dayjs(row.original.attributes.created_at).format('ll')} ), enableSorting: true, diff --git a/resources/scripts/components/elements/CodemirrorEditor.tsx b/resources/scripts/components/elements/CodemirrorEditor.tsx index f15cab88a..1fc96ae4c 100644 --- a/resources/scripts/components/elements/CodemirrorEditor.tsx +++ b/resources/scripts/components/elements/CodemirrorEditor.tsx @@ -16,6 +16,7 @@ import { setSearchQuery, } from '@codemirror/search'; import { tags } from '@lezer/highlight'; +import i18next from 'i18next'; import { searchScrollbarMarkers } from '@/components/elements/codemirror/searchMarkers'; import { resolveEditorLanguage } from '@/components/elements/codemirror/yamlHighlighting'; import { editorContainerClass } from '@/components/elements/codemirror/layout'; @@ -570,8 +571,8 @@ class CustomSearchPanel implements Panel { this.toggleReplaceBtn = document.createElement('button'); this.toggleReplaceBtn.type = 'button'; this.toggleReplaceBtn.className = 'cm-search-chevron'; - this.toggleReplaceBtn.title = 'Toggle Replace (Ctrl+H)'; - this.toggleReplaceBtn.setAttribute('aria-label', 'Toggle Replace'); + this.toggleReplaceBtn.title = i18next.t('Toggle Replace (Ctrl+H)'); + this.toggleReplaceBtn.setAttribute('aria-label', i18next.t('Toggle Replace')); this.toggleReplaceBtn.style.backgroundImage = 'none'; this.toggleReplaceBtn.style.backgroundColor = 'var(--popover)'; this.toggleReplaceBtn.style.borderColor = 'var(--border)'; @@ -594,8 +595,8 @@ class CustomSearchPanel implements Panel { this.searchField = document.createElement('input'); this.searchField.className = 'cm-textfield'; this.searchField.name = 'search'; - this.searchField.placeholder = 'Find'; - this.searchField.setAttribute('aria-label', 'Find'); + this.searchField.placeholder = i18next.t('Find'); + this.searchField.setAttribute('aria-label', i18next.t('Find')); this.searchField.setAttribute('main-field', 'true'); this.searchField.value = query.search; this.searchField.onchange = this.commit; @@ -605,19 +606,19 @@ class CustomSearchPanel implements Panel { togglesWrap.className = 'cm-search-toggles'; - this.caseBtn = this.createToggle('Aa', 'Match Case (Alt+C)', query.caseSensitive, () => { + this.caseBtn = this.createToggle('Aa', i18next.t('Match Case (Alt+C)'), query.caseSensitive, () => { this.caseField.checked = !this.caseField.checked; this.updateToggleState(this.caseBtn, this.caseField.checked); this.commit(); }); - this.wordBtn = this.createToggle('\\b', 'Match Whole Word (Alt+W)', query.wholeWord, () => { + this.wordBtn = this.createToggle('\\b', i18next.t('Match Whole Word (Alt+W)'), query.wholeWord, () => { this.wordField.checked = !this.wordField.checked; this.updateToggleState(this.wordBtn, this.wordField.checked); this.commit(); }); - this.reBtn = this.createToggle('.*', 'Use Regular Expression (Alt+R)', query.regexp, () => { + this.reBtn = this.createToggle('.*', i18next.t('Use Regular Expression (Alt+R)'), query.regexp, () => { this.reField.checked = !this.reField.checked; this.updateToggleState(this.reBtn, this.reField.checked); this.commit(); @@ -632,21 +633,21 @@ class CustomSearchPanel implements Panel { const prevBtn = this.createIconButton( '', - 'Previous Match (Shift+Enter)', + i18next.t('Previous Match (Shift+Enter)'), 'prev', () => findPrevious(this.view) ); const nextBtn = this.createIconButton( '', - 'Next Match (Enter)', + i18next.t('Next Match (Enter)'), 'next', () => findNext(this.view) ); const allBtn = this.createActionButton( - 'All', - 'Select All Matches (Alt+Enter)', + i18next.t('All'), + i18next.t('Select All Matches (Alt+Enter)'), 'select', () => selectMatches(this.view), 'ghost' @@ -657,8 +658,8 @@ class CustomSearchPanel implements Panel { closeBtn.type = 'button'; closeBtn.className = 'cm-button cm-icon-button cm-search-close'; closeBtn.name = 'close'; - closeBtn.title = 'Close (Escape)'; - closeBtn.setAttribute('aria-label', 'Close'); + closeBtn.title = i18next.t('Close (Escape)'); + closeBtn.setAttribute('aria-label', i18next.t('Close')); closeBtn.style.position = 'static'; closeBtn.style.backgroundImage = 'none'; closeBtn.style.backgroundColor = 'var(--destructive)'; @@ -689,8 +690,8 @@ class CustomSearchPanel implements Panel { this.replaceField = document.createElement('input'); this.replaceField.className = 'cm-textfield cm-replace-input'; this.replaceField.name = 'replace'; - this.replaceField.placeholder = 'Replace'; - this.replaceField.setAttribute('aria-label', 'Replace'); + this.replaceField.placeholder = i18next.t('Replace'); + this.replaceField.setAttribute('aria-label', i18next.t('Replace')); this.replaceField.value = query.replace; this.replaceField.onchange = this.commit; this.replaceField.onkeyup = this.commit; @@ -702,15 +703,15 @@ class CustomSearchPanel implements Panel { replaceNav.className = 'cm-search-nav'; const replaceBtn = this.createActionButton( - 'Replace', - 'Replace (Enter)', + i18next.t('Replace'), + i18next.t('Replace (Enter)'), 'replace', () => replaceNext(this.view), 'primary' ); const replaceAllBtn = this.createActionButton( - 'All', - 'Replace All', + i18next.t('All'), + i18next.t('Replace All'), 'replaceAll', () => replaceAll(this.view), 'secondary' @@ -730,7 +731,9 @@ class CustomSearchPanel implements Panel { this.toggleReplaceBtn.innerHTML = this.isReplaceOpen ? '' : ''; - this.toggleReplaceBtn.title = this.isReplaceOpen ? 'Hide Replace' : 'Toggle Replace (Ctrl+H)'; + this.toggleReplaceBtn.title = this.isReplaceOpen + ? i18next.t('Hide Replace') + : i18next.t('Toggle Replace (Ctrl+H)'); this.toggleReplaceBtn.setAttribute('aria-expanded', String(this.isReplaceOpen)); } @@ -938,7 +941,7 @@ const createEditorState = ( indentUnit.of(' '), EditorView.lineWrapping, EditorView.contentAttributes.of({ - 'aria-label': 'File editor', + 'aria-label': i18next.t('File editor'), autocapitalize: 'off', autocorrect: 'off', }), diff --git a/resources/scripts/components/elements/CopyOnClick.tsx b/resources/scripts/components/elements/CopyOnClick.tsx index d42c9aa26..a83a39e8f 100644 --- a/resources/scripts/components/elements/CopyOnClick.tsx +++ b/resources/scripts/components/elements/CopyOnClick.tsx @@ -5,6 +5,7 @@ import { TextArea, TextInput } from '@/components/form/controls'; import copyToClipboard from '@/lib/clipboard'; import { cn } from '@/lib/cn'; import { useSkin } from '@/themes/skins'; +import { useTranslation, type Translation } from '@/sdk/localization'; export interface CopyOnClickProps { text: string | number | null | undefined; @@ -35,16 +36,24 @@ const interactiveTypes = new Set([ TextArea, ]); -const copyStatusMessage = (status: CopyStatus, text: CopyOnClickProps['text'], showInNotification: boolean): string => { +const copyStatusMessage = ( + t: Translation['t'], + status: CopyStatus, + text: CopyOnClickProps['text'], + showInNotification: boolean +): string => { if (status === 'failed') { - return 'Unable to copy text to clipboard.'; + return t('Unable to copy text to clipboard.'); } - return showInNotification ? `Copied "${String(text)}" to clipboard.` : 'Copied text to clipboard.'; + return showInNotification + ? t('Copied "{{text}}" to clipboard.', { text: String(text) }) + : t('Copied text to clipboard.'); }; /** Copies `text` when its single child is clicked; a non-interactive child becomes a focusable button. */ const CopyOnClick = ({ text, showInNotification = false, children }: CopyOnClickProps) => { + const { t } = useTranslation(); const [status, setStatus] = useState(null); const ui = useSkin('CopyOnClick', { status: status ?? undefined }); @@ -101,7 +110,7 @@ const CopyOnClick = ({ text, showInNotification = false, children }: CopyOnClick

-

{copyStatusMessage(status, text, showInNotification)}

+

{copyStatusMessage(t, status, text, showInNotification)}

diff --git a/resources/scripts/components/elements/ErrorBoundary.tsx b/resources/scripts/components/elements/ErrorBoundary.tsx index f3f32a78a..f74575115 100644 --- a/resources/scripts/components/elements/ErrorBoundary.tsx +++ b/resources/scripts/components/elements/ErrorBoundary.tsx @@ -1,6 +1,7 @@ import React from 'react'; import Icon from '@/components/elements/Icon'; import { TriangleAlert } from 'lucide-react'; +import Translate from '@/components/elements/Translate'; type ResetKey = string | number | boolean | null | undefined; @@ -57,10 +58,10 @@ class ErrorBoundary extends React.Component {

- An error was encountered by the application while rendering this view. Try refreshing the page. +

diff --git a/resources/scripts/components/elements/PageFooter.tsx b/resources/scripts/components/elements/PageFooter.tsx index 41c7a37e1..b911d78a9 100644 --- a/resources/scripts/components/elements/PageFooter.tsx +++ b/resources/scripts/components/elements/PageFooter.tsx @@ -1,4 +1,5 @@ import { replaceable, useSkin } from '@/themes/skins'; +import Translate from '@/components/elements/Translate'; export interface PageFooterProps { className?: string; @@ -11,10 +12,21 @@ function CorePageFooter({ className }: PageFooterProps) { return (

- - Pterodactyl® - -  © 2015 - {new Date().getFullYear()} + + ), + year: , + }} + />

); diff --git a/resources/scripts/components/elements/PermissionRoute.tsx b/resources/scripts/components/elements/PermissionRoute.tsx index e87d2aa8f..1064c89ce 100644 --- a/resources/scripts/components/elements/PermissionRoute.tsx +++ b/resources/scripts/components/elements/PermissionRoute.tsx @@ -1,21 +1,26 @@ import React from 'react'; import Can from '@/components/elements/Can'; import { AccessDenied } from '@/components/elements/ScreenBlock'; +import { useTranslation } from '@/sdk/localization'; interface Props { permission: string | string[] | null; children?: React.ReactNode; } -const accessDenied = ; - export default function PermissionRoute({ permission, children }: Props) { + const { t } = useTranslation(); + if (!permission) { return children; } return ( - + } + > {children} ); diff --git a/resources/scripts/components/elements/ScreenBlock.tsx b/resources/scripts/components/elements/ScreenBlock.tsx index 6353b2870..438992e1a 100644 --- a/resources/scripts/components/elements/ScreenBlock.tsx +++ b/resources/scripts/components/elements/ScreenBlock.tsx @@ -8,6 +8,7 @@ import NotFoundSvg from '@/assets/images/not_found.svg'; import ServerErrorSvg from '@/assets/images/server_error.svg'; import ServerInstallSvg from '@/assets/images/server_installing.svg'; import ServerRestoreSvg from '@/assets/images/server_restore.svg'; +import { useTranslation } from '@/sdk/localization'; /** The panel's illustrations for a `ScreenBlock`. */ export const screenImages = { @@ -42,53 +43,67 @@ const ActionButton = ({ className, ...props }: React.ComponentProps ); -const ScreenBlock = ({ title, image, message, onBack, onRetry, className }: ScreenBlockProps) => ( - -
-
- {(onBack ?? onRetry) && ( -
- (onRetry ?? onBack)?.()} - className={onRetry ? 'hover:animate-[spin_2s_linear_infinite]' : undefined} - > - - -
- )} - -

{title}

-

{message}

+const ScreenBlock = ({ title, image, message, onBack, onRetry, className }: ScreenBlockProps) => { + const { t } = useTranslation(); + + return ( + +
+
+ {(onBack ?? onRetry) && ( +
+ (onRetry ?? onBack)?.()} + className={onRetry ? 'hover:animate-[spin_2s_linear_infinite]' : undefined} + > + + +
+ )} + +

{title}

+

{message}

+
-
- -); + + ); +}; type ServerErrorProps = (Omit | Omit) & { title?: string; }; -const ServerError = ({ title = 'Something went wrong', message, onBack, onRetry, className }: ServerErrorProps) => - onRetry ? ( - +const ServerError = ({ title, message, onBack, onRetry, className }: ServerErrorProps) => { + const { t } = useTranslation(); + const heading = title ?? t('Something went wrong'); + + return onRetry ? ( + ) : ( - + ); +}; -const AccessDenied = ({ message }: Pick) => ( - -); +const AccessDenied = ({ message }: Pick) => { + const { t } = useTranslation(); -const NotFound = ({ title, message, onBack }: Partial>) => ( - -); + return ; +}; + +const NotFound = ({ title, message, onBack }: Partial>) => { + const { t } = useTranslation(); + + return ( + + ); +}; export { AccessDenied, ServerError, NotFound }; export default ScreenBlock; diff --git a/resources/scripts/components/elements/SecretInput.spec.tsx b/resources/scripts/components/elements/SecretInput.spec.tsx index 0b4b6444f..05272b93d 100644 --- a/resources/scripts/components/elements/SecretInput.spec.tsx +++ b/resources/scripts/components/elements/SecretInput.spec.tsx @@ -28,17 +28,17 @@ describe('SecretInput', () => { expect(input).toHaveAttribute('type', 'password'); - fireEvent.click(screen.getByRole('button', { name: 'Show password' })); + fireEvent.click(screen.getByRole('button', { name: 'Show Password' })); expect(input).toHaveAttribute('type', 'text'); - fireEvent.click(screen.getByRole('button', { name: 'Hide password' })); + fireEvent.click(screen.getByRole('button', { name: 'Hide Password' })); expect(input).toHaveAttribute('type', 'password'); }); it('copies the value without revealing it', async () => { const { container } = render(); - await act(async () => fireEvent.click(screen.getByRole('button', { name: 'Copy password' }))); + await act(async () => fireEvent.click(screen.getByRole('button', { name: 'Copy Password' }))); expect(clipboard.copy).toHaveBeenCalledTimes(1); expect(clipboard.copy).toHaveBeenCalledWith('hunter2'); @@ -49,7 +49,7 @@ describe('SecretInput', () => { it('disables both actions when there is no value', () => { render(); - expect(screen.getByRole('button', { name: 'Show password' })).toBeDisabled(); - expect(screen.getByRole('button', { name: 'Copy password' })).toBeDisabled(); + expect(screen.getByRole('button', { name: 'Show Password' })).toBeDisabled(); + expect(screen.getByRole('button', { name: 'Copy Password' })).toBeDisabled(); }); }); diff --git a/resources/scripts/components/elements/SecretInput.tsx b/resources/scripts/components/elements/SecretInput.tsx index 3b7c4b0b8..563c2cf9d 100644 --- a/resources/scripts/components/elements/SecretInput.tsx +++ b/resources/scripts/components/elements/SecretInput.tsx @@ -5,6 +5,7 @@ import CopyOnClick from '@/components/elements/CopyOnClick'; import Icon from '@/components/elements/Icon'; import Tooltip from '@/components/elements/tooltip/Tooltip'; import { TextInput } from '@/components/form/controls'; +import { useTranslation } from '@/sdk/localization'; interface SecretInputProps { id?: string; @@ -13,9 +14,10 @@ interface SecretInputProps { } const SecretInput = ({ id, value, label }: SecretInputProps) => { + const { t } = useTranslation(); const [visible, setVisible] = useState(false); - const toggleLabel = `${visible ? 'Hide' : 'Show'} ${label.toLowerCase()}`; - const copyLabel = `Copy ${label.toLowerCase()}`; + const toggleLabel = visible ? t('Hide {{name}}', { name: label }) : t('Show {{name}}', { name: label }); + const copyLabel = t('Copy {{name}}', { name: label }); return (
diff --git a/resources/scripts/components/elements/SubNavigation.tsx b/resources/scripts/components/elements/SubNavigation.tsx index 43562bc9e..55a1de7b7 100644 --- a/resources/scripts/components/elements/SubNavigation.tsx +++ b/resources/scripts/components/elements/SubNavigation.tsx @@ -5,6 +5,7 @@ import { cn } from '@/lib/cn'; import Icon from '@/components/elements/Icon'; import DropdownMenu from '@/components/elements/dropdown/DropdownMenu'; import NavigationLabel from '@/extensions/NavigationLabel'; +import { useTranslation } from '@/sdk/localization'; import { Navigation, NavigationLink, @@ -309,6 +310,7 @@ const SubNavigation = ({ className, ...props }: SubNavigationProps) => { + const { t } = useTranslation(); const rootRef = useRef(null); const rowRef = useRef(null); const moreRef = useRef(null); @@ -338,7 +340,7 @@ const SubNavigation = ({ className='mx-auto hidden w-full max-w-panel cursor-pointer items-center gap-3 px-6 py-3 text-sm text-foreground' > - {current?.label || 'Navigation'} + {current?.label || t('Navigation')} - More + {t('More')} } diff --git a/resources/scripts/components/elements/dialog/ConfirmationDialog.tsx b/resources/scripts/components/elements/dialog/ConfirmationDialog.tsx index 1d8a7eb23..4acac2cab 100644 --- a/resources/scripts/components/elements/dialog/ConfirmationDialog.tsx +++ b/resources/scripts/components/elements/dialog/ConfirmationDialog.tsx @@ -3,6 +3,7 @@ import DialogComponent from './Dialog'; import DialogFooter from './DialogFooter'; import type { RenderDialogProps } from './types'; import Button from '@/components/elements/Button'; +import { useTranslation } from '@/sdk/localization'; type ConfirmationProps = Omit & { children?: React.ReactNode; @@ -13,7 +14,7 @@ type ConfirmationProps = Omit & { }; export default function ConfirmationDialog({ - confirm = 'Okay', + confirm, pending = false, children, onConfirmed, @@ -21,6 +22,7 @@ export default function ConfirmationDialog({ hideCloseIcon, ...props }: ConfirmationProps) { + const { t } = useTranslation(); // Blocks a second confirm until the caller has rendered its pending state. const confirmed = useRef(false); @@ -39,7 +41,7 @@ export default function ConfirmationDialog({ {children} - Cancel + {t('Cancel')} - {confirm} + {confirm ?? t('Okay')} diff --git a/resources/scripts/components/elements/dialog/Dialog.tsx b/resources/scripts/components/elements/dialog/Dialog.tsx index ce2887691..b4b639089 100644 --- a/resources/scripts/components/elements/dialog/Dialog.tsx +++ b/resources/scripts/components/elements/dialog/Dialog.tsx @@ -2,6 +2,7 @@ import React, { useMemo, useState } from 'react'; import { Dialog as BaseDialog } from '@base-ui/react/dialog'; import Button from '@/components/elements/Button'; import { Check, Info, ShieldAlert, TriangleAlert, X } from 'lucide-react'; +import { useTranslation } from '@/sdk/localization'; import { useSkin, type SkinBinding } from '@/themes/skins'; import { DialogContext } from './context'; import DialogFooter from './DialogFooter'; @@ -41,6 +42,7 @@ export default function DialogComponent({ const popupRef = React.useRef(null); const described = !!description; const ui = useSkin('Dialog', { described }); + const { t } = useTranslation(); const initialFocus = (interactionType: string) => { if (interactionType === 'touch') { @@ -104,6 +106,7 @@ export default function DialogComponent({ type='button' size='xsmall' onClick={onClose} + aria-label={t('Close dialog')} className={ui.classes('closeButton')} > diff --git a/resources/scripts/components/elements/table/DataTableColumnHeader.tsx b/resources/scripts/components/elements/table/DataTableColumnHeader.tsx index e724c0b0c..e3bf91b00 100644 --- a/resources/scripts/components/elements/table/DataTableColumnHeader.tsx +++ b/resources/scripts/components/elements/table/DataTableColumnHeader.tsx @@ -1,6 +1,7 @@ import type { Column, RowData } from '@tanstack/react-table'; import { ArrowDown, ArrowUp, ArrowUpDown } from 'lucide-react'; import { cn } from '@/lib/cn'; +import { useTranslation } from '@/sdk/localization'; interface Props { column: Column; @@ -15,15 +16,19 @@ export default function DataTableColumnHeader({ title, className, }: Props) { + const { t } = useTranslation(); + if (!column.getCanSort()) { return {title}; } const direction = column.getIsSorted(); const nextDirection = column.getNextSortingOrder(); - const label = nextDirection - ? `Sort ${title} ${nextDirection === 'asc' ? 'ascending' : 'descending'}` - : `Clear ${title} sorting`; + const sortLabels = { + asc: t('Sort {{title}} ascending', { title }), + desc: t('Sort {{title}} descending', { title }), + }; + const label = nextDirection ? sortLabels[nextDirection] : t('Clear {{title}} sorting', { title }); const SortIcon = direction ? sortIcons[direction] : ArrowUpDown; return ( diff --git a/resources/scripts/components/elements/table/PaginationFooter.tsx b/resources/scripts/components/elements/table/PaginationFooter.tsx index 0158e2306..ed87ba254 100644 --- a/resources/scripts/components/elements/table/PaginationFooter.tsx +++ b/resources/scripts/components/elements/table/PaginationFooter.tsx @@ -1,6 +1,8 @@ import { cn } from '@/lib/cn'; import Button from '@/components/elements/Button'; import { ChevronsLeft, ChevronsRight } from 'lucide-react'; +import Translate from '@/components/elements/Translate'; +import { useTranslation } from '@/sdk/localization'; interface PaginationDataSet { total: number; @@ -25,6 +27,7 @@ interface Props { } const PaginationFooter = ({ pagination, className, onPageSelect }: Props) => { + const { t } = useTranslation(); const normalized = 'per_page' in pagination ? { @@ -69,15 +72,15 @@ const PaginationFooter = ({ pagination, className, onPageSelect }: Props) => { return (

- Showing  - {start} -  to  - {end} of  - {normalized.total} results. + }} + />

{(total > 1 || current > 1) && (
- + {previousPages.reverse().map((value) => ( @@ -98,7 +101,7 @@ const PaginationFooter = ({ pagination, className, onPageSelect }: Props) => { {value} ))} - +
diff --git a/resources/scripts/components/elements/table/RowActions.tsx b/resources/scripts/components/elements/table/RowActions.tsx index 75f05f209..6946e35e1 100644 --- a/resources/scripts/components/elements/table/RowActions.tsx +++ b/resources/scripts/components/elements/table/RowActions.tsx @@ -7,6 +7,8 @@ import DropdownMenu from '@/components/elements/dropdown/DropdownMenu'; import Icon from '@/components/elements/Icon'; import Tooltip from '@/components/elements/tooltip/Tooltip'; import { useSkin } from '@/themes/skins'; +import Translate from '@/components/elements/Translate'; +import { useTranslation } from '@/sdk/localization'; const iconClassName = 'h-3.5 w-3.5'; /** Links and menu triggers look like the row's icon buttons. */ @@ -26,7 +28,11 @@ export function actionsColumn( return { id: 'actions', - header: () => Actions, + header: () => ( + + + + ), cell: ({ row }) => cell(row.original), enableSorting: false, meta: { headerClassName: className, cellClassName: className }, @@ -72,11 +78,17 @@ export function RowActionButton({ icon, label, danger, disabled, disabledReason, ); } -export const EditAction = (props: PresetActionProps) => ; +export const EditAction = (props: PresetActionProps) => { + const { t } = useTranslation(); -export const DeleteAction = ({ label = 'Delete', ...props }: PresetActionProps & { label?: string }) => ( - -); + return ; +}; + +export const DeleteAction = ({ label, ...props }: PresetActionProps & { label?: string }) => { + const { t } = useTranslation(); + + return ; +}; /** `EditAction` for resources edited on another page. */ export function EditLinkAction< @@ -87,9 +99,10 @@ export function EditLinkAction< const TMaskTo extends string = '', >(props: LinkComponentProps<'a', TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & { 'aria-label': string }) { const button = useActionButton(); + const { t } = useTranslation(); return ( - + diff --git a/resources/scripts/components/form/fields.tsx b/resources/scripts/components/form/fields.tsx index 51671f967..f4e103ab4 100644 --- a/resources/scripts/components/form/fields.tsx +++ b/resources/scripts/components/form/fields.tsx @@ -7,6 +7,7 @@ import { capitalize } from '@/lib/strings'; import Select, { type SelectOption } from '@/components/ui/Select'; import Switch, { type SwitchProps } from '@/components/ui/Switch'; import Checkbox from '@/components/ui/Checkbox'; +import { useTranslation } from '@/sdk/localization'; type BaseProps = { label?: string; @@ -244,10 +245,11 @@ export function MultiSelectField({ light, options, disabled, - placeholder = 'None selected', + placeholder, searchPlaceholder, onCreate, }: MultiSelectFieldProps) { + const { t } = useTranslation(); const { field, error, fieldId, helpId, describedById } = useFieldState<(string | number)[]>(id, description); const selected = Array.isArray(field.state.value) ? field.state.value : []; @@ -266,7 +268,7 @@ export function MultiSelectField({ onChange={(value) => field.handleChange(value)} onCreate={onCreate} disabled={disabled} - placeholder={placeholder} + placeholder={placeholder ?? t('None selected')} searchPlaceholder={searchPlaceholder} hasError={!!error} aria-invalid={error ? true : undefined} diff --git a/resources/scripts/components/server/WebsocketHandler.tsx b/resources/scripts/components/server/WebsocketHandler.tsx index cea2e3e58..41712fb65 100644 --- a/resources/scripts/components/server/WebsocketHandler.tsx +++ b/resources/scripts/components/server/WebsocketHandler.tsx @@ -1,5 +1,6 @@ import { useCallback, useEffect, useRef } from 'react'; import { useQueryClient } from '@tanstack/react-query'; +import i18next from 'i18next'; import { serverResourceUsageQueryOptions } from '@/api/account/servers/queries'; import { getServerWebsocketCredentials, useCurrentServer, useCurrentServerUuid } from '@/api/server/queries'; import type { Server } from '@/api/server/queries'; @@ -9,6 +10,7 @@ import type { ServerStatus } from '@/state/server'; import ContentContainer from '@/components/elements/ContentContainer'; import Spinner from '@/components/elements/Spinner'; import { dismissNotification, notifyHttpError, notifyServerError } from '@/plugins/notifications'; +import { useTranslation } from '@/sdk/localization'; const reconnectErrors = ['jwt: exp claim is invalid', 'jwt: created too far in past (denylist)']; @@ -20,7 +22,7 @@ const serverErrorToasts = { }; const daemonErrorMessage = (message: string) => - message.trim() ? message : 'Wings reported an error without additional details.'; + message.trim() ? message : i18next.t('Wings reported an error without additional details.'); const serverStatuses = new Set(['offline', 'starting', 'stopping', 'running', null]); const isServerStatus = (value: string): value is NonNullable => serverStatuses.has(value as ServerStatus); @@ -38,6 +40,7 @@ export default function WebsocketHandler() { const setServerStatus = useServerStore((state) => state.status.setServerStatus); const { setInstance, setConnectionState, setReconnecting } = useServerStore((state) => state.socket); const queryClient = useQueryClient(); + const { t } = useTranslation(); const updateToken = useCallback((uuid: string, socket: Websocket) => { if (updatingToken.current || activeSocket.current !== socket || activeUuid.current !== uuid) { @@ -55,7 +58,9 @@ export default function WebsocketHandler() { }) .catch((error) => { if (activeSocket.current === socket && activeUuid.current === uuid) { - notifyHttpError(error, 'Failed to refresh server connection', { id: serverErrorToasts.token }); + notifyHttpError(error, i18next.t('Failed to refresh server connection'), { + id: serverErrorToasts.token, + }); } }) .finally(() => { @@ -78,10 +83,11 @@ export default function WebsocketHandler() { socket.on('SOCKET_CLOSE', () => setConnectionState(false)); socket.on('SOCKET_CONNECT_ERROR', () => { setReconnecting(false); - notifyServerError('Server connection failed', { + notifyServerError(i18next.t('Server connection failed'), { id: serverErrorToasts.connection, - description: - 'Failed to connect to the websocket after multiple attempts. Reconnecting resumes once your network or this tab is active again.', + description: i18next.t( + 'Failed to connect to the websocket after multiple attempts. Reconnecting resumes once your network or this tab is active again.' + ), }); }); socket.on('SOCKET_RECONNECT', () => { @@ -109,7 +115,7 @@ export default function WebsocketHandler() { socket.on('daemon error', (message) => { console.warn('Got error message from daemon socket:', message); - notifyServerError('Server reported an error', { + notifyServerError(i18next.t('Server reported an error'), { id: serverErrorToasts.daemon, description: daemonErrorMessage(message), }); @@ -125,10 +131,11 @@ export default function WebsocketHandler() { updateToken(uuid, socket); } else { setReconnecting(false); - notifyServerError('Server connection rejected', { + notifyServerError(i18next.t('Server connection rejected'), { id: serverErrorToasts.jwt, - description: - 'There was an error validating the credentials provided for the websocket. Please refresh the page.', + description: i18next.t( + 'There was an error validating the credentials provided for the websocket. Please refresh the page.' + ), }); } }); @@ -169,7 +176,7 @@ export default function WebsocketHandler() { } setReconnecting(false); - notifyHttpError(error, 'Failed to start server connection', { id: serverErrorToasts.token }); + notifyHttpError(error, i18next.t('Failed to start server connection'), { id: serverErrorToasts.token }); }); return () => { @@ -193,7 +200,7 @@ export default function WebsocketHandler() {

- We're having some trouble connecting to your server, please wait... + {t("We're having some trouble connecting to your server, please wait...")}

diff --git a/resources/scripts/components/server/console/useConsoleSocketLogs.ts b/resources/scripts/components/server/console/useConsoleSocketLogs.ts index 6cb64748d..a60072155 100644 --- a/resources/scripts/components/server/console/useConsoleSocketLogs.ts +++ b/resources/scripts/components/server/console/useConsoleSocketLogs.ts @@ -1,5 +1,6 @@ import { useEffect, useRef, type RefObject } from 'react'; import type { Terminal } from 'ghostty-web'; +import i18next from 'i18next'; import { SocketEvent, SocketRequest } from '@/components/server/events'; import { normalizeTransferStatus } from '@/components/server/transfer'; import type { Websocket } from '@/plugins/Websocket'; @@ -52,7 +53,7 @@ export const useConsoleSocketLogs = ({ const handleTransferStatus = (status: string) => { if (normalizeTransferStatus(status) === 'failed') { - writeTransferLine(`${TERMINAL_PRELUDE}Transfer has failed.\u001b[0m`); + writeTransferLine(`${TERMINAL_PRELUDE}${i18next.t('Transfer has failed.')}\u001b[0m`); } }; @@ -60,7 +61,7 @@ export const useConsoleSocketLogs = ({ term.writeln(`${TERMINAL_PRELUDE}\u001b[1m\u001b[41m${formatLine(line)}`); const handlePowerChangeEvent = (state: string) => - term.writeln(`${TERMINAL_PRELUDE}Server marked as ${state}...\u001b[0m`); + term.writeln(`${TERMINAL_PRELUDE}${i18next.t('Server marked as {{state}}...', { state })}\u001b[0m`); const listeners = [ [SocketEvent.STATUS, handlePowerChangeEvent], diff --git a/resources/scripts/components/server/files/FileNameModal.tsx b/resources/scripts/components/server/files/FileNameModal.tsx index 9a009a0e0..52dce7768 100644 --- a/resources/scripts/components/server/files/FileNameModal.tsx +++ b/resources/scripts/components/server/files/FileNameModal.tsx @@ -2,6 +2,7 @@ import { useAppForm, Form } from '@/components/form'; import type { DialogProps } from '@/components/elements/dialog'; import { Dialog } from '@/components/elements/dialog'; import { join } from 'pathe'; +import { useTranslation } from '@/sdk/localization'; type Props = DialogProps & { /** The directory the new file is written to. */ @@ -11,6 +12,7 @@ type Props = DialogProps & { /** Names a new file before the editor first writes it. */ export default function FileNameModal({ directory, onFileNamed, onClose, ...props }: Props) { + const { t } = useTranslation(); const form = useAppForm({ defaultValues: { fileName: '' }, onSubmit: async ({ value }) => { @@ -29,20 +31,20 @@ export default function FileNameModal({ directory, onFileNamed, onClose, ...prop
(value.length >= 1 ? undefined : 'Required') }} + validators={{ onChange: ({ value }) => (value.length >= 1 ? undefined : t('Required')) }} > {(field) => ( )}
- Create File + {t('Create File')}
diff --git a/resources/scripts/components/server/files/useFileUploader.ts b/resources/scripts/components/server/files/useFileUploader.ts index 11a5b6999..65c71a1d6 100644 --- a/resources/scripts/components/server/files/useFileUploader.ts +++ b/resources/scripts/components/server/files/useFileUploader.ts @@ -1,4 +1,5 @@ import { useCallback, useEffect, useRef } from 'react'; +import i18next from 'i18next'; import { toast } from 'sonner'; import { useCurrentServerUuid } from '@/api/server/queries'; import { useUploadFiles } from '@/api/server/files/queries'; @@ -37,7 +38,7 @@ export default function useFileUploader(): (source: UploadSource) => Promise isString(label) || isNu const createValue = '\u0000create'; -const createOption = (text: string, options: SelectOption[]): SelectOption | null => { +const createOption = (t: Translation['t'], text: string, options: SelectOption[]): SelectOption | null => { const query = text.trim(); if (query === '' || options.some((option) => optionLabel(option).toLowerCase() === query.toLowerCase())) { return null; } - return { value: createValue, label: `Create "${query}"`, textLabel: query }; + return { value: createValue, label: t('Create "{{query}}"', { query }), textLabel: query }; }; const sameValue = (left: SelectValue, right: SelectValue): boolean => Object.is(left, right); @@ -309,6 +310,8 @@ function MultiSelectCombobox({ onChange: (value: SelectValue[]) => void; onCreate: ((text: string) => void) | undefined; }) { + const { t } = useTranslation(); + return ( multiple @@ -343,7 +346,9 @@ function MultiSelectCombobox({ {(value: SelectOption[]) => ( <> - {value.length > 0 && {`${value.length} selected`}} + {value.length > 0 && ( + {t('{{total}} selected', { total: value.length })} + )} )} - + @@ -395,6 +400,8 @@ function SingleSelectCombobox({ onChange: (value: SelectValue) => void; onSelectLabel: (label: string) => void; }) { + const { t } = useTranslation(); + return ( items={items} @@ -429,7 +436,7 @@ function SingleSelectCombobox({ onFocus={search.handleFocus} onBlur={search.handleBlur} /> - + @@ -450,12 +457,13 @@ export default function Select(props: SelectProps) { groups, disabled, placeholder, - searchPlaceholder = 'Search...', - emptyMessage = 'No results found.', + searchPlaceholder, + emptyMessage, hasError, onBlur, onSearchChange, } = props; + const { t } = useTranslation(); const flatOptions = getOptions(options, groups); const groupedItems = getGroups(groups); const items = groupedItems ?? flatOptions; @@ -477,15 +485,15 @@ export default function Select(props: SelectProps) { if (props.multiple) { const inputValue = search.inputFocused ? search.searchValue : ''; - const creatable = props.onCreate && !groupedItems ? createOption(inputValue, flatOptions) : null; + const creatable = props.onCreate && !groupedItems ? createOption(t, inputValue, flatOptions) : null; return ( `extensi function showFailureNotice(notificationId: string, extensionId: string, mounts: Set) { const retryable = [...mounts].some((mount) => mount.retry); - toast.error(`The "${extensionId}" extension could not display this content.`, { + toast.error(i18next.t('The "{{extensionId}}" extension could not display this content.', { extensionId }), { id: notificationId, duration: Infinity, action: retryable ? { - label: 'Retry extension', + label: i18next.t('Retry extension'), onClick: () => { for (const mount of mounts) { mount.retry?.(); } }, } - : { label: 'Reload page', onClick: () => window.location.reload() }, + : { label: i18next.t('Reload page'), onClick: () => window.location.reload() }, description: retryable ? ( ) : undefined, }); @@ -89,6 +91,8 @@ export function ExtensionFailure({ retry?: () => void; notificationId?: string; }) { + const { t } = useTranslation(); + useEffect(() => { if (!notificationId) { return; @@ -119,14 +123,14 @@ export function ExtensionFailure({ return (
-

The "{extensionId}" extension could not display this content.

+

{t('The "{{extensionId}}" extension could not display this content.', { extensionId })}

{retry && ( )}
); diff --git a/resources/scripts/i18n.ts b/resources/scripts/i18n.ts index fcd779c9f..573ef6895 100644 --- a/resources/scripts/i18n.ts +++ b/resources/scripts/i18n.ts @@ -9,6 +9,7 @@ import type { UserData } from '@/api/account/types'; import type { SiteSettings } from '@/api/settings/types'; import { getBootstrapExtensions, getBootstrapSiteSettings, getBootstrapUser } from '@/bootstrap'; import { translationOptions } from '@/i18nConfig'; +import { setDateLocale } from '@/lib/dayjs'; interface MultiloadHttpBackendOptions extends HttpBackendOptions { allowMultiLoading: boolean; @@ -93,6 +94,8 @@ export function followCurrentUserLanguage(queryClient: QueryClient, instance: I1 }); } +i18n.on('languageChanged', (language) => void setDateLocale(language)); + void i18n .use(I18NextMultiloadBackendAdapter) .use(initReactI18next) @@ -100,6 +103,7 @@ void i18n ...translationOptions, debug: import.meta.env.DEV, lng: initialLanguage(), + react: { bindI18n: 'languageChanged loaded' }, backend: { backend: I18NextHttpBackend, backendOption: { diff --git a/resources/scripts/lib/dates.ts b/resources/scripts/lib/dates.ts index f94731341..f9989c917 100644 --- a/resources/scripts/lib/dates.ts +++ b/resources/scripts/lib/dates.ts @@ -1,6 +1,6 @@ import dayjs from '@/lib/dayjs'; -/** Formats a date with dayjs tokens, advanced ones included, such as `MMM Do [at] h:mmA`. */ +/** Formats a date with dayjs tokens, advanced ones included, such as `lll` for a localized date and time. */ export function formatDate(date: string | Date, format: string): string { return dayjs(date).format(format); } diff --git a/resources/scripts/lib/dayjs.spec.ts b/resources/scripts/lib/dayjs.spec.ts new file mode 100644 index 000000000..47aeb1a9d --- /dev/null +++ b/resources/scripts/lib/dayjs.spec.ts @@ -0,0 +1,26 @@ +import { afterEach, expect, it } from 'vitest'; +import dayjs, { setDateLocale } from '@/lib/dayjs'; + +const date = new Date(2026, 9, 3, 20, 2, 5); + +afterEach(async () => { + await setDateLocale('en'); +}); + +it('formats dates in the language of the panel', async () => { + expect(await setDateLocale('de')).toBe('de'); + expect(dayjs(date).format('LL')).toBe('3. Oktober 2026'); + expect(dayjs(date).format('LTS')).toBe('20:02:05'); +}); + +it('uses the regional variant of a language when dayjs has one', async () => { + expect(await setDateLocale('pt-BR')).toBe('pt-br'); + expect(await setDateLocale('en_AU')).toBe('en-au'); + expect(dayjs(date).format('L')).toBe('03/10/2026'); +}); + +it('falls back to the language, then english', async () => { + expect(await setDateLocale('de-XX')).toBe('de'); + expect(await setDateLocale('xx')).toBe('en'); + expect(dayjs(date).format('ll')).toBe('Oct 3, 2026'); +}); diff --git a/resources/scripts/lib/dayjs.ts b/resources/scripts/lib/dayjs.ts index fbe2f044a..2e88959f3 100644 --- a/resources/scripts/lib/dayjs.ts +++ b/resources/scripts/lib/dayjs.ts @@ -1,9 +1,36 @@ import dayjs from 'dayjs'; import advancedFormat from 'dayjs/plugin/advancedFormat'; +import localizedFormat from 'dayjs/plugin/localizedFormat'; import relativeTime from 'dayjs/plugin/relativeTime'; // Import dayjs from this module so these plugins are registered. dayjs.extend(advancedFormat); +dayjs.extend(localizedFormat); dayjs.extend(relativeTime); +const locales = import.meta.glob<{ default: ILocale }>('../../../node_modules/dayjs/esm/locale/*.js'); + +const localeLoader = (code: string) => locales[`../../../node_modules/dayjs/esm/locale/${code}.js`]; + +export async function setDateLocale(language: string): Promise { + const code = language.toLowerCase().replace('_', '-'); + + const load = [code, code.split('-')[0]!] + .filter((candidate) => candidate !== 'en') + .map(localeLoader) + .find((loader) => loader !== undefined); + + if (!load) { + dayjs.locale('en'); + + return 'en'; + } + + const { default: locale } = await load(); + + dayjs.locale(locale); + + return locale.name; +} + export default dayjs; diff --git a/resources/scripts/lib/formatters.spec.ts b/resources/scripts/lib/formatters.spec.ts index d2ad27233..e31744e5d 100644 --- a/resources/scripts/lib/formatters.spec.ts +++ b/resources/scripts/lib/formatters.spec.ts @@ -1,4 +1,5 @@ -import { describe, expect, it } from 'vitest'; +import i18next from 'i18next'; +import { afterEach, describe, expect, it } from 'vitest'; import { bytesRatioToString, bytesToString, ip, mbToBytes } from '@/lib/formatters'; describe('@/lib/formatters.ts', () => { @@ -72,4 +73,17 @@ describe('@/lib/formatters.ts', () => { expect(ip('127.0.0.1:25565')).toBe('[127.0.0.1:25565]'); }); }); + + describe('in another language', () => { + afterEach(() => i18next.changeLanguage('en')); + + it('uses its decimal separator and translates Bytes', async () => { + await i18next.changeLanguage('de'); + i18next.addResource('de', 'translation', 'Bytes', 'Byte'); + + expect(bytesToString(5068)).toBe('4,95 KiB'); + expect(bytesToString(100)).toBe('100 Byte'); + expect(bytesRatioToString(1_356_000, 2_097_152)).toBe('1,29 / 2 MiB'); + }); + }); }); diff --git a/resources/scripts/lib/formatters.ts b/resources/scripts/lib/formatters.ts index 57d1f3a93..d7ba0102e 100644 --- a/resources/scripts/lib/formatters.ts +++ b/resources/scripts/lib/formatters.ts @@ -1,3 +1,5 @@ +import i18next from 'i18next'; + const _CONVERSION_UNIT = 1024; function mbToBytes(megabytes: number): number { @@ -6,6 +8,11 @@ function mbToBytes(megabytes: number): number { const _BYTE_UNITS = ['Bytes', 'KiB', 'MiB', 'GiB', 'TiB']; +const unitLabel = (index: number): string => (index === 0 ? i18next.t('Bytes') : _BYTE_UNITS[index]!); + +const formatNumber = (value: number): string => + new Intl.NumberFormat(i18next.language || 'en', { maximumFractionDigits: 20, useGrouping: false }).format(value); + function byteUnitIndex(bytes: number): number { return Math.min(Math.floor(Math.log(bytes) / Math.log(_CONVERSION_UNIT)), _BYTE_UNITS.length - 1); } @@ -16,24 +23,24 @@ function scaleBytes(bytes: number, unit: number, decimals: number): number { function bytesToString(bytes: number, decimals = 2): string { if (bytes < 1) { - return '0 Bytes'; + return `${formatNumber(0)} ${unitLabel(0)}`; } const i = byteUnitIndex(bytes); - return `${scaleBytes(bytes, i, decimals)} ${_BYTE_UNITS[i]}`; + return `${formatNumber(scaleBytes(bytes, i, decimals))} ${unitLabel(i)}`; } function bytesRatioToString(used: number, total: number, decimals = 2): string { const reference = Math.max(total, used); if (reference < 1) { - return '0 / 0 Bytes'; + return `${formatNumber(0)} / ${formatNumber(0)} ${unitLabel(0)}`; } const i = byteUnitIndex(reference); - return `${scaleBytes(Math.max(0, used), i, decimals)} / ${scaleBytes(total, i, decimals)} ${_BYTE_UNITS[i]}`; + return `${formatNumber(scaleBytes(Math.max(0, used), i, decimals))} / ${formatNumber(scaleBytes(total, i, decimals))} ${unitLabel(i)}`; } /** Wraps IPv6 addresses in brackets. */ diff --git a/resources/scripts/lib/serverStatus.ts b/resources/scripts/lib/serverStatus.ts index ec4da6ee2..9714a8bf2 100644 --- a/resources/scripts/lib/serverStatus.ts +++ b/resources/scripts/lib/serverStatus.ts @@ -1,7 +1,11 @@ +import i18next from 'i18next'; + const INSTALLING_STATUSES: ReadonlySet = new Set(['installing', 'install_failed', 'reinstall_failed']); -export const SKIPPED_INSTALL_SCRIPT_MESSAGE = - "This server is configured to skip its egg's install script. Reinstalling is not available until that setting is disabled."; +export const skippedInstallScriptMessage = (): string => + i18next.t( + "This server is configured to skip its egg's install script. Reinstalling is not available until that setting is disabled." + ); export const isInstallingStatus = (status: string | null): boolean => status !== null && INSTALLING_STATUSES.has(status); diff --git a/resources/scripts/plugins/useNavigationBlocker.spec.tsx b/resources/scripts/plugins/useNavigationBlocker.spec.tsx index cbd00c380..352a0f249 100644 --- a/resources/scripts/plugins/useNavigationBlocker.spec.tsx +++ b/resources/scripts/plugins/useNavigationBlocker.spec.tsx @@ -10,7 +10,7 @@ import { type RouterHistory, } from '@tanstack/react-router'; import { afterEach, expect, it, vi } from 'vitest'; -import { UNSAVED_CHANGES_MESSAGE, useNavigationBlocker, type NavigationBlockerOptions } from './useNavigationBlocker'; +import { unsavedChangesMessage, useNavigationBlocker, type NavigationBlockerOptions } from './useNavigationBlocker'; afterEach(() => { cleanup(); @@ -80,7 +80,7 @@ it('guards the back button and reads a lazy condition at navigation time', async dirty = true; window.history.back(); - await waitFor(() => expect(confirm).toHaveBeenCalledWith(UNSAVED_CHANGES_MESSAGE)); + await waitFor(() => expect(confirm).toHaveBeenCalledWith(unsavedChangesMessage())); await waitFor(() => expect(window.location.pathname).toBe('/edit/one')); expect(screen.getByText('Editor')).toBeVisible(); diff --git a/resources/scripts/plugins/useNavigationBlocker.ts b/resources/scripts/plugins/useNavigationBlocker.ts index 148f2cbeb..67ec327c2 100644 --- a/resources/scripts/plugins/useNavigationBlocker.ts +++ b/resources/scripts/plugins/useNavigationBlocker.ts @@ -1,5 +1,6 @@ import { useCallback, useEffect, useRef } from 'react'; import { useBlocker, type ShouldBlockFn } from '@tanstack/react-router'; +import i18next from 'i18next'; import { routeParamStrings } from '@/router/params'; export interface NavigationBlockerLocation { @@ -21,7 +22,8 @@ export interface NavigationBlockerOptions { confirm?: (transition: NavigationTransition) => boolean | Promise; } -export const UNSAVED_CHANGES_MESSAGE = 'You have unsaved changes. Leave this page and discard them?'; +export const unsavedChangesMessage = (): string => + i18next.t('You have unsaved changes. Leave this page and discard them?'); /** Asks before leaving while `shouldBlock` holds, including back/forward and tab close. */ export function useNavigationBlocker( @@ -44,7 +46,7 @@ export function useNavigationBlocker( return false; } - const { confirm, message = UNSAVED_CHANGES_MESSAGE } = latest.current.options; + const { confirm, message = unsavedChangesMessage() } = latest.current.options; if (!confirm) { return !window.confirm(message); diff --git a/resources/scripts/router/RouteError.tsx b/resources/scripts/router/RouteError.tsx index 17a114e7f..763297d92 100644 --- a/resources/scripts/router/RouteError.tsx +++ b/resources/scripts/router/RouteError.tsx @@ -1,16 +1,16 @@ import { useCallback, useEffect } from 'react'; import axios from 'axios'; +import i18next from 'i18next'; import { useQueryErrorResetBoundary } from '@tanstack/react-query'; import { useRouter, type ErrorComponentProps } from '@tanstack/react-router'; import { httpErrorToHuman } from '@/api/http'; import { endBootstrapSession } from '@/bootstrap'; import { AccessDenied, NotFound, ServerError } from '@/components/elements/ScreenBlock'; import { parseRedirectSearch } from '@/router/redirect'; - -const accessDeniedMessage = 'You do not have permission to access this page.'; +import { useTranslation } from '@/sdk/localization'; export class RouteAccessDenied extends Error { - constructor(message = accessDeniedMessage) { + constructor(message = i18next.t('You do not have permission to access this page.')) { super(message); this.name = 'RouteAccessDenied'; } @@ -40,6 +40,7 @@ function SignInRedirect() { } export default function RouteError({ error }: ErrorComponentProps) { + const { t } = useTranslation(); const router = useRouter(); const queryErrorResetBoundary = useQueryErrorResetBoundary(); const retry = useCallback(() => void router.invalidate(), [router]); @@ -52,7 +53,15 @@ export default function RouteError({ error }: ErrorComponentProps) { case 401: return ; case 403: - return ; + return ( + + ); case 404: return ; case undefined: diff --git a/resources/scripts/router/routeTree.ts b/resources/scripts/router/routeTree.ts index e4dc09e72..d1b2313c2 100644 --- a/resources/scripts/router/routeTree.ts +++ b/resources/scripts/router/routeTree.ts @@ -2,6 +2,7 @@ import type { QueryClient } from '@tanstack/react-query'; import type { AnyRoute } from '@tanstack/react-router'; import { createRootRouteWithContext, createRoute, lazyRouteComponent, redirect } from '@tanstack/react-router'; import { publishAreaNav, type AreaNavEntry } from '@/router/nav'; +import i18next from 'i18next'; import { translatable } from '@/sdk/localization'; import { getExtensionScreens, @@ -190,13 +191,13 @@ const accountChildren = [ createRoute({ getParentRoute: () => accountRoute, path: '/', - staticData: { nav: { label: 'Account', exact: true, icon: 'user-round' } }, + staticData: { nav: { label: translatable('Account'), exact: true, icon: 'user-round' } }, component: pageRoute('page.account.overview'), }), createRoute({ getParentRoute: () => accountRoute, path: 'api', - staticData: { nav: { label: 'API Credentials', icon: 'key-round' } }, + staticData: { nav: { label: translatable('API Credentials'), icon: 'key-round' } }, loader: async ({ context }) => { await context.queryClient.ensureQueryData({ ...accountApiKeysQueryOptions(), revalidateIfStale: true }); }, @@ -205,7 +206,7 @@ const accountChildren = [ createRoute({ getParentRoute: () => accountRoute, path: 'ssh', - staticData: { nav: { label: 'SSH Keys', icon: 'terminal' } }, + staticData: { nav: { label: translatable('SSH Keys'), icon: 'terminal' } }, loader: async ({ context }) => { await context.queryClient.ensureQueryData({ ...accountSshKeysQueryOptions(), revalidateIfStale: true }); }, @@ -214,7 +215,7 @@ const accountChildren = [ createRoute({ getParentRoute: () => accountRoute, path: 'activity', - staticData: { nav: { label: 'Activity', icon: 'history' } }, + staticData: { nav: { label: translatable('Activity'), icon: 'history' } }, validateSearch: parseActivitySearch, loaderDeps: ({ search }) => ({ page: search.page ?? 1, event: search.event, user: search.user }), loader: async ({ context, deps }) => { @@ -265,13 +266,13 @@ const serverChildren = [ createRoute({ getParentRoute: () => serverRoute, path: '/', - staticData: { nav: { label: 'Console', exact: true, icon: 'square-terminal' } }, + staticData: { nav: { label: translatable('Console'), exact: true, icon: 'square-terminal' } }, component: () => null, }), createRoute({ getParentRoute: () => serverRoute, path: 'files', - staticData: { nav: { label: 'Files', permission: 'file.*', hash: '/', icon: 'folder' } }, + staticData: { nav: { label: translatable('Files'), permission: 'file.*', hash: '/', icon: 'folder' } }, beforeLoad: requireServerPermission('file.*'), component: pageRoute('page.server.files', 'file.*'), }), @@ -284,7 +285,7 @@ const serverChildren = [ createRoute({ getParentRoute: () => serverRoute, path: 'databases', - staticData: { nav: { label: 'Databases', permission: 'database.*', icon: 'database' } }, + staticData: { nav: { label: translatable('Databases'), permission: 'database.*', icon: 'database' } }, beforeLoad: requireServerPermission('database.*'), loader: async ({ context }) => { await context.queryClient.ensureQueryData({ @@ -297,7 +298,7 @@ const serverChildren = [ createRoute({ getParentRoute: () => serverRoute, path: 'schedules', - staticData: { nav: { label: 'Schedules', permission: 'schedule.*', icon: 'calendar-clock' } }, + staticData: { nav: { label: translatable('Schedules'), permission: 'schedule.*', icon: 'calendar-clock' } }, beforeLoad: requireServerPermission('schedule.*'), loader: async ({ context }) => { await context.queryClient.ensureQueryData({ @@ -332,7 +333,7 @@ const serverChildren = [ createRoute({ getParentRoute: () => serverRoute, path: 'users', - staticData: { nav: { label: 'Users', permission: 'user.*', icon: 'users' } }, + staticData: { nav: { label: translatable('Users'), permission: 'user.*', icon: 'users' } }, beforeLoad: requireServerPermission('user.*'), loader: async ({ context }) => { await Promise.all([ @@ -348,7 +349,7 @@ const serverChildren = [ createRoute({ getParentRoute: () => serverRoute, path: 'backups', - staticData: { nav: { label: 'Backups', permission: 'backup.*', icon: 'archive' } }, + staticData: { nav: { label: translatable('Backups'), permission: 'backup.*', icon: 'archive' } }, validateSearch: parsePageSearch, beforeLoad: requireServerPermission('backup.*'), loaderDeps: ({ search }) => ({ page: search.page ?? 1 }), @@ -363,7 +364,7 @@ const serverChildren = [ createRoute({ getParentRoute: () => serverRoute, path: 'network', - staticData: { nav: { label: 'Network', permission: 'allocation.*', icon: 'network' } }, + staticData: { nav: { label: translatable('Network'), permission: 'allocation.*', icon: 'network' } }, beforeLoad: requireServerPermission('allocation.*'), loader: async ({ context }) => { await context.queryClient.ensureQueryData({ @@ -376,7 +377,7 @@ const serverChildren = [ createRoute({ getParentRoute: () => serverRoute, path: 'startup', - staticData: { nav: { label: 'Startup', permission: 'startup.*', icon: 'rocket' } }, + staticData: { nav: { label: translatable('Startup'), permission: 'startup.*', icon: 'rocket' } }, beforeLoad: requireServerPermission('startup.*'), loader: async ({ context }) => { await context.queryClient.ensureQueryData({ @@ -389,14 +390,16 @@ const serverChildren = [ createRoute({ getParentRoute: () => serverRoute, path: 'settings', - staticData: { nav: { label: 'Settings', permission: ['settings.*', 'file.sftp'], icon: 'settings' } }, + staticData: { + nav: { label: translatable('Settings'), permission: ['settings.*', 'file.sftp'], icon: 'settings' }, + }, beforeLoad: requireServerPermission(['settings.*', 'file.sftp']), component: pageRoute('page.server.settings', ['settings.*', 'file.sftp']), }), createRoute({ getParentRoute: () => serverRoute, path: 'activity', - staticData: { nav: { label: 'Activity', permission: 'activity.*', icon: 'history' } }, + staticData: { nav: { label: translatable('Activity'), permission: 'activity.*', icon: 'history' } }, validateSearch: parseActivitySearch, beforeLoad: requireServerPermission('activity.*'), loaderDeps: ({ search }) => ({ page: search.page ?? 1, event: search.event, user: search.user }), @@ -427,7 +430,7 @@ const panelRoute = createRoute({ const user = await context.queryClient.ensureQueryData(currentUserQueryOptions()); if (!user.rootAdmin) { - throw new RouteAccessDenied('You do not have permission to access the administrative area.'); + throw new RouteAccessDenied(i18next.t('You do not have permission to access the administrative area.')); } }, component: layoutRoute('layout.admin'), diff --git a/resources/scripts/sdk/table.tsx b/resources/scripts/sdk/table.tsx index 30a37630c..0351dc5b9 100644 --- a/resources/scripts/sdk/table.tsx +++ b/resources/scripts/sdk/table.tsx @@ -23,6 +23,7 @@ import { RowActionsMenu as PanelRowActionsMenu, } from '@/components/elements/table/RowActions'; import { resolvePanelDestination, type PanelDestination } from './navigation'; +import Translate from '@/components/elements/Translate'; type TableColumnBase = { id: string; @@ -199,7 +200,11 @@ export function actionsColumn( return { id: 'actions', - label: Actions, + label: ( + + + + ), cell, headerClassName: className, cellClassName: className, diff --git a/resources/scripts/themes/classic/views/account/AccountOverview.tsx b/resources/scripts/themes/classic/views/account/AccountOverview.tsx index 681789345..2594921ed 100644 --- a/resources/scripts/themes/classic/views/account/AccountOverview.tsx +++ b/resources/scripts/themes/classic/views/account/AccountOverview.tsx @@ -1,15 +1,20 @@ -import { Alert, cn, PageContentBlock, PageHeading } from '@/sdk'; +import { Alert, cn, PageContentBlock, PageHeading, useTranslation } from '@/sdk'; import { Slot, View, type ViewProps } from '@/sdk/theme'; const CARD_WIDTH = 'w-full sm:w-[calc(50%_-_1rem)] md:w-auto md:flex-1'; export default function AccountOverview({ model, className }: ViewProps<'page.account.overview'>) { + const { t } = useTranslation(); + return ( - - + + {model.twoFactorRequired && ( - - Your account must have two-factor authentication enabled in order to continue. + + {t('Your account must have two-factor authentication enabled in order to continue.')} )} diff --git a/resources/scripts/themes/classic/views/account/ApiKeyCreate.tsx b/resources/scripts/themes/classic/views/account/ApiKeyCreate.tsx index 0880dc340..f8d2241aa 100644 --- a/resources/scripts/themes/classic/views/account/ApiKeyCreate.tsx +++ b/resources/scripts/themes/classic/views/account/ApiKeyCreate.tsx @@ -1,13 +1,16 @@ -import { Button, ContentBox, CopyOnClick, Dialog, Form, SpinnerOverlay } from '@/sdk'; +import { Button, ContentBox, CopyOnClick, Dialog, Form, SpinnerOverlay, useTranslation } from '@/sdk'; import type { ViewProps } from '@/sdk/theme'; import { TextAreaField, TextField } from '../shared/fields'; function CreatedKeyDialog({ apiKey, onClose }: { apiKey: string | null; onClose: () => void }) { + const { t } = useTranslation(); + return ( - +

- The API key you have requested is shown below. Please store this in a safe location, it will not be - shown again. + {t( + 'The API key you have requested is shown below. Please store this in a safe location, it will not be shown again.' + )}

                 
@@ -16,7 +19,7 @@ function CreatedKeyDialog({ apiKey, onClose }: { apiKey: string | null; onClose:
             
@@ -24,27 +27,31 @@ function CreatedKeyDialog({ apiKey, onClose }: { apiKey: string | null; onClose: } export default function ApiKeyCreate({ model, className }: ViewProps<'account.apiKeys.create'>) { + const { t } = useTranslation(); + return ( - +
diff --git a/resources/scripts/themes/classic/views/account/ApiKeyList.tsx b/resources/scripts/themes/classic/views/account/ApiKeyList.tsx index 4f5ca6aec..f3b962b8a 100644 --- a/resources/scripts/themes/classic/views/account/ApiKeyList.tsx +++ b/resources/scripts/themes/classic/views/account/ApiKeyList.tsx @@ -15,15 +15,18 @@ import { Spinner, SpinnerOverlay, Table, + Translate, + useTranslation, type ApiKeyItem, type TableColumn, + type Translation, } from '@/sdk'; import type { ViewProps } from '@/sdk/theme'; -const apiKeyColumns = (onDelete: (identifier: string) => void): TableColumn[] => [ +const apiKeyColumns = (t: Translation['t'], onDelete: (identifier: string) => void): TableColumn[] => [ { id: 'description', - label: 'Description', + label: t('Description'), sortValue: (key) => key.description, cell: (key) => (
@@ -34,7 +37,7 @@ const apiKeyColumns = (onDelete: (identifier: string) => void): TableColumn key.identifier, cell: (key) => {key.identifier}, headerClassName: 'hidden md:table-cell', @@ -42,11 +45,11 @@ const apiKeyColumns = (onDelete: (identifier: string) => void): TableColumn key.lastUsedAt, cell: (key) => ( - {key.lastUsedAt ? formatDate(key.lastUsedAt, 'MMM D, YYYY HH:mm') : 'Never'} + {key.lastUsedAt ? formatDate(key.lastUsedAt, 'lll') : t('Never')} ), headerClassName: 'hidden lg:table-cell w-40', @@ -54,11 +57,11 @@ const apiKeyColumns = (onDelete: (identifier: string) => void): TableColumnActions, + label: {t('Actions')}, cell: (key) => ( onDelete(key.identifier)} /> @@ -70,20 +73,25 @@ const apiKeyColumns = (onDelete: (identifier: string) => void): TableColumn) { const [deleteIdentifier, setDeleteIdentifier] = useState(''); - const columns = useMemo(() => apiKeyColumns(setDeleteIdentifier), []); + const { t } = useTranslation(); + const columns = useMemo(() => apiKeyColumns(t, setDeleteIdentifier), [t]); return ( - + setDeleteIdentifier('')} onConfirmed={() => void model.remove(deleteIdentifier).then(() => setDeleteIdentifier(''))} > - All requests using the {deleteIdentifier} key will be invalidated. + {null} }} + /> {model.loading ? ( @@ -98,9 +106,9 @@ export default function ApiKeyList({ model, className }: ViewProps<'account.apiK - No API keys + {t('No API keys')} - Create a key to use the client API from your own scripts and tools. + {t('Create a key to use the client API from your own scripts and tools.')} diff --git a/resources/scripts/themes/classic/views/account/ApiKeysPage.tsx b/resources/scripts/themes/classic/views/account/ApiKeysPage.tsx index 77fbc8f74..46b9fb68a 100644 --- a/resources/scripts/themes/classic/views/account/ApiKeysPage.tsx +++ b/resources/scripts/themes/classic/views/account/ApiKeysPage.tsx @@ -1,11 +1,13 @@ -import { PageContentBlock } from '@/sdk'; +import { PageContentBlock, useTranslation } from '@/sdk'; import { View, type ViewProps } from '@/sdk/theme'; import PageStatus from '../shared/PageStatus'; export default function ApiKeysPage({ model, className }: ViewProps<'page.account.api'>) { + const { t } = useTranslation(); + return ( - +
diff --git a/resources/scripts/themes/classic/views/account/AvatarCard.tsx b/resources/scripts/themes/classic/views/account/AvatarCard.tsx index 3e49834b9..0062e8c21 100644 --- a/resources/scripts/themes/classic/views/account/AvatarCard.tsx +++ b/resources/scripts/themes/classic/views/account/AvatarCard.tsx @@ -1,12 +1,13 @@ import { useRef } from 'react'; -import { Avatar, Button, ContentBox, SpinnerOverlay } from '@/sdk'; +import { Avatar, Button, ContentBox, SpinnerOverlay, useTranslation } from '@/sdk'; import type { ViewProps } from '@/sdk/theme'; export default function AvatarCard({ model, className }: ViewProps<'account.avatar'>) { const input = useRef(null); + const { t } = useTranslation(); return ( - +
@@ -14,8 +15,9 @@ export default function AvatarCard({ model, className }: ViewProps<'account.avat

- You may select a custom avatar for your personal account. PNG, JPEG, SVG, WebP, AVIF, and ICO - files are supported. + {t( + 'You may select a custom avatar for your personal account. PNG, JPEG, SVG, WebP, AVIF, and ICO files are supported.' + )}

@@ -24,7 +26,7 @@ export default function AvatarCard({ model, className }: ViewProps<'account.avat type='file' accept={model.accept} className='hidden' - aria-label='Avatar file' + aria-label={t('Avatar file')} onChange={(event) => model.select(event.target.files?.[0] ?? null)} /> - Remove Avatar + {t('Remove Avatar')}
diff --git a/resources/scripts/themes/classic/views/account/DisableTwoFactorDialog.tsx b/resources/scripts/themes/classic/views/account/DisableTwoFactorDialog.tsx index 39a7a6fad..cedd322b1 100644 --- a/resources/scripts/themes/classic/views/account/DisableTwoFactorDialog.tsx +++ b/resources/scripts/themes/classic/views/account/DisableTwoFactorDialog.tsx @@ -1,8 +1,9 @@ -import { Button, Dialog, Input, Tooltip, type AccountTwoFactorModel } from '@/sdk'; +import { Button, Dialog, Input, Tooltip, useTranslation, type AccountTwoFactorModel } from '@/sdk'; export default function DisableTwoFactorDialog({ model }: { model: AccountTwoFactorModel }) { const { disable } = model; const { password } = disable.fields; + const { t } = useTranslation(); return (
- Cancel + {t('Cancel')} 0} - content='You must enter your account password to continue.' + content={t('You must enter your account password to continue.')} > - Disable + {t('Disable')} diff --git a/resources/scripts/themes/classic/views/account/EmailCard.tsx b/resources/scripts/themes/classic/views/account/EmailCard.tsx index cb70fb98d..ed4d8d87d 100644 --- a/resources/scripts/themes/classic/views/account/EmailCard.tsx +++ b/resources/scripts/themes/classic/views/account/EmailCard.tsx @@ -1,19 +1,21 @@ -import { Button, ContentBox, Form, SpinnerOverlay } from '@/sdk'; +import { Button, ContentBox, Form, SpinnerOverlay, useTranslation } from '@/sdk'; import type { ViewProps } from '@/sdk/theme'; import { TextField } from '../shared/fields'; export default function EmailCard({ model, className }: ViewProps<'account.email'>) { + const { t } = useTranslation(); + return ( - + - +
- +
diff --git a/resources/scripts/themes/classic/views/account/LanguageCard.tsx b/resources/scripts/themes/classic/views/account/LanguageCard.tsx index 8e0cbebd9..3454cbb3e 100644 --- a/resources/scripts/themes/classic/views/account/LanguageCard.tsx +++ b/resources/scripts/themes/classic/views/account/LanguageCard.tsx @@ -1,11 +1,13 @@ -import { ContentBox, Label, Select, SpinnerOverlay } from '@/sdk'; +import { ContentBox, Label, Select, SpinnerOverlay, useTranslation } from '@/sdk'; import type { ViewProps } from '@/sdk/theme'; export default function LanguageCard({ model, className }: ViewProps<'account.language'>) { + const { t } = useTranslation(); + return ( - + - + - Cancel + {t('Cancel')} @@ -74,7 +79,7 @@ function SetupForm({ setup, onClose }: { setup: TwoFactorSetupModel; onClose: () type='submit' form='enable-totp-form' > - Enable + {t('Enable')} @@ -83,14 +88,18 @@ function SetupForm({ setup, onClose }: { setup: TwoFactorSetupModel; onClose: () } export default function SetupTwoFactorDialog({ model }: { model: AccountTwoFactorModel }) { + const { t } = useTranslation(); + return ( diff --git a/resources/scripts/themes/classic/views/account/SshKeyCreate.tsx b/resources/scripts/themes/classic/views/account/SshKeyCreate.tsx index 86cbcbc2a..0a67d6902 100644 --- a/resources/scripts/themes/classic/views/account/SshKeyCreate.tsx +++ b/resources/scripts/themes/classic/views/account/SshKeyCreate.tsx @@ -1,24 +1,26 @@ -import { Button, ContentBox, Form, SpinnerOverlay } from '@/sdk'; +import { Button, ContentBox, Form, SpinnerOverlay, useTranslation } from '@/sdk'; import type { ViewProps } from '@/sdk/theme'; import { TextAreaField, TextField } from '../shared/fields'; export default function SshKeyCreate({ model, className }: ViewProps<'account.sshKeys.create'>) { + const { t } = useTranslation(); + return ( - +
- +
diff --git a/resources/scripts/themes/classic/views/account/SshKeyList.tsx b/resources/scripts/themes/classic/views/account/SshKeyList.tsx index 0215af1d9..3d5907838 100644 --- a/resources/scripts/themes/classic/views/account/SshKeyList.tsx +++ b/resources/scripts/themes/classic/views/account/SshKeyList.tsx @@ -14,29 +14,40 @@ import { RowActions, Spinner, Table, + Translate, + useTranslation, type SshKeyItem, type SshKeyListModel, type TableColumn, + type Translation, } from '@/sdk'; import type { ViewProps } from '@/sdk/theme'; function DeleteKeyButton({ item, remove }: { item: SshKeyItem; remove: SshKeyListModel['remove'] }) { + const { t } = useTranslation(); + return ( remove(item.fingerprint).then(close)} - trigger={({ onClick }) => } + trigger={({ onClick }) => ( + + )} > - Removing the {item.name} SSH key will invalidate its usage across the Panel. + {null} }} + /> ); } -const sshKeyColumns = (remove: SshKeyListModel['remove']): TableColumn[] => [ +const sshKeyColumns = (t: Translation['t'], remove: SshKeyListModel['remove']): TableColumn[] => [ { id: 'name', - label: 'Name', + label: t('Name'), sortValue: (key) => key.name, cell: (key) => (
@@ -49,7 +60,7 @@ const sshKeyColumns = (remove: SshKeyListModel['remove']): TableColumn key.fingerprint, cell: (key) => SHA256:{key.fingerprint}, headerClassName: 'hidden md:table-cell', @@ -57,11 +68,11 @@ const sshKeyColumns = (remove: SshKeyListModel['remove']): TableColumn key.createdAt, cell: (key) => ( ), headerClassName: 'hidden lg:table-cell w-40', @@ -69,7 +80,7 @@ const sshKeyColumns = (remove: SshKeyListModel['remove']): TableColumnActions, + label: {t('Actions')}, cell: (key) => ( @@ -82,10 +93,11 @@ const sshKeyColumns = (remove: SshKeyListModel['remove']): TableColumn) { const { remove } = model; - const columns = useMemo(() => sshKeyColumns(remove), [remove]); + const { t } = useTranslation(); + const columns = useMemo(() => sshKeyColumns(t, remove), [t, remove]); return ( - + {model.loading ? ( ) : ( @@ -99,9 +111,9 @@ export default function SshKeyList({ model, className }: ViewProps<'account.sshK - No SSH keys + {t('No SSH keys')} - Add a public key to sign in to SFTP without a password. + {t('Add a public key to sign in to SFTP without a password.')} diff --git a/resources/scripts/themes/classic/views/account/SshKeysPage.tsx b/resources/scripts/themes/classic/views/account/SshKeysPage.tsx index 97f7fab9e..151ac02de 100644 --- a/resources/scripts/themes/classic/views/account/SshKeysPage.tsx +++ b/resources/scripts/themes/classic/views/account/SshKeysPage.tsx @@ -1,11 +1,13 @@ -import { PageContentBlock } from '@/sdk'; +import { PageContentBlock, useTranslation } from '@/sdk'; import { View, type ViewProps } from '@/sdk/theme'; import PageStatus from '../shared/PageStatus'; export default function SshKeysPage({ model, className }: ViewProps<'page.account.ssh'>) { + const { t } = useTranslation(); + return ( - +
diff --git a/resources/scripts/themes/classic/views/account/TwoFactorCard.tsx b/resources/scripts/themes/classic/views/account/TwoFactorCard.tsx index 6e9580a02..b02446a77 100644 --- a/resources/scripts/themes/classic/views/account/TwoFactorCard.tsx +++ b/resources/scripts/themes/classic/views/account/TwoFactorCard.tsx @@ -1,26 +1,32 @@ -import { Button, ContentBox } from '@/sdk'; +import { Button, ContentBox, useTranslation } from '@/sdk'; import type { ViewProps } from '@/sdk/theme'; import DisableTwoFactorDialog from './DisableTwoFactorDialog'; import RecoveryTokensDialog from './RecoveryTokensDialog'; import SetupTwoFactorDialog from './SetupTwoFactorDialog'; export default function TwoFactorCard({ model, className }: ViewProps<'account.twoFactor'>) { + const { t } = useTranslation(); + return ( - +

{model.enabled - ? 'Two-step verification is currently enabled on your account.' - : 'You do not currently have two-step verification enabled on your account. Click the button below to begin configuring it.'} + ? t('Two-step verification is currently enabled on your account.') + : t( + 'You do not currently have two-step verification enabled on your account. Click the button below to begin configuring it.' + )}

{model.enabled ? ( - model.openDialog('disable')}>Disable Two-Step + model.openDialog('disable')}> + {t('Disable Two-Step')} + ) : ( - + )}
diff --git a/resources/scripts/themes/classic/views/activity/AccountActivityPage.tsx b/resources/scripts/themes/classic/views/activity/AccountActivityPage.tsx index db7e3dbb6..befc23661 100644 --- a/resources/scripts/themes/classic/views/activity/AccountActivityPage.tsx +++ b/resources/scripts/themes/classic/views/activity/AccountActivityPage.tsx @@ -1,9 +1,11 @@ -import { PageContentBlock } from '@/sdk'; +import { PageContentBlock, useTranslation } from '@/sdk'; import { View, type ViewProps } from '@/sdk/theme'; export default function AccountActivityPage({ className }: ViewProps<'page.account.activity'>) { + const { t } = useTranslation(); + return ( - + ); diff --git a/resources/scripts/themes/classic/views/activity/ActivityLog.tsx b/resources/scripts/themes/classic/views/activity/ActivityLog.tsx index 4aa6e8738..31289bc0f 100644 --- a/resources/scripts/themes/classic/views/activity/ActivityLog.tsx +++ b/resources/scripts/themes/classic/views/activity/ActivityLog.tsx @@ -12,19 +12,24 @@ import { PaginationFooter, Select, Spinner, + useTranslation, type ActivityLogModel, type ActivityScope, + type Translation, } from '@/sdk'; import type { ViewProps } from '@/sdk/theme'; import ActivityLogEntry from './ActivityLogEntry'; -const emptyMessages = { - account: 'Actions taken on your account will appear here.', - server: 'Actions taken on this server will appear here.', - admin: 'Actions taken through the admin panel will appear here.', -} satisfies Record; +const emptyMessages = (t: Translation['t']) => + ({ + account: t('Actions taken on your account will appear here.'), + server: t('Actions taken on this server will appear here.'), + admin: t('Actions taken through the admin panel will appear here.'), + }) satisfies Record; function Results({ model, filtered }: { model: ActivityLogModel; filtered: boolean }) { + const { t } = useTranslation(); + if (model.loading) { return ; } @@ -43,15 +48,15 @@ function Results({ model, filtered }: { model: ActivityLogModel; filtered: boole {filtered ? : } - {filtered ? 'No matching activity' : 'No activity yet'} + {filtered ? t('No matching activity') : t('No activity yet')} - {filtered ? 'No activity matches the selected filters.' : emptyMessages[model.scope]} + {filtered ? t('No activity matches the selected filters.') : emptyMessages(t)[model.scope]} {filtered && ( - Clear filters + {t('Clear filters')} )} @@ -61,17 +66,18 @@ function Results({ model, filtered }: { model: ActivityLogModel; filtered: boole function Filters({ model, filtered }: { model: ActivityLogModel; filtered: boolean }) { const { actions } = model; + const { t } = useTranslation(); return (
{model.users && (
({ label: group.label, options: [...group.options] })), ]} value={model.event ?? ''} - placeholder='All events' - searchPlaceholder='Search events…' - emptyMessage='Nothing has been recorded here yet.' + placeholder={t('All events')} + searchPlaceholder={t('Search events…')} + emptyMessage={t('Nothing has been recorded here yet.')} onChange={(value) => actions.setEvent(String(value) || null)} />
@@ -96,7 +102,7 @@ function Filters({ model, filtered }: { model: ActivityLogModel; filtered: boole className='inline-flex items-center justify-center w-full sm:w-auto sm:shrink-0 h-auto' onClick={actions.clearFilters} > - Clear Filters + {t('Clear Filters')} )}
@@ -105,6 +111,7 @@ function Filters({ model, filtered }: { model: ActivityLogModel; filtered: boole export default function ActivityLog({ model, className }: ViewProps<'activity.log'>) { const filtered = model.event !== null || model.user !== null; + const { t } = useTranslation(); return (
@@ -112,7 +119,7 @@ export default function ActivityLog({ model, className }: ViewProps<'activity.lo
{model.error} - Retry + {t('Retry')}
)} diff --git a/resources/scripts/themes/classic/views/activity/ActivityLogEntry.tsx b/resources/scripts/themes/classic/views/activity/ActivityLogEntry.tsx index 6bfa0e19c..d62821b73 100644 --- a/resources/scripts/themes/classic/views/activity/ActivityLogEntry.tsx +++ b/resources/scripts/themes/classic/views/activity/ActivityLogEntry.tsx @@ -7,6 +7,7 @@ import { PanelLink, Tooltip, Translate, + useTranslation, type ActivityEntry, type ActivityProperties, type TranslationValue, @@ -47,6 +48,7 @@ const wrapProperties = (properties: ActivityProperties): TranslationValues => export default function ActivityLogEntry({ entry }: { entry: ActivityEntry }) { const { actor } = entry; + const { t } = useTranslation(); return (
@@ -58,8 +60,8 @@ export default function ActivityLogEntry({ entry }: { entry: ActivityEntry }) {
- - {actor?.username || 'System'} + + {actor?.username || t('System')}  — 
{entry.api && ( - + )} {entry.sftp && ( - + )} @@ -103,7 +105,7 @@ export default function ActivityLogEntry({ entry }: { entry: ActivityEntry }) {  |  )} - + {fromNow(entry.timestamp)}
diff --git a/resources/scripts/themes/classic/views/activity/ActivityMetadataButton.tsx b/resources/scripts/themes/classic/views/activity/ActivityMetadataButton.tsx index bd87ba09a..adb7307e2 100644 --- a/resources/scripts/themes/classic/views/activity/ActivityMetadataButton.tsx +++ b/resources/scripts/themes/classic/views/activity/ActivityMetadataButton.tsx @@ -1,14 +1,16 @@ import { ClipboardList } from 'lucide-react'; -import { Button, Dialog, type ActivityProperties } from '@/sdk'; +import { Button, Dialog, useTranslation, type ActivityProperties } from '@/sdk'; export default function ActivityMetadataButton({ meta }: { meta: ActivityProperties }) { + const { t } = useTranslation(); + return (
(
@@ -32,12 +35,12 @@ export default function CheckpointPage({ model, className }: ViewProps<'page.aut onClick={model.toggleRecovery} className='cursor-pointer appearance-none border-0 bg-transparent p-0 text-xs text-muted-foreground tracking-wide uppercase no-underline hover:text-foreground' > - {recovery ? 'I Have My Device' : "I've Lost My Device"} + {recovery ? t('I Have My Device') : t("I've Lost My Device")}
- Return to Login + {t('Return to Login')}
diff --git a/resources/scripts/themes/classic/views/auth/ForgotPasswordPage.tsx b/resources/scripts/themes/classic/views/auth/ForgotPasswordPage.tsx index 9039a938d..cb4bde866 100644 --- a/resources/scripts/themes/classic/views/auth/ForgotPasswordPage.tsx +++ b/resources/scripts/themes/classic/views/auth/ForgotPasswordPage.tsx @@ -1,28 +1,29 @@ -import { Button, PanelLink } from '@/sdk'; +import { Button, PanelLink, useTranslation } from '@/sdk'; import type { ViewProps } from '@/sdk/theme'; import { TextField } from '../shared/fields'; import AuthCard, { authLinkClass } from './AuthCard'; export default function ForgotPasswordPage({ model, className }: ViewProps<'page.auth.password'>) { const { Captcha } = model; + const { t } = useTranslation(); return ( - +
{Captcha && }
- Return to Login + {t('Return to Login')}
diff --git a/resources/scripts/themes/classic/views/auth/PterodactylMark.tsx b/resources/scripts/themes/classic/views/auth/PterodactylMark.tsx index a26dbd5d1..0131a3e33 100644 --- a/resources/scripts/themes/classic/views/auth/PterodactylMark.tsx +++ b/resources/scripts/themes/classic/views/auth/PterodactylMark.tsx @@ -1,10 +1,14 @@ +import { useTranslation } from '@/sdk'; + export default function PterodactylMark({ className }: { className?: string }) { + const { t } = useTranslation(); + return ( ) { const { fields, Captcha } = model; + const { t } = useTranslation(); return ( - +
- +
- +
{Captcha && }
- Return to Login + {t('Return to Login')}
diff --git a/resources/scripts/themes/classic/views/dashboard/Dashboard.tsx b/resources/scripts/themes/classic/views/dashboard/Dashboard.tsx index 10ee6a695..c5e9f1d3d 100644 --- a/resources/scripts/themes/classic/views/dashboard/Dashboard.tsx +++ b/resources/scripts/themes/classic/views/dashboard/Dashboard.tsx @@ -1,11 +1,13 @@ -import { PageContentBlock } from '@/sdk'; +import { PageContentBlock, useTranslation } from '@/sdk'; import { View, type ViewProps } from '@/sdk/theme'; import PageStatus from '../shared/PageStatus'; export default function Dashboard({ model, className }: ViewProps<'page.dashboard'>) { + const { t } = useTranslation(); + return ( - + diff --git a/resources/scripts/themes/classic/views/dashboard/ServerCardMetrics.tsx b/resources/scripts/themes/classic/views/dashboard/ServerCardMetrics.tsx index 25913e732..ae6503612 100644 --- a/resources/scripts/themes/classic/views/dashboard/ServerCardMetrics.tsx +++ b/resources/scripts/themes/classic/views/dashboard/ServerCardMetrics.tsx @@ -1,16 +1,17 @@ import { Cpu, HardDrive, MemoryStick } from 'lucide-react'; -import { Badge, bytesToString, cn, Spinner, Stat } from '@/sdk'; +import { Badge, bytesToString, cn, Spinner, Stat, useTranslation, type Translation } from '@/sdk'; import type { ServerCardState, ServerStatMetric, ServerUnavailableReason, UiTone, ViewProps } from '@/sdk/theme'; -const unavailableLabels = { - suspended: 'Suspended', - 'connection-error': 'Connection Error', - maintenance: 'Under Maintenance', - transferring: 'Transferring', - installing: 'Installing', - 'restoring-backup': 'Restoring Backup', - unavailable: 'Unavailable', -} as const; +const unavailableLabels = (t: Translation['t']) => + ({ + suspended: t('Suspended'), + 'connection-error': t('Connection Error'), + maintenance: t('Under Maintenance'), + transferring: t('Transferring'), + installing: t('Installing'), + 'restoring-backup': t('Restoring Backup'), + unavailable: t('Unavailable'), + }) satisfies Record; const unavailableTones = { suspended: 'danger', @@ -23,9 +24,11 @@ const unavailableTones = { } satisfies Record; function UnavailableBadge({ reason }: { reason: ServerUnavailableReason }) { + const { t } = useTranslation(); + return (
- {unavailableLabels[reason]} + {unavailableLabels(t)[reason]}
); } @@ -34,6 +37,8 @@ function UnavailableBadge({ reason }: { reason: ServerUnavailableReason }) { const tone = ({ alarm }: ServerStatMetric): UiTone => (alarm === 'danger' ? 'danger' : 'neutral'); function MetricsContent({ state }: { state: ServerCardState }) { + const { t } = useTranslation(); + if (state.kind === 'loading') { return ; } @@ -46,25 +51,25 @@ function MetricsContent({ state }: { state: ServerCardState }) { <> {[ { - label: 'CPU', + label: t('CPU'), icon: Cpu, metric: state.cpu, value: `${state.cpu.value.toFixed(2)} %`, - limit: state.cpu.limit === 0 ? 'Unlimited' : `${state.cpu.limit} %`, + limit: state.cpu.limit === 0 ? t('Unlimited') : `${state.cpu.limit} %`, }, { - label: 'Memory', + label: t('Memory'), icon: MemoryStick, metric: state.memory, value: bytesToString(state.memory.value), - limit: state.memory.limit === 0 ? 'Unlimited' : bytesToString(state.memory.limit), + limit: state.memory.limit === 0 ? t('Unlimited') : bytesToString(state.memory.limit), }, { - label: 'Disk', + label: t('Disk'), icon: HardDrive, metric: state.disk, value: bytesToString(state.disk.value), - limit: state.disk.limit === 0 ? 'Unlimited' : bytesToString(state.disk.limit), + limit: state.disk.limit === 0 ? t('Unlimited') : bytesToString(state.disk.limit), }, ].map(({ label, icon, metric, value, limit }) => ( diff --git a/resources/scripts/themes/classic/views/dashboard/ServerList.tsx b/resources/scripts/themes/classic/views/dashboard/ServerList.tsx index f9f3b4a69..288e7865f 100644 --- a/resources/scripts/themes/classic/views/dashboard/ServerList.tsx +++ b/resources/scripts/themes/classic/views/dashboard/ServerList.tsx @@ -13,6 +13,7 @@ import { Pagination, Spinner, Switch, + useTranslation, } from '@/sdk'; import { Slot, View, type ServerListItem, type ServerListModel, type UiTone, type ViewProps } from '@/sdk/theme'; @@ -47,6 +48,7 @@ function ServerRow({ item, className }: { item: ServerListItem; className?: stri function NoServers({ model }: { model: ServerListModel }) { const others = model.scope === 'others'; + const { t } = useTranslation(); return ( @@ -54,16 +56,16 @@ function NoServers({ model }: { model: ServerListModel }) { - {others ? 'No other servers' : 'No servers yet'} + {others ? t('No other servers') : t('No servers yet')} {others - ? 'There are no servers owned by other users.' - : 'Servers you own or are invited to will appear here.'} + ? t('There are no servers owned by other users.') + : t('Servers you own or are invited to will appear here.')} {model.canCreateServers && ( - New server + {t('New server')} )} @@ -73,18 +75,19 @@ function NoServers({ model }: { model: ServerListModel }) { export default function ServerList({ model, className }: ViewProps<'dashboard.serverList'>) { const others = model.scope === 'others'; const { pagination } = model; + const { t } = useTranslation(); return (
model.actions.setScope(others ? 'mine' : 'others')} - label={others ? "Showing others' servers" : 'Showing your servers'} + label={others ? t("Showing others' servers") : t('Showing your servers')} controlPosition='end' className='gap-2' /> diff --git a/resources/scripts/themes/classic/views/layout/AdminLayout.tsx b/resources/scripts/themes/classic/views/layout/AdminLayout.tsx index 3848e4085..1a12f9c96 100644 --- a/resources/scripts/themes/classic/views/layout/AdminLayout.tsx +++ b/resources/scripts/themes/classic/views/layout/AdminLayout.tsx @@ -19,7 +19,7 @@ import { Users, type LucideIcon, } from 'lucide-react'; -import { cn, Icon, NavigationLabel, usePanelLocation } from '@/sdk'; +import { cn, Icon, NavigationLabel, usePanelLocation, useTranslation } from '@/sdk'; import { Main, Navigation, @@ -79,6 +79,7 @@ function AdminSidebar({ nav }: { nav: NavigationModel }) { const [open, setOpen] = useState(false); const { pathname } = usePanelLocation(); const current = useActiveNavItem(nav.items); + const { t } = useTranslation(); useEffect(() => setOpen(false), [pathname]); @@ -95,7 +96,7 @@ function AdminSidebar({ nav }: { nav: NavigationModel }) { )} > - {current?.label ?? 'Administration'} + {current?.label ?? t('Administration')}
diff --git a/resources/scripts/themes/classic/views/server/console/prompts/GslTokenPrompt.tsx b/resources/scripts/themes/classic/views/server/console/prompts/GslTokenPrompt.tsx index 7f5003a76..9cb25a29e 100644 --- a/resources/scripts/themes/classic/views/server/console/prompts/GslTokenPrompt.tsx +++ b/resources/scripts/themes/classic/views/server/console/prompts/GslTokenPrompt.tsx @@ -1,7 +1,8 @@ -import { Dialog, Form, SpinnerOverlay, useAppForm } from '@/sdk'; +import { Dialog, Form, SpinnerOverlay, useAppForm, useTranslation } from '@/sdk'; import type { ViewProps } from '@/sdk/theme'; export default function GslTokenPrompt({ model }: ViewProps<'server.feature.gslToken'>) { + const { t } = useTranslation(); const form = useAppForm({ defaultValues: { gslToken: '' }, onSubmit: async ({ value }) => { @@ -13,24 +14,29 @@ export default function GslTokenPrompt({ model }: ViewProps<'server.feature.gslT return (
-

It seems like your Gameserver Login Token (GSL token) is invalid or has expired.

- You can either generate a new one and enter it below or leave the field blank to remove it - completely. + {t('It seems like your Gameserver Login Token (GSL token) is invalid or has expired.')} +

+

+ {t( + 'You can either generate a new one and enter it below or leave the field blank to remove it completely.' + )}

{(field) => ( )} @@ -39,7 +45,7 @@ export default function GslTokenPrompt({ model }: ViewProps<'server.feature.gslT
- Update GSL Token + {t('Update GSL Token')}
diff --git a/resources/scripts/themes/classic/views/server/console/prompts/HytaleOauthPrompt.tsx b/resources/scripts/themes/classic/views/server/console/prompts/HytaleOauthPrompt.tsx index a1d09062b..301c1cbea 100644 --- a/resources/scripts/themes/classic/views/server/console/prompts/HytaleOauthPrompt.tsx +++ b/resources/scripts/themes/classic/views/server/console/prompts/HytaleOauthPrompt.tsx @@ -1,20 +1,23 @@ -import { Button, Dialog } from '@/sdk'; +import { Button, Dialog, useTranslation } from '@/sdk'; import type { ViewProps } from '@/sdk/theme'; import { cancelClass } from './parts'; export default function HytaleOauthPrompt({ model }: ViewProps<'server.feature.hytaleOauth'>) { + const { t } = useTranslation(); + return ( - +

- You need to authenticate with your Hytale account to download or update server files. Please log in to - continue. + {t( + 'You need to authenticate with your Hytale account to download or update server files. Please log in to continue.' + )}

diff --git a/resources/scripts/themes/classic/views/server/console/prompts/JavaVersionPrompt.tsx b/resources/scripts/themes/classic/views/server/console/prompts/JavaVersionPrompt.tsx index e5ad9be9d..4905a0952 100644 --- a/resources/scripts/themes/classic/views/server/console/prompts/JavaVersionPrompt.tsx +++ b/resources/scripts/themes/classic/views/server/console/prompts/JavaVersionPrompt.tsx @@ -1,20 +1,25 @@ -import { Button, Dialog, InputSpinner, Select, SpinnerOverlay } from '@/sdk'; +import { Button, Dialog, InputSpinner, Select, SpinnerOverlay, useTranslation } from '@/sdk'; import type { ViewProps } from '@/sdk/theme'; export default function JavaVersionPrompt({ model }: ViewProps<'server.feature.javaVersion'>) { + const { t } = useTranslation(); + return (

- This server is currently running an unsupported version of Java and cannot be started. + {t('This server is currently running an unsupported version of Java and cannot be started.')} {model.canChangeImage && ( - <> Please select a supported version from the list below to continue starting the server. + <> + {'\u00a0'} + {t('Please select a supported version from the list below to continue starting the server.')} + )}

{model.canChangeImage && ( @@ -31,11 +36,11 @@ export default function JavaVersionPrompt({ model }: ViewProps<'server.feature.j )}
{model.canChangeImage && ( )}
diff --git a/resources/scripts/themes/classic/views/server/console/prompts/PidLimitPrompt.tsx b/resources/scripts/themes/classic/views/server/console/prompts/PidLimitPrompt.tsx index a6d42cb40..9a3d8dbbb 100644 --- a/resources/scripts/themes/classic/views/server/console/prompts/PidLimitPrompt.tsx +++ b/resources/scripts/themes/classic/views/server/console/prompts/PidLimitPrompt.tsx @@ -1,37 +1,42 @@ -import { Dialog } from '@/sdk'; +import { Dialog, Translate, useTranslation } from '@/sdk'; import type { ViewProps } from '@/sdk/theme'; import { Close, LimitIcon } from './parts'; +const pidLimitError = 'pthread_create failed, Possibly out of memory or process/resource limits reached'; + export default function PidLimitPrompt({ model }: ViewProps<'server.feature.pidLimit'>) { + const { t } = useTranslation(); + return ( {model.admin ? ( <> -

This server has reached the maximum process or memory limit.

+

{t('This server has reached the maximum process or memory limit.')}

- Increasing container_pid_limit in the wings - configuration, config.yml, might help resolve this - issue. + }} + />

- Note: Wings must be restarted for the configuration file changes to take effect + {t('Note: Wings must be restarted for the configuration file changes to take effect')}

) : ( <>

- This server is attempting to use more resources than allocated. Please contact the administrator - and give them the error below. + {t( + 'This server is attempting to use more resources than allocated. Please contact the administrator and give them the error below.' + )}

- - pthread_create failed, Possibly out of memory or process/resource limits reached - + {pidLimitError}

)} diff --git a/resources/scripts/themes/classic/views/server/console/prompts/SteamDiskSpacePrompt.tsx b/resources/scripts/themes/classic/views/server/console/prompts/SteamDiskSpacePrompt.tsx index 2b27b69ba..ba0ef156e 100644 --- a/resources/scripts/themes/classic/views/server/console/prompts/SteamDiskSpacePrompt.tsx +++ b/resources/scripts/themes/classic/views/server/console/prompts/SteamDiskSpacePrompt.tsx @@ -1,26 +1,32 @@ -import { Dialog } from '@/sdk'; +import { Dialog, Translate, useTranslation } from '@/sdk'; import type { ViewProps } from '@/sdk/theme'; import { Close } from './parts'; export default function SteamDiskSpacePrompt({ model }: ViewProps<'server.feature.steamDiskSpace'>) { + const { t } = useTranslation(); + return ( - + {model.admin ? ( <>

- This server has run out of available disk space and cannot complete the install or update - process. + {t( + 'This server has run out of available disk space and cannot complete the install or update process.' + )}

- Ensure the machine has enough disk space by typing{' '} - df -h on the machine hosting - this server. Delete files or increase the available disk space to resolve the issue. + }} + />

) : (

- This server has run out of available disk space and cannot complete the install or update process. - Please get in touch with the administrator(s) and inform them of disk space issues. + {t( + 'This server has run out of available disk space and cannot complete the install or update process. Please get in touch with the administrator(s) and inform them of disk space issues.' + )}

)} diff --git a/resources/scripts/themes/classic/views/server/console/prompts/parts.tsx b/resources/scripts/themes/classic/views/server/console/prompts/parts.tsx index 845492928..ffd7f3fb0 100644 --- a/resources/scripts/themes/classic/views/server/console/prompts/parts.tsx +++ b/resources/scripts/themes/classic/views/server/console/prompts/parts.tsx @@ -1,15 +1,19 @@ import { TriangleAlert } from 'lucide-react'; -import { Button, Icon } from '@/sdk'; +import { Button, Icon, useTranslation } from '@/sdk'; export const cancelClass = 'w-full sm:w-auto border-transparent'; -export const Close = ({ onClick }: { onClick: () => void }) => ( -
- -
-); +export const Close = ({ onClick }: { onClick: () => void }) => { + const { t } = useTranslation(); + + return ( +
+ +
+ ); +}; export const LimitIcon = () => (
diff --git a/resources/scripts/themes/classic/views/server/databases/Databases.tsx b/resources/scripts/themes/classic/views/server/databases/Databases.tsx index 80f31188f..27190603b 100644 --- a/resources/scripts/themes/classic/views/server/databases/Databases.tsx +++ b/resources/scripts/themes/classic/views/server/databases/Databases.tsx @@ -23,8 +23,11 @@ import { Spinner, SpinnerOverlay, Table, + Translate, useAppForm, + useTranslation, type TableColumn, + type Translation, } from '@/sdk'; import type { ServerDatabaseItem, ServerDatabasesModel, ViewProps } from '@/sdk/theme'; @@ -36,6 +39,7 @@ interface DatabaseDialogProps { } function CreateDatabaseDialog({ model, onClose }: { model: ServerDatabasesModel; onClose: () => void }) { + const { t } = useTranslation(); const form = useAppForm({ defaultValues: { databaseName: '', connectionsFrom: '' }, onSubmit: async ({ value }) => { @@ -53,7 +57,7 @@ function CreateDatabaseDialog({ model, onClose }: { model: ServerDatabasesModel; {(isSubmitting) => ( { @@ -71,8 +75,8 @@ function CreateDatabaseDialog({ model, onClose }: { model: ServerDatabasesModel; )} @@ -85,19 +89,21 @@ function CreateDatabaseDialog({ model, onClose }: { model: ServerDatabasesModel; )}
- Create Database + {t('Create Database')}
@@ -108,13 +114,18 @@ function CreateDatabaseDialog({ model, onClose }: { model: ServerDatabasesModel; ); } -const CreateDatabaseButton = ({ model }: { model: ServerDatabasesModel }) => ( - New database}> - {({ open, onClose }) => open && } - -); +function CreateDatabaseButton({ model }: { model: ServerDatabasesModel }) { + const { t } = useTranslation(); + + return ( + {t('New database')}}> + {({ open, onClose }) => open && } + + ); +} function DeleteDatabaseDialog({ model, database, open, onClose }: DatabaseDialogProps) { + const { t } = useTranslation(); const form = useAppForm({ defaultValues: { confirm: '' }, onSubmit: async () => { @@ -137,15 +148,18 @@ function DeleteDatabaseDialog({ model, database, open, onClose }: DatabaseDialog {(isSubmitting) => (

- Deleting a database is permanent. This will delete {database.name} and all - associated data. + }} + />

value === database.name || value === database.shortName ? undefined - : 'The database name must be provided.', + : t('The database name must be provided.'), }} > {(field) => ( )}
- Delete Database + {t('Delete Database')}
@@ -182,32 +196,34 @@ function DeleteDatabaseDialog({ model, database, open, onClose }: DatabaseDialog } function ConnectionDialog({ model, database, open, onClose }: DatabaseDialogProps) { + const { t } = useTranslation(); + return ( - +
- +
- +
- +
{model.permissions.viewPassword && (
- - + +
)}
- + @@ -221,11 +237,11 @@ function ConnectionDialog({ model, database, open, onClose }: DatabaseDialogProp onClick={() => void model.actions.rotatePassword(database.id).catch(() => {})} isLoading={model.rotating.includes(database.id)} > - Rotate Password + {t('Rotate Password')} )}
@@ -233,14 +249,16 @@ function ConnectionDialog({ model, database, open, onClose }: DatabaseDialogProp } function DatabaseActions({ model, database }: { model: ServerDatabasesModel; database: ServerDatabaseItem }) { + const { t } = useTranslation(); + return ( ( )} @@ -251,7 +269,9 @@ function DatabaseActions({ model, database }: { model: ServerDatabasesModel; dat {model.permissions.delete && ( } + trigger={({ onClick }) => ( + + )} > {({ open, onClose }) => ( @@ -262,11 +282,11 @@ function DatabaseActions({ model, database }: { model: ServerDatabasesModel; dat ); } -function databaseColumns(model: ServerDatabasesModel): TableColumn[] { +function databaseColumns(model: ServerDatabasesModel, t: Translation['t']): TableColumn[] { return [ { id: 'name', - label: 'Database', + label: t('Database'), sortValue: (database) => database.name, cell: (database) => ( @@ -276,7 +296,7 @@ function databaseColumns(model: ServerDatabasesModel): TableColumn database.endpoint, cell: (database) => ( @@ -288,7 +308,7 @@ function databaseColumns(model: ServerDatabasesModel): TableColumn database.connectionsFrom, cell: (database) => database.connectionsFrom, headerClassName: 'hidden lg:table-cell', @@ -296,7 +316,7 @@ function databaseColumns(model: ServerDatabasesModel): TableColumn database.username, cell: (database) => ( @@ -310,33 +330,41 @@ function databaseColumns(model: ServerDatabasesModel): TableColumn ( - - - - - - No databases - - {model.limit > 0 - ? "This server doesn't have any databases yet." - : "Databases can't be created because this server's database limit is 0."} - - - {model.canCreate && ( - - - - )} - -); +function EmptyState({ model }: { model: ServerDatabasesModel }) { + const { t } = useTranslation(); + + return ( + + + + + + {t('No databases')} + + {model.limit > 0 + ? t("This server doesn't have any databases yet.") + : t("Databases can't be created because this server's database limit is 0.")} + + + {model.canCreate && ( + + + + )} + + ); +} export default function Databases({ model, className }: ViewProps<'server.databases'>) { - const columns = useMemo(() => databaseColumns(model), [model]); + const { t } = useTranslation(); + const columns = useMemo(() => databaseColumns(model, t), [model, t]); const count = model.databases.length; const usage = model.permissions.create && model.limit > 0 && count > 0 - ? `${count} of ${model.limit} databases have been allocated to this server.` + ? t('{{allocated}} of {{limit}} databases have been allocated to this server.', { + allocated: count, + limit: model.limit, + }) : null; if (model.loading) { diff --git a/resources/scripts/themes/classic/views/server/databases/DatabasesPage.tsx b/resources/scripts/themes/classic/views/server/databases/DatabasesPage.tsx index ff0eb6b9e..04f3d2d09 100644 --- a/resources/scripts/themes/classic/views/server/databases/DatabasesPage.tsx +++ b/resources/scripts/themes/classic/views/server/databases/DatabasesPage.tsx @@ -1,11 +1,13 @@ -import { ServerContentBlock } from '@/sdk'; +import { ServerContentBlock, useTranslation } from '@/sdk'; import { View, type ViewProps } from '@/sdk/theme'; import PageStatus from '../../shared/PageStatus'; export default function DatabasesPage({ model, className }: ViewProps<'page.server.databases'>) { + const { t } = useTranslation(); + return ( - + diff --git a/resources/scripts/themes/classic/views/server/files/Breadcrumbs.tsx b/resources/scripts/themes/classic/views/server/files/Breadcrumbs.tsx index b205626dc..93991f61f 100644 --- a/resources/scripts/themes/classic/views/server/files/Breadcrumbs.tsx +++ b/resources/scripts/themes/classic/views/server/files/Breadcrumbs.tsx @@ -2,6 +2,8 @@ import { Fragment, type ReactNode } from 'react'; import { PanelLink } from '@/sdk'; import type { FileBreadcrumb } from '@/sdk/theme'; +const homeSegment = 'home'; + const linkClass = 'px-1 text-foreground no-underline transition-colors duration-150 hover:text-accent'; interface Props { @@ -15,7 +17,7 @@ interface Props { export default function Breadcrumbs({ crumbs, file, children }: Props) { return (
- {children ||
}/home/ + {children ||
}/{homeSegment}/ {crumbs.map(({ name, path, destination }) => destination ? ( diff --git a/resources/scripts/themes/classic/views/server/files/FileDetails.tsx b/resources/scripts/themes/classic/views/server/files/FileDetails.tsx index a5f564fe3..40a3a491e 100644 --- a/resources/scripts/themes/classic/views/server/files/FileDetails.tsx +++ b/resources/scripts/themes/classic/views/server/files/FileDetails.tsx @@ -19,7 +19,7 @@ export default function FileDetails({ className, model }: ViewProps<'server.file
{bytesToString(model.size)}
)}
- {Math.abs(hours) > 48 ? formatDate(model.modifiedAt, 'MMM Do, YYYY h:mmA') : fromNow(model.modifiedAt)} + {Math.abs(hours) > 48 ? formatDate(model.modifiedAt, 'lll') : fromNow(model.modifiedAt)}
); diff --git a/resources/scripts/themes/classic/views/server/files/FileDialogs.tsx b/resources/scripts/themes/classic/views/server/files/FileDialogs.tsx index f56366652..def50aeb1 100644 --- a/resources/scripts/themes/classic/views/server/files/FileDialogs.tsx +++ b/resources/scripts/themes/classic/views/server/files/FileDialogs.tsx @@ -1,4 +1,15 @@ -import { Button, cn, Code, Dialog, Form, NewButton, SpinnerOverlay, useAppForm } from '@/sdk'; +import { + Button, + cn, + Code, + Dialog, + Form, + NewButton, + SpinnerOverlay, + Translate, + useAppForm, + useTranslation, +} from '@/sdk'; import type { FileManagerModel } from '@/sdk/theme'; interface DialogProps { @@ -9,6 +20,7 @@ interface DialogProps { /** Renames one file, or moves files to a path relative to the current directory. */ export function RenameDialog({ model, files, move, ...props }: DialogProps & { files: string[]; move?: boolean }) { + const { t } = useTranslation(); const form = useAppForm({ defaultValues: { name: files.length > 1 ? '' : files[0] || '' }, onSubmit: async ({ value: { name } }) => { @@ -35,10 +47,12 @@ export function RenameDialog({ model, files, move, ...props }: DialogProps & { f
- {move ? 'Move' : 'Rename'} + + {move ? t('Move') : t('Rename')} +
@@ -56,8 +72,11 @@ export function RenameDialog({ model, files, move, ...props }: DialogProps & { f state.values.name}> {(name) => (

- New location: -  /home/container/{model.resolve(name)} + }} + />

)}
@@ -70,6 +89,7 @@ export function RenameDialog({ model, files, move, ...props }: DialogProps & { f } export function ChmodDialog({ model, files, ...props }: DialogProps & { files: { file: string; mode: string }[] }) { + const { t } = useTranslation(); const form = useAppForm({ defaultValues: { mode: files.length > 1 ? '' : files[0].mode || '' }, onSubmit: async ({ value: { mode } }) => { @@ -89,13 +109,18 @@ export function ChmodDialog({ model, files, ...props }: DialogProps & { files: {
{(field) => ( - + )}
- Update + {t('Update')}
@@ -107,6 +132,7 @@ export function ChmodDialog({ model, files, ...props }: DialogProps & { files: { } function NewDirectoryForm({ model, onClose }: { model: FileManagerModel; onClose: () => void }) { + const { t } = useTranslation(); const form = useAppForm({ defaultValues: { directoryName: '' }, onSubmit: async ({ value }) => { @@ -126,27 +152,34 @@ function NewDirectoryForm({ model, onClose }: { model: FileManagerModel; onClose name='directoryName' validators={{ onChange: ({ value }) => - value.length >= 1 ? undefined : 'A valid directory name must be provided.', + value.length >= 1 ? undefined : t('A valid directory name must be provided.'), }} > - {(field) => } + {(field) => }

- This directory will be created as  - - /home/container/ - state.values.directoryName}> - {(name) => {model.resolve(name)}} - - + , + path: ( + + /home/container/ + state.values.directoryName}> + {(name) => {model.resolve(name)}} + + + ), + }} + />

- Cancel + {t('Cancel')} @@ -154,10 +187,12 @@ function NewDirectoryForm({ model, onClose }: { model: FileManagerModel; onClose } export function NewDirectoryButton({ model }: { model: FileManagerModel }) { + const { t } = useTranslation(); + return ( - New folder}> + {t('New folder')}}> {({ open, onClose }) => ( - + )} diff --git a/resources/scripts/themes/classic/views/server/files/FileEditorActions.tsx b/resources/scripts/themes/classic/views/server/files/FileEditorActions.tsx index e6a90540f..384771321 100644 --- a/resources/scripts/themes/classic/views/server/files/FileEditorActions.tsx +++ b/resources/scripts/themes/classic/views/server/files/FileEditorActions.tsx @@ -1,7 +1,9 @@ -import { Button, cn } from '@/sdk'; +import { Button, cn, useTranslation } from '@/sdk'; import type { ViewProps } from '@/sdk/theme'; export default function FileEditorActions({ model, className }: ViewProps<'server.files.editor.actions'>) { + const { t } = useTranslation(); + return model.readOnly ? null : ( ); } diff --git a/resources/scripts/themes/classic/views/server/files/FileEditorNotice.tsx b/resources/scripts/themes/classic/views/server/files/FileEditorNotice.tsx index c139e207b..fe70ea130 100644 --- a/resources/scripts/themes/classic/views/server/files/FileEditorNotice.tsx +++ b/resources/scripts/themes/classic/views/server/files/FileEditorNotice.tsx @@ -1,4 +1,4 @@ -import { cn } from '@/sdk'; +import { cn, Translate } from '@/sdk'; import type { ViewProps } from '@/sdk/theme'; const codeClass = 'font-mono bg-muted rounded-sm py-px px-1'; @@ -7,11 +7,11 @@ export default function FileEditorNotice({ model, className }: ViewProps<'server return model.name.endsWith('.pteroignore') ? (

- You're editing a .pteroignore file. Any files or directories - listed in here will be excluded from backups. Wildcards are supported by using an asterisk ( - * - ). You can negate a prior rule by prepending an exclamation point (! - ). + }} + />

) : null; diff --git a/resources/scripts/themes/classic/views/server/files/FileManagerList.tsx b/resources/scripts/themes/classic/views/server/files/FileManagerList.tsx index 433e3cf83..9cacd508d 100644 --- a/resources/scripts/themes/classic/views/server/files/FileManagerList.tsx +++ b/resources/scripts/themes/classic/views/server/files/FileManagerList.tsx @@ -1,11 +1,13 @@ import { FolderOpen } from 'lucide-react'; -import { cn, Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, Spinner } from '@/sdk'; +import { cn, Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, Spinner, useTranslation } from '@/sdk'; import type { FileManagerEntry, ViewProps } from '@/sdk/theme'; import { FileRow, RowActionsProvider } from './FileRows'; const entryKey = ({ kind, name }: FileManagerEntry) => `${kind === 'directory' ? 'dir' : 'file'}_${name}`; export default function FileManagerList({ model, className }: ViewProps<'server.files.manager.list'>) { + const { t } = useTranslation(); + if (model.loading) { return ; } @@ -17,11 +19,11 @@ export default function FileManagerList({ model, className }: ViewProps<'server. - This folder is empty + {t('This folder is empty')} {model.permissions.create - ? 'Upload files or create a new file or folder to get started.' - : 'There are no files in this folder.'} + ? t('Upload files or create a new file or folder to get started.') + : t('There are no files in this folder.')} @@ -35,7 +37,9 @@ export default function FileManagerList({ model, className }: ViewProps<'server. {model.truncated && (

- This directory is too large to display in the browser, limiting output to first 250 files. + {t( + 'This directory is too large to display in the browser, limiting output to first 250 files.' + )}

)} diff --git a/resources/scripts/themes/classic/views/server/files/FileManagerSelection.tsx b/resources/scripts/themes/classic/views/server/files/FileManagerSelection.tsx index 7d0f44d94..7dd07189d 100644 --- a/resources/scripts/themes/classic/views/server/files/FileManagerSelection.tsx +++ b/resources/scripts/themes/classic/views/server/files/FileManagerSelection.tsx @@ -1,9 +1,10 @@ -import { Button, cn, Dialog, Portal, SpinnerOverlay } from '@/sdk'; +import { Button, cn, Dialog, Portal, SpinnerOverlay, Translate, useTranslation } from '@/sdk'; import { Slot, type FileManagerModel, type ViewProps } from '@/sdk/theme'; import { usePending } from '../usePending'; import { RenameDialog } from './FileDialogs'; function MassActions({ model, className }: { model: FileManagerModel; className?: string }) { + const { t } = useTranslation(); const [pending, run] = usePending(); const { selection, actions } = model; @@ -15,7 +16,7 @@ function MassActions({ model, className }: { model: FileManagerModel; className? {selection.length > 0 && (
- }> + }> {({ open, onClose }) => open && ( - + ( - Delete + {t('Delete')} )} onConfirmed={(_event, close) => { @@ -43,15 +44,19 @@ function MassActions({ model, className }: { model: FileManagerModel; className? }} >

- Are you sure you want to delete  - {selection.length} files? - This is a permanent action and the files cannot be recovered. + }} + />

    {selection.slice(0, 15).map((file) => (
  • {file}
  • ))} - {selection.length > 15 &&
  • and {selection.length - 15} others
  • } + {selection.length > 15 && ( +
  • {t('and {{number}} others', { number: selection.length - 15 })}
  • + )}
diff --git a/resources/scripts/themes/classic/views/server/files/FileManagerToolbar.tsx b/resources/scripts/themes/classic/views/server/files/FileManagerToolbar.tsx index e35089c95..470451f93 100644 --- a/resources/scripts/themes/classic/views/server/files/FileManagerToolbar.tsx +++ b/resources/scripts/themes/classic/views/server/files/FileManagerToolbar.tsx @@ -1,4 +1,4 @@ -import { Checkbox, cn, ErrorBoundary, NewButton, PanelLink } from '@/sdk'; +import { Checkbox, cn, ErrorBoundary, NewButton, PanelLink, useTranslation } from '@/sdk'; import { Slot, type ViewProps } from '@/sdk/theme'; import Breadcrumbs from './Breadcrumbs'; import { NewDirectoryButton } from './FileDialogs'; @@ -11,6 +11,7 @@ const managerActionsClass = [ ].join(' '); export default function FileManagerToolbar({ model, className }: ViewProps<'server.files.manager.toolbar'>) { + const { t } = useTranslation(); const { entries, selection } = model; return ( @@ -19,7 +20,7 @@ export default function FileManagerToolbar({ model, className }: ViewProps<'serv 0 && selection.length === entries.length} indeterminate={selection.length > 0 && selection.length < entries.length} onChange={(checked) => model.actions.select(checked ? entries.map((entry) => entry.name) : [])} @@ -31,7 +32,7 @@ export default function FileManagerToolbar({ model, className }: ViewProps<'serv {model.permissions.update && } - New file + {t('New file')}
)} diff --git a/resources/scripts/themes/classic/views/server/files/FileRows.tsx b/resources/scripts/themes/classic/views/server/files/FileRows.tsx index acc456f7c..326caf902 100644 --- a/resources/scripts/themes/classic/views/server/files/FileRows.tsx +++ b/resources/scripts/themes/classic/views/server/files/FileRows.tsx @@ -20,6 +20,8 @@ import { Icon, PanelLink, SpinnerOverlay, + Translate, + useTranslation, type FileManagerSlotData, } from '@/sdk'; import { Slot, View, type FileManagerEntry, type FileManagerModel } from '@/sdk/theme'; @@ -56,6 +58,7 @@ function useRowActions(): RowActions { /** Renders the row dialogs once for every row below it. */ export function RowActionsProvider({ model, children }: { model: FileManagerModel; children: ReactNode }) { + const { t } = useTranslation(); const [dialog, setDialog] = useState(null); const [target, setTarget] = useState(null); const [pending, run] = usePending(); @@ -94,15 +97,18 @@ export function RowActionsProvider({ model, children }: { model: FileManagerMode { close(); void actions.remove([name]).catch(() => {}); }} > - You will not be able to recover the contents of  - {name} once deleted. + }} + /> {target && dialog === 'chmod' && ( open('rename', entry)} icon={Pencil} - description='Change item name' + description={t('Change item name')} > - Rename + {t('Rename')} open('move', entry)} icon={CornerLeftUp} - description='Move to a path' + description={t('Move to a path')} > - Move + {t('Move')} - open('chmod', entry)} icon={FileCode} description='Edit mode bits'> - Permissions + open('chmod', entry)} + icon={FileCode} + description={t('Edit mode bits')} + > + {t('Permissions')} )} @@ -160,9 +171,9 @@ function ActionItems({ entry }: { entry: FileManagerEntry }) { run(actions.copy(entry.name))} icon={Copy} - description='Duplicate in place' + description={t('Duplicate in place')} > - Copy + {t('Copy')} )} {entry.extractable @@ -171,27 +182,27 @@ function ActionItems({ entry }: { entry: FileManagerEntry }) { run(actions.extract(entry.name))} icon={PackageOpen} - description='Extract contents' + description={t('Extract contents')} > - Unarchive + {t('Unarchive')} ) : permissions.archive && ( run(actions.archive([entry.name]))} icon={FileArchive} - description='Compress item' + description={t('Compress item')} > - Archive + {t('Archive')} )} {isFile && ( run(actions.download(entry.name))} icon={FileDown} - description='Save locally' + description={t('Save locally')} > - Download + {t('Download')} )} {permissions.delete && ( @@ -199,10 +210,10 @@ function ActionItems({ entry }: { entry: FileManagerEntry }) { onClick={() => open('delete', entry)} icon={Trash2} danger - description='Permanently remove' + description={t('Permanently remove')} className='mt-1 border-t border-border/70 pt-3' > - Delete + {t('Delete')} )} @@ -228,6 +239,7 @@ function Clickable({ entry, children }: { entry: FileManagerEntry; children: Rea } export const FileRow = memo(({ entry, selected }: { entry: FileManagerEntry; selected: boolean }) => { + const { t } = useTranslation(); const { toggle } = useRowActions(); const items = ( <> @@ -242,7 +254,7 @@ export const FileRow = memo(({ entry, selected }: { entry: FileManagerEntry; sel toggle(entry.name, checked)} /> @@ -256,7 +268,7 @@ export const FileRow = memo(({ entry, selected }: { entry: FileManagerEntry; sel triggerContent={ <> - Open file options + {t('Open file options')} } > diff --git a/resources/scripts/themes/classic/views/server/files/FilesPage.tsx b/resources/scripts/themes/classic/views/server/files/FilesPage.tsx index c1e36e9ae..1d4041300 100644 --- a/resources/scripts/themes/classic/views/server/files/FilesPage.tsx +++ b/resources/scripts/themes/classic/views/server/files/FilesPage.tsx @@ -1,12 +1,14 @@ -import { ServerContentBlock } from '@/sdk'; +import { ServerContentBlock, useTranslation } from '@/sdk'; import { Slot, View, type ViewProps } from '@/sdk/theme'; import PageStatus from '../../shared/PageStatus'; export default function FilesPage({ model, className }: ViewProps<'page.server.files'>) { + const { t } = useTranslation(); + // The file manager keeps its toolbar up and shows its own spinner while each directory lists. return ( - + diff --git a/resources/scripts/themes/classic/views/server/files/Uploads.tsx b/resources/scripts/themes/classic/views/server/files/Uploads.tsx index dc4d3adc1..538b55329 100644 --- a/resources/scripts/themes/classic/views/server/files/Uploads.tsx +++ b/resources/scripts/themes/classic/views/server/files/Uploads.tsx @@ -1,6 +1,6 @@ import { useEffect, useRef, useState } from 'react'; import { CloudUpload, X } from 'lucide-react'; -import { Button, Code, Dialog, NewButton, Portal, Tooltip } from '@/sdk'; +import { Button, Code, Dialog, NewButton, Portal, Tooltip, useTranslation } from '@/sdk'; import type { FileManagerModel, UploadSource } from '@/sdk/theme'; const isFileOrDirectory = (event: DragEvent): boolean => @@ -36,6 +36,7 @@ function useDropOverlay(): [boolean, (open: boolean) => void] { } export function UploadButton({ model }: { model: FileManagerModel }) { + const { t } = useTranslation(); const input = useRef(null); const [dropping, setDropping] = useDropOverlay(); // Failures have already been reported with error toasts. @@ -60,7 +61,7 @@ export function UploadButton({ model }: { model: FileManagerModel }) {

- Drag and drop files to upload. + {t('Drag and drop files to upload.')}

@@ -71,7 +72,7 @@ export function UploadButton({ model }: { model: FileManagerModel }) { type='file' ref={input} className='hidden' - aria-label='Upload files' + aria-label={t('Upload files')} onChange={(event) => { if (!event.currentTarget.files) { return; @@ -83,7 +84,7 @@ export function UploadButton({ model }: { model: FileManagerModel }) { multiple /> input.current?.click()}> - Upload + {t('Upload')} ); @@ -107,6 +108,8 @@ const Progress = ({ progress, className }: { progress: number; className?: strin const percent = (loaded: number, total: number) => (total > 0 ? (loaded / total) * 100 : 0); function UploadList({ model, onClose }: { model: FileManagerModel; onClose: () => void }) { + const { t } = useTranslation(); + return (
{model.uploads.map((file) => ( @@ -119,7 +122,7 @@ function UploadList({ model, onClose }: { model: FileManagerModel; onClose: () = {file.name}
); } export function UploadStatus({ model }: { model: FileManagerModel }) { + const { t } = useTranslation(); const count = model.uploads.length; if (count === 0) { @@ -150,7 +154,7 @@ export function UploadStatus({ model }: { model: FileManagerModel }) { return ( ( - +