Skip to content

Commit 2cd87a2

Browse files
authored
Merge branch 'main' into patch-0103
2 parents bc456e1 + 5ff926f commit 2cd87a2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+843
-110
lines changed

.changeset/afraid-horses-compare.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@astrojs/starlight": patch
3+
---
4+
5+
chore: fix type errors in Starlight internals

CONTRIBUTING.md

+1
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ Visit **<https://i18n.starlight.astro.build>** to track translation progress for
203203
To add a language, you will need its BCP-47 tag and a label. See [“Adding a new language”](https://github.com/withastro/docs/blob/main/contributor-guides/translating-astro-docs.md#adding-a-new-language) in the Astro docs repo for some helpful tips around choosing these.
204204

205205
- Add your language to the `locales` config in `docs/astro.config.mjs`
206+
- Add your language to the `locales` config in `docs/lunaria.config.json`
206207
- Add your language’s subtag to the i18n label config in `.github/labeler.yml`
207208
- Add your language to the `pa11y` script’s `--sitemap-exclude` flag in `package.json`
208209
- Create the first translated page for your language.

docs-i18n-tracker/build.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const translationStatusBuilder = new TranslationStatusBuilder({
66
htmlOutputFilePath: './dist/index.html',
77
sourceLanguage: 'en',
88
targetLanguages: Object.values(locales)
9-
.reduce((acc, { lang }) => (lang !== 'en' ? [lang, ...acc] : acc), [])
9+
.reduce((acc, { lang }) => (lang !== 'en' ? [lang, ...acc] : acc), new Array<string>())
1010
.sort(),
1111
languageLabels: Object.values(locales)
1212
.filter((loc) => loc.lang !== 'en')

docs-i18n-tracker/lib/github-get.mjs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import pRetry, { AbortError } from 'p-retry';
99
export async function githubGet({ url, githubToken = undefined }) {
1010
return await pRetry(
1111
async () => {
12+
/** @type {Record<string, string>} */
1213
const headers = {
1314
Accept: 'application/vnd.github.v3+json',
1415
};

docs-i18n-tracker/lib/output.mjs

+3-2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export function error(message, ...params) {
3030
/**
3131
* Dedents the given markdown and replaces single newlines with spaces,
3232
* while leaving new paragraphs intact.
33+
* @param {[string | TemplateStringsArray, ...any[]]} markdown
3334
*/
3435
export function dedentMd(...markdown) {
3536
return dedent(...markdown).replace(/(\S)\n(?!\n)/g, '$1 ');
@@ -56,7 +57,7 @@ export function formatCount(count, template) {
5657
const wrapWithCount = (text) => {
5758
// If no count was given, we're outputting a single issue in annotations,
5859
// so omit count and capitalize the first letter of the issue type description
59-
if (count === undefined) return text[0].toUpperCase() + text.slice(1);
60+
if (count === undefined) return text[0]?.toUpperCase() + text.slice(1);
6061

6162
// Otherwise, prefix the issue type description with count
6263
return `${count} ${text}`;
@@ -65,7 +66,7 @@ export function formatCount(count, template) {
6566
const usePlural = count !== undefined && count !== 1;
6667
const templateParts = template.split('|');
6768
const usedTemplate = templateParts.length === 2 ? templateParts[usePlural ? 1 : 0] : template;
68-
return wrapWithCount(usedTemplate.replace(/\(s\)/g, usePlural ? 's' : ''));
69+
return wrapWithCount(usedTemplate?.replace(/\(s\)/g, usePlural ? 's' : '') ?? '');
6970
}
7071

7172
export default {

docs/lunaria.config.json

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
"$schema": "./node_modules/@lunariajs/core/config.schema.json",
3+
"repository": {
4+
"name": "withastro/starlight",
5+
"rootDir": "docs"
6+
},
7+
"defaultLocale": {
8+
"label": "English",
9+
"lang": "en"
10+
},
11+
"locales": [
12+
{
13+
"label": "Dansk",
14+
"lang": "da"
15+
},
16+
{
17+
"label": "Deutsch",
18+
"lang": "de"
19+
},
20+
{
21+
"label": "Español",
22+
"lang": "es"
23+
},
24+
{
25+
"label": "Français",
26+
"lang": "fr"
27+
},
28+
{
29+
"label": "हिंदी",
30+
"lang": "hi"
31+
},
32+
{
33+
"label": "Bahasa Indonesia",
34+
"lang": "id"
35+
},
36+
{
37+
"label": "Italiano",
38+
"lang": "it"
39+
},
40+
{
41+
"label": "日本語",
42+
"lang": "ja"
43+
},
44+
{
45+
"label": "한국어",
46+
"lang": "ko"
47+
},
48+
{
49+
"label": "Português do Brasil",
50+
"lang": "pt-br"
51+
},
52+
{
53+
"label": "Русский",
54+
"lang": "ru"
55+
},
56+
{
57+
"label": "Türkçe",
58+
"lang": "tr"
59+
},
60+
{
61+
"label": "Українська",
62+
"lang": "uk"
63+
},
64+
{
65+
"label": "简体中文",
66+
"lang": "zh-cn"
67+
}
68+
],
69+
"files": [
70+
{
71+
"location": "src/content/docs/**/*.{md,mdx}",
72+
"pattern": "src/content/docs/@lang/@path"
73+
}
74+
],
75+
"dashboard": {
76+
"title": "Starlight Docs Translation Status",
77+
"description": "Translation progress tracker for the Starlight Docs site. See how much has been translated in your language and get involved!",
78+
"favicon": {
79+
"external": [
80+
{
81+
"link": "https://starlight.astro.build/favicon.svg",
82+
"type": "image/svg+xml"
83+
}
84+
]
85+
},
86+
"customCss": ["./lunaria/styles.css"],
87+
"basesToHide": ["src/content/docs/"],
88+
"ui": {
89+
"statusByLocale.heading": "Translation progress by locale",
90+
"statusByLocale.incompleteLocalizationLink": "incomplete translation",
91+
"statusByLocale.outdatedLocalizationLink": "outdated translation",
92+
"statusByLocale.completeLocalization": "This translation is complete, amazing job! 🎉",
93+
"statusByFile.heading": "Translation status by file"
94+
}
95+
},
96+
"ignoreKeywords": ["lunaria-ignore", "typo", "en-only", "broken link", "i18nReady", "i18nIgnore"],
97+
"renderer": "./lunaria/renderer.config.ts"
98+
}

docs/lunaria/components.ts

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { html } from '@lunariajs/core';
2+
3+
export const TitleParagraph = () => html`
4+
<p>
5+
If you're interested in helping us translate
6+
<a href="https://starlight.astro.build/">starlight.astro.build</a> into one of the languages
7+
listed below, you've come to the right place! This auto-updating page always lists all the
8+
content that could use your help right now.
9+
</p>
10+
<p>
11+
Before starting a new translation, please read our
12+
<a
13+
href="https://github.com/withastro/starlight/blob/main/CONTRIBUTING.md#translating-starlights-docs"
14+
>translation guide</a
15+
>
16+
to learn about our translation process and how you can get involved.
17+
</p>
18+
`;

docs/lunaria/renderer.config.ts

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { defineRendererConfig } from '@lunariajs/core';
2+
import { TitleParagraph } from './components';
3+
4+
export default defineRendererConfig({
5+
slots: {
6+
afterTitle: TitleParagraph,
7+
},
8+
});

docs/lunaria/styles.css

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
:root {
2+
--theme-accent: hsl(234, 100%, 87%);
3+
--theme-bg: hsl(223, 13%, 10%);
4+
--theme-table-header: hsl(222, 13%, 16%);
5+
--theme-table-hover: hsl(222, 13%, 16%);
6+
--theme-text: hsl(228, 8%, 77%);
7+
--theme-text-bright: hsl(0, 0%, 100%);
8+
--overlay-blurple: hsla(255, 60%, 60%, 0.2);
9+
10+
--ln-color-background: linear-gradient(215deg, var(--overlay-blurple), transparent 40%),
11+
radial-gradient(var(--overlay-blurple), transparent 40%) no-repeat -60vw -40vh / 105vw 200vh,
12+
radial-gradient(var(--overlay-blurple), transparent 65%) no-repeat 50% calc(100% + 20rem) /
13+
60rem 30rem,
14+
var(--theme-bg);
15+
--ln-color-link: var(--theme-accent);
16+
--ln-color-black: var(--theme-text);
17+
--ln-color-done: var(--ln-color-blue);
18+
--ln-color-outdated: #ea580c;
19+
--ln-color-missing: var(--theme-text-bright);
20+
--ln-color-table-background: var(--theme-table-header);
21+
--ln-color-table-border: var(--theme-table-header);
22+
23+
color-scheme: dark;
24+
}
25+
26+
h1,
27+
h2,
28+
h3,
29+
h4,
30+
h5,
31+
h6 {
32+
color: var(--theme-text-bright);
33+
}
34+
35+
p a {
36+
text-decoration: underline;
37+
}
38+
39+
.create-button {
40+
background-color: hsl(213deg 89% 64% / 20%);
41+
border-radius: 0.5em;
42+
}
43+
44+
sup {
45+
display: flex;
46+
justify-content: center;
47+
}

docs/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
"start": "astro dev",
1111
"build": "astro build",
1212
"preview": "astro preview",
13-
"astro": "astro"
13+
"astro": "astro",
14+
"lunaria:build": "lunaria build"
1415
},
1516
"dependencies": {
1617
"@astrojs/starlight": "workspace:*",
18+
"@lunariajs/core": "^0.0.25",
1719
"@types/culori": "^2.0.0",
1820
"astro": "^4.0.1",
1921
"culori": "^3.2.0",

docs/src/components/theme-designer.astro

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
import { TabItem, Tabs } from '@astrojs/starlight/components';
3-
import ColorEditor, { Props as EditorProps } from './theme-designer/color-editor.astro';
4-
import Presets, { Props as PresetsProps } from './theme-designer/presets.astro';
3+
import ColorEditor, { type Props as EditorProps } from './theme-designer/color-editor.astro';
4+
import Presets, { type Props as PresetsProps } from './theme-designer/presets.astro';
55
import Preview from './theme-designer/preview.astro';
66
77
interface Props {

docs/src/content/docs/de/guides/i18n.mdx

+7-3
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,13 @@ Du kannst Übersetzungen für zusätzliche Sprachen, die du unterstützt, über
196196
"i18n.untranslatedContent": "This content is not available in your language yet.",
197197
"page.editLink": "Edit page",
198198
"page.lastUpdated": "Last updated:",
199-
"page.previousLink": "Next",
200-
"page.nextLink": "Previous",
201-
"404.text": "Page not found. Check the URL or try using the search bar."
199+
"page.previousLink": "Previous",
200+
"page.nextLink": "Next",
201+
"404.text": "Page not found. Check the URL or try using the search bar.",
202+
"aside.note": "Note",
203+
"aside.tip": "Tip",
204+
"aside.caution": "Caution",
205+
"aside.danger": "Danger"
202206
}
203207
```
204208

docs/src/content/docs/es/guides/i18n.mdx

+7-3
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,13 @@ Puedes proprocionar traducciones para idiomas adicionales, o editar nuestras eti
200200
"i18n.untranslatedContent": "This content is not available in your language yet.",
201201
"page.editLink": "Edit page",
202202
"page.lastUpdated": "Last updated:",
203-
"page.previousLink": "Next",
204-
"page.nextLink": "Previous",
205-
"404.text": "Page not found. Check the URL or try using the search bar."
203+
"page.previousLink": "Previous",
204+
"page.nextLink": "Next",
205+
"404.text": "Page not found. Check the URL or try using the search bar.",
206+
"aside.note": "Note",
207+
"aside.tip": "Tip",
208+
"aside.caution": "Caution",
209+
"aside.danger": "Danger"
206210
}
207211
```
208212

docs/src/content/docs/fr/guides/i18n.mdx

+7-3
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,13 @@ Vous pouvez fournir des traductions pour les langues supplémentaires que vous s
198198
"i18n.untranslatedContent": "This content is not available in your language yet.",
199199
"page.editLink": "Edit page",
200200
"page.lastUpdated": "Last updated:",
201-
"page.previousLink": "Next",
202-
"page.nextLink": "Previous",
203-
"404.text": "Page not found. Check the URL or try using the search bar."
201+
"page.previousLink": "Previous",
202+
"page.nextLink": "Next",
203+
"404.text": "Page not found. Check the URL or try using the search bar.",
204+
"aside.note": "Note",
205+
"aside.tip": "Tip",
206+
"aside.caution": "Caution",
207+
"aside.danger": "Danger"
204208
}
205209
```
206210

docs/src/content/docs/guides/i18n.mdx

+7-3
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,13 @@ You can provide translations for additional languages you support — or overrid
199199
"i18n.untranslatedContent": "This content is not available in your language yet.",
200200
"page.editLink": "Edit page",
201201
"page.lastUpdated": "Last updated:",
202-
"page.previousLink": "Next",
203-
"page.nextLink": "Previous",
204-
"404.text": "Page not found. Check the URL or try using the search bar."
202+
"page.previousLink": "Previous",
203+
"page.nextLink": "Next",
204+
"404.text": "Page not found. Check the URL or try using the search bar.",
205+
"aside.note": "Note",
206+
"aside.tip": "Tip",
207+
"aside.caution": "Caution",
208+
"aside.danger": "Danger"
205209
}
206210
```
207211

0 commit comments

Comments
 (0)