Skip to content

Commit 4e3161c

Browse files
3w36zj6Its-Just-NansYDX-2147483647
authored
docs: translate SSG documentation comments to English (#283)
Co-authored-by: Its-Just-Nans <[email protected]> Co-authored-by: Y.D.X. <[email protected]>
1 parent 4b0856d commit 4e3161c

15 files changed

+82
-79
lines changed

website/.env.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
VITE_LISTEN_ALL_ADDRESSES=true # 開発用にViteが全てのアドレスでlistenするかどうか
1+
# Whether Vite should listen on all addresses for development.
2+
VITE_LISTEN_ALL_ADDRESSES=true

website/src/components/ui/HtmlContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const HtmlContent: FC<HtmlContentProps> = ({ html }) => {
2323
"[&_pre_code]:block",
2424
"[&_pre_code]:w-full",
2525
])}
26-
// biome-ignore lint/security/noDangerouslySetInnerHtml: typst-docsで生成されたHTMLを表示する
26+
// biome-ignore lint/security/noDangerouslySetInnerHtml: Displaying HTML generated by typst-docs.
2727
dangerouslySetInnerHTML={{ __html: html }}
2828
/>
2929
);

website/src/components/ui/common/SearchWindow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const SearchWindow: FC = () => {
3939
</div>
4040
{!import.meta.env.DEV && (
4141
<script
42-
// biome-ignore lint/security/noDangerouslySetInnerHtml: pagefindで生成されたスクリプトを実行する
42+
// biome-ignore lint/security/noDangerouslySetInnerHtml: Execute scripts generated by pagefind.
4343
dangerouslySetInnerHTML={{
4444
__html: `window.addEventListener('DOMContentLoaded', (event) => {
4545
new PagefindUI({ element: "#search", showSubResults: true });

website/src/components/ui/genPath.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import type { Func } from "../../types/model";
22

33
/**
4-
* pathを連結する
4+
* Concatenates path segments.
55
*
6-
* @param item - Func
7-
* @returns - 連結されたpath
6+
* @param item - A Func object
7+
* @returns - The concatenated path string
88
*/
99
export const genPath = (item: Func): string => {
1010
return item.path.map((s) => `${s}.`).join("");

website/src/components/ui/type2href.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**
2-
* 型名からリンクを取得する
2+
* Retrieve a link from a type name.
33
*
4-
* @param parameterType 型名
5-
* @returns リンク
4+
* @param parameterType The type name.
5+
* @returns The link.
66
*/
77
export const type2href = (parameterType: string): string | null => {
88
const foundationSet = new Set([

website/src/globals.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ samp {
6868
@apply pt-4;
6969
}
7070

71-
/* Alpine.jsのx-cloak属性を持つ要素を非表示にする */
71+
/* Hide elements with the x-cloak attribute from Alpine.js */
7272
[x-cloak] {
7373
display: none !important;
7474
visibility: hidden;
7575
}
7676

77-
/* Inline codeのスタイルをGitHub風にする */
77+
/* Style inline code blocks with GitHub-style appearance */
7878
.prose :not(pre) > code {
7979
background-color: rgba(175, 184, 193, 0.2);
8080
font-size: 0.875em;
@@ -91,7 +91,7 @@ samp {
9191
}
9292
}
9393

94-
/* Code blockをMonokai風にする */
94+
/* Style code blocks with Monokai theme */
9595
pre code span.typ-comment {
9696
color: #88846f;
9797
}

website/src/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ import { isPageOfKind } from "./utils/isPageOfKind";
1616
import { removeBasePath } from "./utils/path";
1717
import { registerRoutes } from "./utils/translationStatus";
1818

19-
// typst-docsが生成したドキュメント
19+
// Documentation generated by typst-docs.
2020
import docsJson from "../../docs.json";
2121
const docs = docsJson as unknown as Page[];
2222

2323
const [flattenedPages, pagePaths] = flattenDocs(docs);
2424

25-
// 未知のページを未翻訳として登録する
25+
// Register unknown pages as untranslated.
2626
const allRoutes = flattenedPages.map((page) => page.route);
2727
registerRoutes(allRoutes);
2828

website/src/types/model.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// docs.jsonの型
2-
// cf. docs/src/model.rs
1+
// Type definitions for `docs.json`.
2+
// Reference: `docs/src/model.rs`
33

44
/**
5-
* ページ情報
5+
* Details about a documentation page and its children.
66
*/
77
export type Page = {
88
route: string;
@@ -15,7 +15,7 @@ export type Page = {
1515
};
1616

1717
/**
18-
* アウトライン情報
18+
* An element in the outline.
1919
*/
2020
export type OutlineItem = {
2121
id: string;
@@ -24,7 +24,7 @@ export type OutlineItem = {
2424
};
2525

2626
/**
27-
* 本文情報
27+
* Details about the body of a documentation page.
2828
*/
2929
export type Body =
3030
| HtmlBody

website/src/utils/flattenDocs.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,22 @@ describe("flattenDocs", () => {
2020
children,
2121
});
2222

23-
it("空の配列を渡すと空の結果を返す", () => {
23+
it("should return an empty result when given an empty array", () => {
2424
const [flattenedPages, pagePaths] = flattenDocs([]);
2525

2626
expect(flattenedPages).toEqual([]);
2727
expect(pagePaths).toEqual([]);
2828
});
2929

30-
it("子を持たない単一ページを平坦化する", () => {
30+
it("should flatten a single page with no children", () => {
3131
const page = createMockPage("/docs/", "Documentation");
3232
const [flattenedPages, pagePaths] = flattenDocs([page]);
3333

3434
expect(flattenedPages).toEqual([page]);
3535
expect(pagePaths).toEqual([[page]]);
3636
});
3737

38-
it("複数の子を持たないページを平坦化する", () => {
38+
it("should flatten multiple pages with no children", () => {
3939
const page1 = createMockPage("/docs/", "Documentation");
4040
const page2 = createMockPage("/tutorial/", "Tutorial");
4141
const [flattenedPages, pagePaths] = flattenDocs([page1, page2]);
@@ -44,7 +44,7 @@ describe("flattenDocs", () => {
4444
expect(pagePaths).toEqual([[page1], [page2]]);
4545
});
4646

47-
it("子を持つページを平坦化する", () => {
47+
it("should flatten a page with children", () => {
4848
const childPage = createMockPage("/docs/tutorial/", "Tutorial");
4949
const parentPage = createMockPage("/docs/", "Documentation", [childPage]);
5050
const [flattenedPages, pagePaths] = flattenDocs([parentPage]);
@@ -53,7 +53,7 @@ describe("flattenDocs", () => {
5353
expect(pagePaths).toEqual([[parentPage], [parentPage, childPage]]);
5454
});
5555

56-
it("複数階層のページを平坦化する", () => {
56+
it("should flatten pages with multiple levels of children", () => {
5757
const grandChildPage = createMockPage("/docs/tutorial/basics/", "Basics");
5858
const childPage = createMockPage("/docs/tutorial/", "Tutorial", [
5959
grandChildPage,
@@ -69,7 +69,7 @@ describe("flattenDocs", () => {
6969
]);
7070
});
7171

72-
it("複数の子を持つページを平坦化する", () => {
72+
it("should flatten a page with multiple children", () => {
7373
const child1 = createMockPage("/docs/tutorial/", "Tutorial");
7474
const child2 = createMockPage("/docs/reference/", "Reference");
7575
const parentPage = createMockPage("/docs/", "Documentation", [
@@ -86,7 +86,7 @@ describe("flattenDocs", () => {
8686
]);
8787
});
8888

89-
it("複雑な階層構造を平坦化する", () => {
89+
it("should flatten a complex hierarchical structure", () => {
9090
// docs/
9191
// ├── tutorial/
9292
// │ ├── basics/
@@ -130,7 +130,7 @@ describe("flattenDocs", () => {
130130
]);
131131
});
132132

133-
it("複数のルートページを持つ階層構造を平坦化する", () => {
133+
it("should flatten a hierarchical structure with multiple root pages", () => {
134134
const tutorialChild = createMockPage("/tutorial/basics/", "Basics");
135135
const tutorial = createMockPage("/tutorial/", "Tutorial", [tutorialChild]);
136136

@@ -148,7 +148,7 @@ describe("flattenDocs", () => {
148148
]);
149149
});
150150

151-
it("パス情報が正しく設定される", () => {
151+
it("should correctly set path information", () => {
152152
const grandChild = createMockPage("/a/b/c/", "C");
153153
const child = createMockPage("/a/b/", "B", [grandChild]);
154154
const parent = createMockPage("/a/", "A", [child]);

website/src/utils/flattenDocs.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
import type { Page } from "../types/model";
22

33
/**
4-
* ドキュメントの階層構造を平坦化する
5-
* パンくずリストと前後のページ情報を取得するために使用する
4+
* Flattens the hierarchical structure of documents.
5+
* Used to retrieve breadcrumb navigation and previous/next page information.
66
*
7-
* @param docs ページ情報の配列
8-
* @returns [平坦化されたページ情報のリスト, ページ情報のパス情報]
7+
* @param docs An array of page objects containing document information.
8+
* @returns A tuple containing:
9+
* - A flattened list of page objects
10+
* - An array of arrays representing the path information for each page object
911
*/
1012
export const flattenDocs = (docs: Page[]): [Page[], Page[][]] => {
11-
const flattenedPages: Page[] = []; // 平坦化されたページ情報のリスト
12-
const pagePaths: Page[][] = []; // ページ情報[i]のパス情報
13+
const flattenedPages: Page[] = []; // List to store flattened page objects.
14+
const pagePaths: Page[][] = []; // Path information for each page object [i].
1315

1416
const _flattenDocs = (page: Page, pagePath: Page[]): void => {
1517
flattenedPages.push(page);

0 commit comments

Comments
 (0)