Skip to content

Commit ad98478

Browse files
committed
feat: remove translation based path
1 parent 2e1634e commit ad98478

File tree

12 files changed

+326
-173
lines changed

12 files changed

+326
-173
lines changed

apps/blog/src/pages/index.astro

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,15 @@ const fallback = supportedLocales.includes('en') ? 'en' : supportedLocales[0]
1515
<title>Redirecting…</title>
1616
<meta http-equiv="refresh" content={`0;url=/${fallback}`} />
1717
<script define:vars={{ supportedLocales, fallback }}>
18+
function getCookie(name) {
19+
const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'))
20+
return match ? match[1] : null
21+
}
22+
const cookieLocale = getCookie('locale')
1823
const browserLang = (navigator.language || '').split('-')[0]
19-
const locale = supportedLocales.includes(browserLang) ? browserLang : fallback
24+
const locale = (cookieLocale && supportedLocales.includes(cookieLocale))
25+
? cookieLocale
26+
: supportedLocales.includes(browserLang) ? browserLang : fallback
2027
window.location.replace('/' + locale)
2128
</script>
2229
</head>

apps/website/src/components/cta-section.astro

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
---
22
import { Icon } from "@iconify/react";
33
import { Button } from "@explainer/ui";
4-
5-
const title = "Ready to get started?";
6-
const description =
7-
"Start building your documentation in minutes. Free, open source, and yours to customize.";
8-
9-
const action = {
10-
label: "Read the docs",
11-
href: "/docs/documentation/getting-started/getting-started",
12-
};
134
---
145

