Skip to content

Commit 57312dd

Browse files
docs: translate Japanese comments in non-test files and refine doc strings
1 parent 8262529 commit 57312dd

File tree

8 files changed

+56
-57
lines changed

8 files changed

+56
-57
lines changed

browser/dom/cache.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
*
66
* > [!NOTE]
77
* > Implementation inspired by Scrapbox's ServiceWorker and Cache usage pattern.
8-
* > {@see https://scrapbox.io/daiiz/ScrapboxでのServiceWorkerとCacheの活用#5d2efaffadf4e70000651173}
9-
8+
* > For details, see the article "ServiceWorker and Cache Usage in Scrapbox" {@see https://scrapbox.io/daiiz/ScrapboxでのServiceWorkerとCacheの活用#5d2efaffadf4e70000651173}
109
*
1110
* @param request The request to find a cached response for
1211
* @param options Cache query options (e.g., to ignore search params)

browser/dom/extractCodeFiles.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ export interface CodeBlock {
3535
lines: string[];
3636
}
3737

38-
/** `scrapbox.Page.lines`からcode blocksを取り出す
38+
/** Extract code blocks from {@linkcode scrapbox.Page.lines}
3939
*
40-
* @param lines ページの行
41-
* @return filenameをkeyにしたソースコードのMap
40+
* @param lines Page lines to process
41+
* @return A Map of source code files with filename as key
4242
*/
4343
export const extractCodeFiles = (
4444
lines: Iterable<Line>,

browser/dom/motion.ts

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,66 +33,66 @@ export const focusEnd = async (holding = 1000): Promise<void> => {
3333
await holdDown(target, { X: right + 1, Y: top + height / 2, holding });
3434
};
3535

36-
/** カーソルを左に動かす
36+
/** Move the cursor left using `ArrowLeft` key
3737
*
38-
* @param [count=1] 動かす回数
38+
* @param [count=1] Number of moves to perform
3939
*/
4040
export const moveLeft = (count = 1): void => {
4141
for (const _ of range(0, count)) {
4242
press("ArrowLeft");
4343
}
4444
};
45-
/** カーソルを上に動かす
45+
/** Move the cursor up using `ArrowUp` key
4646
*
47-
* @param [count=1] 動かす回数
47+
* @param [count=1] Number of moves to perform
4848
*/
4949
export const moveUp = (count = 1): void => {
5050
for (const _ of range(0, count)) {
5151
press("ArrowUp");
5252
}
5353
};
54-
/** カーソルを下に動かす
54+
/** Move the cursor down using `ArrowDown` key
5555
*
56-
* @param [count=1] 動かす回数
56+
* @param [count=1] Number of moves to perform
5757
*/
5858
export const moveDown = (count = 1): void => {
5959
for (const _ of range(0, count)) {
6060
press("ArrowDown");
6161
}
6262
};
63-
/** カーソルを右に動かす
63+
/** Move the cursor right using `ArrowRight` key
6464
*
65-
* @param [count=1] 動かす回数
65+
* @param [count=1] Number of moves to perform
6666
*/
6767
export const moveRight = (count = 1): void => {
6868
for (const _ of range(0, count)) {
6969
press("ArrowRight");
7070
}
7171
};
7272

73-
/** インデントを除いた行頭に移動する */
73+
/** Move to the start of line excluding indentation */
7474
export const goHeadWithoutBlank = (): void => {
7575
press("End");
7676
press("Home");
7777
};
78-
/** 最後の非空白文字に移動する */
78+
/** Move to the last non-whitespace character */
7979
export const goEndWithoutBlank = (): void => {
8080
press("End");
8181
moveLeft(
8282
getText(caret().position.line)?.match?.(/(\s*)$/)?.[1]?.length ?? 0,
8383
);
8484
};
85-
/** 行頭に移動する */
85+
/** Move to the start of line */
8686
export const goHead = (): void => {
8787
press("Home");
8888
press("Home");
8989
};
90-
/** 行末に移動する */
90+
/** Move to the end of line */
9191
export const goEnd = (): void => {
9292
press("End");
9393
};
9494

95-
/** 最初の行の行頭に移動する */
95+
/** Move to the start of the first line */
9696
export const goHeadLine = async (): Promise<void> => {
9797
const target = getHeadLineDOM();
9898
if (!target) throw Error(".line:first-of-type can't be found.");
@@ -103,13 +103,13 @@ export const goHeadLine = async (): Promise<void> => {
103103
const { left, top } = charDOM.getBoundingClientRect();
104104
await click(target, { X: left, Y: top });
105105
};
106-
/** 最後の行の行末に移動する */
106+
/** Move to the end of the last line */
107107
export const goLastLine = async (): Promise<void> => {
108108
await _goLine(getTailLineDOM());
109109
};
110-
/** 任意の行の行末に移動する
110+
/** Move to the end of a specified line
111111
*
112-
* @param value 移動したい行の行番号 or 行ID or 行のDOM
112+
* @param value Target line number, line ID, or {@linkcode HTMLElement}
113113
*/
114114
export const goLine = async (
115115
value: string | number | HTMLElement | undefined,
@@ -160,9 +160,9 @@ const getVisibleLineCount = (): number => {
160160
return Math.round(globalThis.innerHeight / clientHeight);
161161
};
162162

163-
/** 半ページ上にスクロールする
163+
/** Scroll half a page up
164164
*
165-
* @param [count=1] スクロール回数
165+
* @param [count=1] Number of scroll operations to perform
166166
*/
167167
export const scrollHalfUp = async (count = 1): Promise<void> => {
168168
const lineNo = getLineNo(caret().position.line);
@@ -174,9 +174,9 @@ export const scrollHalfUp = async (count = 1): Promise<void> => {
174174
);
175175
await goLine(Math.max(index, 0));
176176
};
177-
/** 半ページ下にスクロールする
177+
/** Scroll half a page down
178178
*
179-
* @param [count=1] スクロール回数
179+
* @param [count=1] Number of scroll operations to perform
180180
*/
181181
export const scrollHalfDown = async (count = 1): Promise<void> => {
182182
const lineNo = getLineNo(caret().position.line);
@@ -188,18 +188,18 @@ export const scrollHalfDown = async (count = 1): Promise<void> => {
188188
);
189189
await goLine(Math.min(index, getLineCount() - 1));
190190
};
191-
/** 1ページ上にスクロールする
191+
/** Scroll one page up using `PageUp` key
192192
*
193-
* @param [count=1] スクロール回数
193+
* @param [count=1] Number of scroll operations to perform
194194
*/
195195
export const scrollUp = (count = 1): void => {
196196
for (const _ of range(0, count)) {
197197
press("PageUp");
198198
}
199199
};
200-
/** 1ページ下にスクロールする
200+
/** Scroll one page down using `PageDown` key
201201
*
202-
* @param [count=1] スクロール回数
202+
* @param [count=1] Number of scroll operations to perform
203203
*/
204204
export const scrollDown = (count = 1): void => {
205205
for (const _ of range(0, count)) {

browser/dom/open.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ export interface OpenOptions {
3131
context?: Omit<PageTransitionContext, "to">;
3232
}
3333

34-
/** ページを開く
34+
/** Open a page
3535
*
36-
* @param project 開くページのproject名
37-
* @param title 開くページのタイトル
38-
* @param options
36+
* @param project Project name of the page to open
37+
* @param title Title of the page to open
38+
* @param options Configuration options for opening the page
3939
*/
4040
export const open = (
4141
project: string,
@@ -74,13 +74,13 @@ export const open = (
7474
a.remove();
7575
};
7676

77-
/** 同じタブでページを開く
77+
/** Open a page in the same tab
7878
*
79-
* このとき、ページは再読み込みされない
79+
* The page will not be reloaded when opened
8080
*
81-
* @param project 開くページのproject名
82-
* @param title 開くページのタイトル
83-
* @param [body] ページに追記するテキスト
81+
* @param project Project name of the page to open
82+
* @param title Title of the page to open
83+
* @param [body] Text to append to the page
8484
*/
8585
export const openInTheSameTab = (
8686
project: string,

browser/websocket/emit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export const emit = <EventName extends keyof WrapperdEmitEvents>(
9191
reject(new Error("io client disconnect"));
9292
return;
9393
}
94-
// 復帰不能なエラー
94+
// Unrecoverable error state
9595
if (reason === "io server disconnect") {
9696
dispose();
9797
resolve(createErr({ name: "SocketIOError" }));

browser/websocket/updateCodeFile.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export const updateCodeFile = (
125125
title: string,
126126
options?: UpdateCodeFileOptions,
127127
): Promise<Result<string, PushError>> => {
128-
/** optionsの既定値はこの中に入れる */
128+
/** Set default values for options here */
129129
const defaultOptions: Required<
130130
Omit<UpdateCodeFileOptions, "maxAttempts" | "socket">
131131
> = {
@@ -225,13 +225,13 @@ function* makeCommits(
225225
>[] = [..._codeBlocks];
226226
const codeBodies = flatCodeBodies(_codeBlocks);
227227
if (codeBlocks.length <= 0) {
228-
// ページ内にコードブロックが無かった場合は新しく作成
228+
// Create a new code block if none exists in the page
229229
if (insertPositionIfNotExist === "notInsert") return;
230230
const nextLine = insertPositionIfNotExist === "top" && lines.length > 1
231231
? lines[1]
232232
: null;
233233
const title = {
234-
// コードブロックのタイトル行
234+
// Code block title line
235235
_insert: nextLine?.id ?? "_end",
236236
lines: {
237237
id: createNewLineId(userId),

rest/getCodeBlock.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ const getCodeBlock_fromResponse: GetCodeBlock["fromResponse"] = async (res) =>
5050
);
5151

5252
export interface GetCodeBlock {
53-
/** `/api/code/:project/:title/:filename` の要求を組み立てる
53+
/** Build a request for `/api/code/:project/:title/:filename`
5454
*
55-
* @param project 取得したいページのproject名
56-
* @param title 取得したいページのtitle 大文字小文字は問わない
57-
* @param filename 取得したいコードブロックのファイル名
58-
* @param options オプション
59-
* @return request
55+
* @param project Name of the project containing the target page
56+
* @param title Title of the target page (case-insensitive)
57+
* @param filename Name of the code block file to retrieve
58+
* @param options Configuration options
59+
* @return {@linkcode Request} object
6060
*/
6161
toRequest: (
6262
project: string,
@@ -65,10 +65,10 @@ export interface GetCodeBlock {
6565
options?: BaseOptions,
6666
) => Request;
6767

68-
/** 帰ってきた応答からコードを取得する
68+
/** Extract code from the response
6969
*
70-
* @param res 応答
71-
* @return コード
70+
* @param res Response from the API
71+
* @return Code content as a string
7272
*/
7373
fromResponse: (res: Response) => Promise<Result<string, CodeBlockError>>;
7474

@@ -85,12 +85,12 @@ export type CodeBlockError =
8585
| NotMemberError
8686
| HTTPError;
8787

88-
/** 指定したコードブロック中のテキストを取得する
88+
/** Retrieve text content from a specified code block
8989
*
90-
* @param project 取得したいページのproject名
91-
* @param title 取得したいページのtitle 大文字小文字は問わない
92-
* @param filename 取得したいコードブロックのファイル名
93-
* @param options オプション
90+
* @param project Name of the project containing the target page
91+
* @param title Title of the target page (case-insensitive)
92+
* @param filename Name of the code block file to retrieve
93+
* @param options Configuration options
9494
*/
9595
export const getCodeBlock: GetCodeBlock = /* @__PURE__ */ (() => {
9696
const fn: GetCodeBlock = async (

rest/link.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export interface InvalidFollowingIdError extends ErrorLike {
2424
}
2525

2626
export interface GetLinksOptions extends BaseOptions {
27-
/** 次のリンクリストを示すID */
27+
/** ID indicating the next list of links */
2828
followingId?: string;
2929
}
3030

0 commit comments

Comments
 (0)