From 2c571233bc22254ee0b364af9ca0c55446a5c090 Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Sat, 1 Aug 2026 23:06:22 +0200 Subject: [PATCH] Renamed the Error page in the Website library target as NotFound. --- .../Library/Catalogs/Localizable.xcstrings | 66 +++++++++---------- .../{ErrorPage.swift => NotFoundPage.swift} | 14 ++-- .../NotFoundMiddleware+Defaults.swift | 2 +- ...ageTests.swift => NotFoundPageTests.swift} | 6 +- 4 files changed, 44 insertions(+), 44 deletions(-) rename Services/Website/Sources/Library/Internal/Pages/{ErrorPage.swift => NotFoundPage.swift} (80%) rename Services/Website/Tests/Library/Cases/Internal/Pages/{ErrorPageTests.swift => NotFoundPageTests.swift} (89%) diff --git a/Services/Website/Sources/Library/Catalogs/Localizable.xcstrings b/Services/Website/Sources/Library/Catalogs/Localizable.xcstrings index 9a6ccec..729eda6 100644 --- a/Services/Website/Sources/Library/Catalogs/Localizable.xcstrings +++ b/Services/Website/Sources/Library/Catalogs/Localizable.xcstrings @@ -1,39 +1,6 @@ { "sourceLanguage" : "en", "strings" : { - "error.heading" : { - "comment" : "The not-found page's main heading.", - "localizations" : { - "en" : { - "stringUnit" : { - "state" : "translated", - "value" : "Page Not Found" - } - } - } - }, - "error.message" : { - "comment" : "The not-found page's body text.", - "localizations" : { - "en" : { - "stringUnit" : { - "state" : "translated", - "value" : "Sorry, but the page you were trying to view does not exist." - } - } - } - }, - "error.title" : { - "comment" : "The not-found page's document title.", - "localizations" : { - "en" : { - "stringUnit" : { - "state" : "translated", - "value" : "Page Not Found" - } - } - } - }, "index.greeting" : { "comment" : "The landing page's greeting paragraph.", "localizations" : { @@ -55,6 +22,39 @@ } } } + }, + "notFound.heading" : { + "comment" : "The not-found page's main heading.", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Page Not Found" + } + } + } + }, + "notFound.message" : { + "comment" : "The not-found page's body text.", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Sorry, but the page you were trying to view does not exist." + } + } + } + }, + "notFound.title" : { + "comment" : "The not-found page's document title.", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Page Not Found" + } + } + } } }, "version" : "1.0" diff --git a/Services/Website/Sources/Library/Internal/Pages/ErrorPage.swift b/Services/Website/Sources/Library/Internal/Pages/NotFoundPage.swift similarity index 80% rename from Services/Website/Sources/Library/Internal/Pages/ErrorPage.swift rename to Services/Website/Sources/Library/Internal/Pages/NotFoundPage.swift index 2b19f7b..f49730c 100644 --- a/Services/Website/Sources/Library/Internal/Pages/ErrorPage.swift +++ b/Services/Website/Sources/Library/Internal/Pages/NotFoundPage.swift @@ -4,7 +4,7 @@ import Infrastructure import Localization /// The HTML page rendered for a not-found response, with its text localized to a given locale. -struct ErrorPage { +struct NotFoundPage { // MARK: Properties @@ -36,29 +36,29 @@ struct ErrorPage { // MARK: Page -extension ErrorPage: Page { +extension NotFoundPage: Page { // MARK: Properties var content: some HTML { h1 { - localize("error.heading", locale: locale) + localize("notFound.heading", locale: locale) } p { - localize("error.message", locale: locale) + localize("notFound.message", locale: locale) } } var scripts: [any Asset] { - [StaticFile.error, StaticFile.shared] + [StaticFile.notFound, StaticFile.shared] } var stylesheets: [any Asset] { - [StaticFile.shared, StaticFile.error] + [StaticFile.shared, StaticFile.notFound] } var title: String { - localize("error.title", locale: locale) + localize("notFound.title", locale: locale) } } diff --git a/Services/Website/Sources/Library/Public/Extensions/NotFoundMiddleware+Defaults.swift b/Services/Website/Sources/Library/Public/Extensions/NotFoundMiddleware+Defaults.swift index 545dd1f..5c850f9 100644 --- a/Services/Website/Sources/Library/Public/Extensions/NotFoundMiddleware+Defaults.swift +++ b/Services/Website/Sources/Library/Public/Extensions/NotFoundMiddleware+Defaults.swift @@ -11,7 +11,7 @@ public extension NotFoundMiddleware { assetVersion: String? = nil ) { self.init(bundle: .module) { - ErrorPage( + NotFoundPage( locale: $0, assetVersion: assetVersion ) diff --git a/Services/Website/Tests/Library/Cases/Internal/Pages/ErrorPageTests.swift b/Services/Website/Tests/Library/Cases/Internal/Pages/NotFoundPageTests.swift similarity index 89% rename from Services/Website/Tests/Library/Cases/Internal/Pages/ErrorPageTests.swift rename to Services/Website/Tests/Library/Cases/Internal/Pages/NotFoundPageTests.swift index 4a2771c..d29b2d0 100644 --- a/Services/Website/Tests/Library/Cases/Internal/Pages/ErrorPageTests.swift +++ b/Services/Website/Tests/Library/Cases/Internal/Pages/NotFoundPageTests.swift @@ -5,16 +5,16 @@ import Testing @testable import WebsiteLibrary @Suite( - "ErrorPage page", + "NotFoundPage page", .tags(.page) ) -struct ErrorPageTests { +struct NotFoundPageTests { // MARK: Functional tests @Test func `renders its markup`() { - let html = ErrorPage( + let html = NotFoundPage( locale: .init(identifier: "en") ).render()