Renamed the Error page in the Website library target as NotFound.

This commit is contained in:
2026-08-01 23:06:22 +02:00
parent b680ae0689
commit 2c571233bc
4 changed files with 44 additions and 44 deletions
@@ -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"
@@ -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)
}
}
@@ -11,7 +11,7 @@ public extension NotFoundMiddleware {
assetVersion: String? = nil
) {
self.init(bundle: .module) {
ErrorPage(
NotFoundPage(
locale: $0,
assetVersion: assetVersion
)
@@ -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()