156
<div class="w-full max-w-6xl mx-auto px-5 py-16 sm:py-24 lg:py-32">
@@ -35,20 +26,20 @@ const action = {
3526
<div class="absolute top-8 right-1/4 size-2.5 rounded-full bg-primary/10">
3627
</div>
3728
<div
38-
class="absolute bottom-10 left-[30%] size-2 rounded-full bg-primary/[0.08]"
29+
class="absolute bottom-10 left-[30%] size-2 rounded-full bg-primary/8"
3930
>
4031
</div>
4132
</div>
42-
<h2 class="text-3xl font-semibold text-foreground sm:text-4xl">
43-
{title}
33+
<h2 class="text-3xl font-semibold text-foreground sm:text-4xl" data-t="cta.title">
34+
Ready to get started?
4435
</h2>
45-
<p class="mt-4 text-lg text-muted-foreground max-w-xl mx-auto text-balance">
46-
{description}
36+
<p class="mt-4 text-lg text-muted-foreground max-w-xl mx-auto text-balance" data-t="cta.description">
37+
Start building your documentation in minutes. Free, open source, and yours to customize.
4738
</p>
4839
<div class="mt-8 flex justify-center">
4940
<Button size="lg" className="cursor-pointer" client:load>
50-
<a href={action.href} class="flex gap-2" rel="noopener noreferrer">
51-
{action.label}
41+
<a href="/docs/documentation/getting-started/getting-started" class="flex gap-2" rel="noopener noreferrer">
42+
<span data-t="cta.action">Read the docs</span>
5243
<Icon
5344
icon="mdi:arrow-right"
5445
aria-hidden="true"

apps/website/src/components/features-section.astro

Lines changed: 13 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,13 @@
11
---
22
import { Icon } from "@iconify/react";
33
4-
const title = "Everything you need, out of the box";
5-
const description = "Explainer gives you the tools to focus on your content, not your tooling.";
6-
74
const features = [
8-
{
9-
icon: "mdi:language-markdown",
10-
title: "Markdown & MDX",
11-
description:
12-
"Write content in Markdown or MDX with custom components, directives, and JSX support.",
13-
},
14-
{
15-
icon: "mdi:flash-outline",
16-
title: "Lightning fast",
17-
description:
18-
"Static site generation for instant page loads. Zero JavaScript shipped by default.",
19-
},
20-
{
21-
icon: "mdi:code-braces",
22-
title: "Rich code blocks",
23-
description:
24-
"Dual-theme syntax highlighting, line diffs, focus mode, and 60+ language icons.",
25-
},
26-
{
27-
icon: "mdi:magnify",
28-
title: "Built-in search",
29-
description:
30-
"Command palette search so your readers find any page instantly.",
31-
},
32-
{
33-
icon: "mdi:search-web",
34-
title: "SEO ready",
35-
description:
36-
"Auto-generated OG thumbnails, sitemap, robots.txt, and RSS feed.",
37-
},
38-
{
39-
icon: "mdi:theme-light-dark",
40-
title: "Dark mode",
41-
description:
42-
"Full light and dark theme support with system preference detection.",
43-
},
5+
{ icon: "mdi:language-markdown", titleKey: "features.markdown.title", descKey: "features.markdown.description", title: "Markdown & MDX", description: "Write content in Markdown or MDX with custom components, directives, and JSX support." },
6+
{ icon: "mdi:flash-outline", titleKey: "features.fast.title", descKey: "features.fast.description", title: "Lightning fast", description: "Static site generation for instant page loads. Zero JavaScript shipped by default." },
7+
{ icon: "mdi:code-braces", titleKey: "features.code.title", descKey: "features.code.description", title: "Rich code blocks", description: "Dual-theme syntax highlighting, line diffs, focus mode, and 60+ language icons." },
8+
{ icon: "mdi:magnify", titleKey: "features.search.title", descKey: "features.search.description", title: "Built-in search", description: "Command palette search so your readers find any page instantly." },
9+
{ icon: "mdi:search-web", titleKey: "features.seo.title", descKey: "features.seo.description", title: "SEO ready", description: "Auto-generated OG thumbnails, sitemap, robots.txt, and RSS feed." },
10+
{ icon: "mdi:theme-light-dark", titleKey: "features.darkMode.title", descKey: "features.darkMode.description", title: "Dark mode", description: "Full light and dark theme support with system preference detection." },
4411
];
4512
---
4613

@@ -76,16 +43,18 @@ const features = [
7643
<div class="text-center mb-16">
7744
<p
7845
class="text-sm font-semibold text-primary uppercase tracking-wide mb-3"
46+
data-t="features.label"
7947
>
8048
Features
8149
</p>
82-
<h2 class="text-3xl font-semibold text-foreground sm:text-4xl">
83-
{title}
50+
<h2 class="text-3xl font-semibold text-foreground sm:text-4xl" data-t="features.title">
51+
Everything you need, out of the box
8452
</h2>
8553
<p
8654
class="mt-4 text-lg text-muted-foreground max-w-2xl mx-auto text-balance"
55+
data-t="features.description"
8756
>
88-
{description}
57+
Explainer gives you the tools to focus on your content, not your tooling.
8958
</p>
9059
</div>
9160

@@ -102,10 +71,10 @@ const features = [
10271
/>
10372
</div>
10473
<div>
105-
<h3 class="text-base font-semibold text-foreground">
74+
<h3 class="text-base font-semibold text-foreground" data-t={feature.titleKey}>
10675
{feature.title}
10776
</h3>
108-
<p class="text-sm text-muted-foreground mt-1.5 leading-relaxed">
77+
<p class="text-sm text-muted-foreground mt-1.5 leading-relaxed" data-t={feature.descKey}>
10978
{feature.description}
11079
</p>
11180
</div>

apps/website/src/components/hero-section.astro

Lines changed: 22 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,6 @@
22
import { BackgroundAnimation } from "./background-animation";
33
import { Icon } from "@iconify/react";
44
import { Button } from "@explainer/ui";
5-
6-
const badge = "Explainer";
7-
const title = "Explain your ideas";
8-
const description =
9-
"Quickly design your documentation and optimise it for search engine optimisation to showcase your products.";
10-
11-
const primaryAction = {
12-
label: "Getting Started",
13-
href: "/docs/framework/getting-started/getting-started",
14-
};
15-
const secondaryAction = {
16-
label: "View on GitHub",
17-
href: "https://github.com/explainer/explainer",
18-
icon: "mdi:github",
19-
};
20-
21-
const socialProof = [
22-
{ icon: "mdi:open-source-initiative", text: "Open source" },
23-
{ icon: "mdi:license", text: "MIT License" },
24-
{ icon: "mdi:download-outline", text: "1k+ downloads" },
25-
];
265
---
276

287
<div
@@ -103,31 +82,33 @@ const socialProof = [
10382
rel="noopener noreferrer"
10483
class="rounded-full font-semibold inline-flex items-center gap-2 transition-colors px-4 py-1.5 text-xs ring ring-inset ring-primary/50 text-primary hover:bg-primary/10 active:bg-primary/10 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary"
10584
>
106-
<span>{badge}</span>
85+
<span data-t="hero.badge">Explainer</span>
10786
<Icon icon="mdi:arrow-right" className="size-3.5" client:load />
10887
</a>
10988
</div>
11089
<h1
11190
class="text-5xl text-pretty tracking-tight text-foreground font-semibold sm:text-7xl max-w-6xl mx-auto"
91+
data-t="hero.title"
11292
>
113-
{title}
93+
Explain your ideas
11494
</h1>
11595
<p
11696
class="text-lg sm:text-xl/8 text-muted-foreground text-balance mt-6 max-w-2xl mx-auto"
97+
data-t="hero.description"
11798
>
118-
{description}
99+
Quickly design your documentation and optimise it for search engine optimisation to showcase your products.
119100
</p>
120101
</div>
121102

122103
<div class="pt-10 flex items-center justify-center">
123104
<div class="flex flex-wrap gap-x-4 gap-y-3">
124105
<Button size="lg" className="cursor-pointer" client:load>
125106
<a
126-
href={primaryAction.href}
107+
href="/docs/framework/getting-started/getting-started"
127108
class="flex gap-2"
128109
rel="noopener noreferrer"
129110
>
130-
{primaryAction.label}
111+
<span data-t="hero.primaryAction">Getting Started</span>
131112
<Icon
132113
icon="mdi:arrow-right"
133114
aria-hidden="true"
@@ -143,18 +124,18 @@ const socialProof = [
143124
client:load
144125
>
145126
<a
146-
href={secondaryAction.href}
127+
href="https://github.com/explainer/explainer"
147128
class="flex gap-2"
148129
target="_blank"
149130
rel="noopener noreferrer"
150131
>
151132
<Icon
152-
icon={secondaryAction.icon}
133+
icon="mdi:github"
153134
aria-hidden="true"
154135
className="size-5"
155136
client:load
156137
/>
157-
{secondaryAction.label}
138+
<span data-t="hero.secondaryAction">View on GitHub</span>
158139
</a>
159140
</Button>
160141
</div>
@@ -163,18 +144,18 @@ const socialProof = [
163144
<div
164145
class="mt-10 flex items-center justify-center gap-x-8 gap-y-3 flex-wrap"
165146
>
166-
{
167-
socialProof.map((item) => (
168-
<div class="flex items-center gap-2 text-sm text-muted-foreground">
169-
<Icon
170-
icon={item.icon}
171-
className="size-4 text-primary/70"
172-
client:load
173-
/>
174-
<span>{item.text}</span>
175-
</div>
176-
))
177-
}
147+
<div class="flex items-center gap-2 text-sm text-muted-foreground">
148+
<Icon icon="mdi:open-source-initiative" className="size-4 text-primary/70" client:load />
149+
<span data-t="hero.openSource">Open source</span>
150+
</div>
151+
<div class="flex items-center gap-2 text-sm text-muted-foreground">
152+
<Icon icon="mdi:license" className="size-4 text-primary/70" client:load />
153+
<span data-t="hero.license">MIT License</span>
154+
</div>
155+
<div class="flex items-center gap-2 text-sm text-muted-foreground">
156+
<Icon icon="mdi:download-outline" className="size-4 text-primary/70" client:load />
157+
<span data-t="hero.downloads">1k+ downloads</span>
158+
</div>
178159
</div>
179160
</div>
180161
</div>

apps/website/src/components/highlights-section.astro

Lines changed: 14 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,11 @@
11
---
22
import { Icon } from "@iconify/react";
33
4-
const title = "Why Explainer?";
5-
const description =
6-
"Built for developers who care about their users' experience.";
7-
84
const highlights = [
9-
{
10-
icon: "mdi:rocket-launch",
11-
title: "Ship docs in minutes, not days",
12-
description:
13-
"Clone the repo, write your Markdown, deploy. No complex setup, no build pipeline to configure. Your documentation is live before your coffee gets cold.",
14-
span: 4,
15-
},
16-
{
17-
icon: "mdi:palette-swatch-variant",
18-
title: "Your brand, your way",
19-
description:
20-
"Tailwind CSS design tokens let you match your documentation to your product identity with a few CSS variable changes.",
21-
span: 2,
22-
},
23-
{
24-
icon: "mdi:puzzle-outline",
25-
title: "Extensible by design",
26-
description:
27-
"Drop in React, Vue, or Svelte components directly in your Markdown. Build interactive examples, live demos, and API playgrounds.",
28-
span: 2,
29-
},
30-
{
31-
icon: "mdi:chart-line",
32-
title: "Built for growth",
33-
description:
34-
"From a single getting-started guide to hundreds of pages — the architecture scales with your project. Multi-collection docs, versioning-ready structure, and automatic navigation.",
35-
span: 4,
36-
},
5+
{ icon: "mdi:rocket-launch", titleKey: "highlights.ship.title", descKey: "highlights.ship.description", title: "Ship docs in minutes, not days", description: "Clone the repo, write your Markdown, deploy. No complex setup, no build pipeline to configure. Your documentation is live before your coffee gets cold.", span: 4 },
6+
{ icon: "mdi:palette-swatch-variant", titleKey: "highlights.brand.title", descKey: "highlights.brand.description", title: "Your brand, your way", description: "Tailwind CSS design tokens let you match your documentation to your product identity with a few CSS variable changes.", span: 2 },
7+
{ icon: "mdi:puzzle-outline", titleKey: "highlights.extensible.title", descKey: "highlights.extensible.description", title: "Extensible by design", description: "Drop in React, Vue, or Svelte components directly in your Markdown. Build interactive examples, live demos, and API playgrounds.", span: 2 },
8+
{ icon: "mdi:chart-line", titleKey: "highlights.growth.title", descKey: "highlights.growth.description", title: "Built for growth", description: "From a single getting-started guide to hundreds of pages — the architecture scales with your project. Multi-collection docs, versioning-ready structure, and automatic navigation.", span: 4 },
379
];
3810
---
3911

@@ -54,18 +26,18 @@ const highlights = [
5426
</div>
5527

5628
<div
57-
class="absolute -bottom-16 -right-24 w-80 h-80 rounded-full border-2 border-primary/[0.09]"
29+
class="absolute -bottom-16 -right-24 w-80 h-80 rounded-full border-2 border-primary/9"
5830
>
5931
</div>
6032

6133
<div class="absolute top-8 right-1/3 size-2.5 rounded-full bg-primary/10">
6234
</div>
6335
<div
64-
class="absolute bottom-1/4 left-[20%] size-2 rounded-full bg-primary/[0.08]"
36+
class="absolute bottom-1/4 left-[20%] size-2 rounded-full bg-primary/8"
6537
>
6638
</div>
6739
<div
68-
class="absolute top-[60%] right-[8%] size-1.5 rounded-full bg-primary/[0.09]"
40+
class="absolute top-[60%] right-[8%] size-1.5 rounded-full bg-primary/9"
6941
>
7042
</div>
7143
</div>
@@ -75,16 +47,18 @@ const highlights = [
7547
<div class="text-center mb-16">
7648
<p
7749
class="text-sm font-semibold text-primary uppercase tracking-wide mb-3"
50+
data-t="highlights.label"
7851
>
7952
Highlights
8053
</p>
81-
<h2 class="text-3xl font-semibold text-foreground sm:text-4xl">
82-
{title}
54+
<h2 class="text-3xl font-semibold text-foreground sm:text-4xl" data-t="highlights.title">
55+
Why Explainer?
8356
</h2>
8457
<p
8558
class="mt-4 text-lg text-muted-foreground max-w-2xl mx-auto text-balance"
59+
data-t="highlights.description"
8660
>
87-
{description}
61+
Built for developers who care about their users' experience.
8862
</p>
8963
</div>
9064

@@ -106,10 +80,10 @@ const highlights = [
10680
/>
10781
</div>
10882
<div>
109-
<h3 class="text-xl font-semibold text-foreground">
83+
<h3 class="text-xl font-semibold text-foreground" data-t={item.titleKey}>
11084
{item.title}
11185
</h3>
112-
<p class="text-sm text-muted-foreground mt-2 leading-relaxed">
86+
<p class="text-sm text-muted-foreground mt-2 leading-relaxed" data-t={item.descKey}>
11387
{item.description}
11488
</p>
11589
</div>

0 commit comments

Comments
 (0)