feat: German as the main language, English under /en, with a language switch
The site now exists in German (at the root, with /impressum and /datenschutz) and English (/en). A request without a language follows the visitor's choice from the language switch, then the browser language, then German; the old English legal addresses move to /en for good. All visible texts are data in src/content/de.ts and en.ts, so components hold none of their own. The header carries a DE/EN switch whose bit curtain covers the page while it is swapped and reopens at the same reading position. Title, description, canonical, hreflang, Open Graph, the share image, the sitemap and the structured data are per language. The privacy notice now describes the cookie that remembers the chosen language. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Texts with named blanks, such as "{name} on a phone". The page texts are plain
|
||||
* data in two languages, so a sentence with a variable part keeps a blank for it.
|
||||
*/
|
||||
export type TemplateValues = Readonly<Record<string, string | number>>;
|
||||
|
||||
const BLANK = /\{(\w+)\}/g;
|
||||
|
||||
export function fill(template: string, values: TemplateValues): string {
|
||||
return template.replace(BLANK, (blank, name: string) =>
|
||||
Object.hasOwn(values, name) ? String(values[name]) : blank,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user