1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
// SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com>
// SPDX-License-Identifier: AGPL-3.0-or-later WITH AdditionRef-Progmasoft-Patent-Grant-1.1
import type { Locale } from "./locales";
export type PublicRoute = "/" | "/docs/overview" | "/docs/getting-started";
type PageMetadata = {
title: string;
description: string;
};
const metadata: Record<Locale, Record<PublicRoute, PageMetadata>> = {
"en-US": {
"/": {
title: "Visual X# — Make the whole program understandable",
description:
"Meet Visual X#: a native programming language built around readable source, explicit ownership, and an inspectable compiler pipeline.",
},
"/docs/overview": {
title: "Overview · Visual X#",
description:
"Understand Visual X# design goals, type and ownership choices, compiler stages, and the boundary between specification and implementation.",
},
"/docs/getting-started": {
title: "Getting started · Visual X#",
description:
"Clone Visual X#, check the toolchain, build and test the compiler, and inspect the first program with the current CLI.",
},
},
"de-DE": {
"/": {
title: "Visual X# — Das ganze Programm verstehen",
description:
"Visual X# ist eine native Programmiersprache mit lesbarem Quellcode, explizitem Ownership und nachvollziehbarer Compiler-Pipeline.",
},
"/docs/overview": {
title: "Überblick · Visual X#",
description:
"Entwurfsziele, Typ- und Ownership-Regeln, Compilerstufen sowie die Grenze zwischen Spezifikation und Implementierung verstehen.",
},
"/docs/getting-started": {
title: "Erste Schritte · Visual X#",
description:
"Visual X# klonen, Toolchain prüfen, Compiler bauen und testen und das erste Programm mit der aktuellen CLI untersuchen.",
},
},
"ru-RU": {
"/": {
title: "Visual X# — Сделать понятной всю программу",
description:
"Visual X# — нативный язык программирования с читаемым исходным кодом, явным владением и прозрачным конвейером компилятора.",
},
"/docs/overview": {
title: "Обзор · Visual X#",
description:
"Цели проектирования Visual X#, правила типов и владения, стадии компилятора и граница между спецификацией и реализацией.",
},
"/docs/getting-started": {
title: "Начало работы · Visual X#",
description:
"Клонируйте Visual X#, проверьте набор инструментов, соберите и протестируйте компилятор и изучите первую программу с текущим CLI.",
},
},
"he-IL": {
"/": {
title: "Visual X# — להפוך את התוכנית כולה למובנת",
description:
"הכירו את Visual X#: שפת תכנות שמהודרת לקוד מכונה והבנויה סביב קוד מקור קריא, בעלות מפורשת ותהליך הידור שאפשר לבחון.",
},
"/docs/overview": {
title: "סקירה · Visual X#",
description:
"יעדי התכנון של Visual X#, בחירות הטיפוסים והבעלות, שלבי המהדר והגבול בין המפרט למימוש.",
},
"/docs/getting-started": {
title: "צעדים ראשונים · Visual X#",
description:
"שכפלו את Visual X#, בדקו את שרשרת הכלים, בנו ובדקו את המהדר ובחנו את התוכנית הראשונה עם ה-CLI הנוכחי.",
},
},
};
function setMeta(selector: string, content: string): void {
const element = document.querySelector<HTMLMetaElement>(selector);
if (element) element.content = content;
}
export function applyPageMetadata(path: string, locale: Locale): void {
// Unknown routes are redirected by the router. Their brief transitional state
// must not generate a canonical URL to an unlisted public page.
const canonicalPath: PublicRoute =
path === "/docs/overview" || path === "/docs/getting-started" ? path : "/";
const page = metadata[locale][canonicalPath];
document.title = page.title;
setMeta('meta[name="description"]', page.description);
setMeta('meta[property="og:title"]', page.title);
setMeta('meta[property="og:description"]', page.description);
setMeta('meta[property="og:url"]', `https://xsharp-lang.xyz${canonicalPath}`);
const canonical = document.querySelector<HTMLLinkElement>('link[rel="canonical"]');
if (canonical) canonical.href = `https://xsharp-lang.xyz${canonicalPath}`;
}
|