R05
Error
Routes
R05 — A translation of no page, or two in one language
translates: names the page this one is a translation of, and the pages it joins list each other as hreflang alternates, each in its own lang:. A name no page has joins nothing, and two pages in one language would be two alternates for one hreflang.
What the compiler said
error[R05]: `HomeAr` translates `Hom`, and no page is named `Hom` --> src/App.wf:5:1 | 5 | page HomeAr(path: "/ar", title: "Home", description: "D", lang: "ar", translates: Hom) { | ^^^^ = help: Did you mean `Home`? = docs: https://webfluent.monzeromer.dev/errors/R05
The fix
Broken
page Home(path: "/", title: "Home", description: "D") {
Heading("Home").h1
}
page HomeAr(path: "/ar", title: "Home", description: "D", lang: "ar", translates: Hom) {
Heading("Home").h1
}
Fixed
page Home(path: "/", title: "Home", description: "D") {
Heading("Home").h1
}
page HomeAr(path: "/ar", title: "Home", description: "D", lang: "ar", translates: Home) {
Heading("Home").h1
}
name a page the program declares, and give each translation the lang: it
is written in.
Each example is a whole program: it is all of src/App.wf in a project with no other .wf file (trying an example).
Why this rule exists
Error.
translates: names the page this one is a translation of, and the pages
it joins list each other as hreflang alternates, each in its own lang:.
Two pages of one group in the same language — or both with no lang:, so
both in the site's — would be two alternates for one language.
lints cannot lower it: it would ship a broken page.