Project updates from Template #1
@@ -1,39 +1,6 @@
|
|||||||
{
|
{
|
||||||
"sourceLanguage" : "en",
|
"sourceLanguage" : "en",
|
||||||
"strings" : {
|
"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" : {
|
"index.greeting" : {
|
||||||
"comment" : "The landing page's greeting paragraph.",
|
"comment" : "The landing page's greeting paragraph.",
|
||||||
"localizations" : {
|
"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"
|
"version" : "1.0"
|
||||||
|
|||||||
+7
-7
@@ -4,7 +4,7 @@ import Infrastructure
|
|||||||
import Localization
|
import Localization
|
||||||
|
|
||||||
/// The HTML page rendered for a not-found response, with its text localized to a given locale.
|
/// The HTML page rendered for a not-found response, with its text localized to a given locale.
|
||||||
struct ErrorPage {
|
struct NotFoundPage {
|
||||||
|
|
||||||
// MARK: Properties
|
// MARK: Properties
|
||||||
|
|
||||||
@@ -36,29 +36,29 @@ struct ErrorPage {
|
|||||||
|
|
||||||
// MARK: Page
|
// MARK: Page
|
||||||
|
|
||||||
extension ErrorPage: Page {
|
extension NotFoundPage: Page {
|
||||||
|
|
||||||
// MARK: Properties
|
// MARK: Properties
|
||||||
|
|
||||||
var content: some HTML {
|
var content: some HTML {
|
||||||
h1 {
|
h1 {
|
||||||
localize("error.heading", locale: locale)
|
localize("notFound.heading", locale: locale)
|
||||||
}
|
}
|
||||||
p {
|
p {
|
||||||
localize("error.message", locale: locale)
|
localize("notFound.message", locale: locale)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var scripts: [any Asset] {
|
var scripts: [any Asset] {
|
||||||
[StaticFile.error, StaticFile.shared]
|
[StaticFile.notFound, StaticFile.shared]
|
||||||
}
|
}
|
||||||
|
|
||||||
var stylesheets: [any Asset] {
|
var stylesheets: [any Asset] {
|
||||||
[StaticFile.shared, StaticFile.error]
|
[StaticFile.shared, StaticFile.notFound]
|
||||||
}
|
}
|
||||||
|
|
||||||
var title: String {
|
var title: String {
|
||||||
localize("error.title", locale: locale)
|
localize("notFound.title", locale: locale)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+1
-1
@@ -11,7 +11,7 @@ public extension NotFoundMiddleware {
|
|||||||
assetVersion: String? = nil
|
assetVersion: String? = nil
|
||||||
) {
|
) {
|
||||||
self.init(bundle: .module) {
|
self.init(bundle: .module) {
|
||||||
ErrorPage(
|
NotFoundPage(
|
||||||
locale: $0,
|
locale: $0,
|
||||||
assetVersion: assetVersion
|
assetVersion: assetVersion
|
||||||
)
|
)
|
||||||
|
|||||||
+3
-3
@@ -5,16 +5,16 @@ import Testing
|
|||||||
@testable import WebsiteLibrary
|
@testable import WebsiteLibrary
|
||||||
|
|
||||||
@Suite(
|
@Suite(
|
||||||
"ErrorPage page",
|
"NotFoundPage page",
|
||||||
.tags(.page)
|
.tags(.page)
|
||||||
)
|
)
|
||||||
struct ErrorPageTests {
|
struct NotFoundPageTests {
|
||||||
|
|
||||||
// MARK: Functional tests
|
// MARK: Functional tests
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
func `renders its markup`() {
|
func `renders its markup`() {
|
||||||
let html = ErrorPage(
|
let html = NotFoundPage(
|
||||||
locale: .init(identifier: "en")
|
locale: .init(identifier: "en")
|
||||||
).render()
|
).render()
|
||||||
|
|
||||||
Reference in New Issue
Block a user