From 1602952bff9606758335df05a2f49a5585e62ddf Mon Sep 17 00:00:00 2001 From: Rn86222 Date: Sat, 21 Nov 2026 03:00:21 +0900 Subject: [PATCH 1/4] fix: call parts and nodes components on the screen The screen called the same things parts (the tutorial's list heading, "Available parts", the stage texts, the loop error), components (the editor, the search box, the free mode list) and nodes (the free mode list's count, the deletion dialog, a refused connection). They are now all components, in English and Japanese. Co-Authored-By: Claude Opus 5.5 --- src/i18n/en.ts | 32 ++++++++--------- src/i18n/ja.ts | 35 +++++++++---------- .../Editor/store/slices/core/index.test.ts | 4 +-- src/pages/home/componentDeletion.test.ts | 8 ++--- src/pages/tutorial/stage.tsx | 2 +- src/store/simulation.test.ts | 10 +++--- src/store/simulationErrorTexts.ts | 4 +-- 7 files changed, 48 insertions(+), 47 deletions(-) diff --git a/src/i18n/en.ts b/src/i18n/en.ts index 4af388a..5a5ba10 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -25,9 +25,9 @@ const stageTexts: Record = { "Make the lamp {Out} turn [ON] only when both switches {A} and {B} are [ON]. The stage is cleared when the circuit works as in the table below.", ], steps: [ - "Pick a part in the Parts list and drag it onto the editor on the right.", - "The small squares on the edges of a part are its pins. A pin on the left side is an input, which receives [ON] or [OFF], and a pin on the right side is an output, which sends [ON] or [OFF]. Drag between an output pin and an input pin to connect them with a wire.", - "Once {Out} and every input pin of the parts you placed are connected, the play button at the bottom right can be pressed. It cannot be pressed while a part has a free input pin.", + "Pick a component in the Components list and drag it onto the editor on the right.", + "The small squares on the edges of a component are its pins. A pin on the left side is an input, which receives [ON] or [OFF], and a pin on the right side is an output, which sends [ON] or [OFF]. Drag between an output pin and an input pin to connect them with a wire.", + "Once {Out} and every input pin of the components you placed are connected, the play button at the bottom right can be pressed. It cannot be pressed while a component has a free input pin.", "After pressing the play button , click the switches {A} and {B} to turn them [ON] and [OFF], and watch the lamp {Out}. To fix the circuit, the pencil button in the same place takes you back to editing.", "When it works as in the table, press .", ], @@ -35,14 +35,14 @@ const stageTexts: Record = { "a-only": { title: "ON when only A is ON", goal: [ - "Make the lamp {Out} turn [ON] only when switch {A} is [ON] and {B} is [OFF]. This time, one part alone is not enough.", + "Make the lamp {Out} turn [ON] only when switch {A} is [ON] and {B} is [OFF]. This time, one component alone is not enough.", ], steps: [], }, xor: { title: "ON when just one is ON", goal: [ - 'Make the lamp {Out} turn [ON] when exactly one of the switches {A} and {B} is [ON]. It stays [OFF] when both are [ON]. "{ON when only A is ON}" is ready to use as a part.', + 'Make the lamp {Out} turn [ON] when exactly one of the switches {A} and {B} is [ON]. It stays [OFF] when both are [ON]. "{ON when only A is ON}" is ready to use as a component.', ], steps: [], }, @@ -57,7 +57,7 @@ const stageTexts: Record = { "full-adder": { title: "Adding with a carry", goal: [ - 'Output {A} + {B} + {Cin} as a two-digit binary number to {C} and {S}. {Cin} is the carry coming up from the next lower digit. The answer is 0 to 3, and 3 is [11] in binary. "{Adding one digit}" is ready to use as a part: add {A} and {B} with one, then add {Cin} to its {S} with another. This circuit is called a full adder.', + 'Output {A} + {B} + {Cin} as a two-digit binary number to {C} and {S}. {Cin} is the carry coming up from the next lower digit. The answer is 0 to 3, and 3 is [11] in binary. "{Adding one digit}" is ready to use as a component: add {A} and {B} with one, then add {Cin} to its {S} with another. This circuit is called a full adder.', ], steps: [], }, @@ -110,8 +110,8 @@ const stageTexts: Record = { ], steps: [ 'Place two "{0–5 counter}" and two "{0–9 counter}". "{0–5 counter}" is built like "{0–9 counter}", but goes back to 0 and carries over after 5 instead of 9.', - 'Give each of the four parts one of {M10}, {M1}, {S10} and {S1}: "{0–5 counter}" for {M10} and {S10}, and "{0–9 counter}" for {M1} and {S1}. Connect the {Count} of each to the output on the right named after its digit, and to the {7seg} of that digit. The {7seg}s are, from the top, for {M10}, {M1}, {S10} and {S1}.', - "Connect {Start} to {Up} of the part connected to {S1}. Then connect {Carry} of the part for {S1} to {Up} of the part for {S10}, {Carry} for {S10} to {Up} for {M1}, and {Carry} for {M1} to {Up} for {M10}. A digit then goes on only when the digit one lower goes back to 0.", + 'Give each of the four components one of {M10}, {M1}, {S10} and {S1}: "{0–5 counter}" for {M10} and {S10}, and "{0–9 counter}" for {M1} and {S1}. Connect the {Count} of each to the output on the right named after its digit, and to the {7seg} of that digit. The {7seg}s are, from the top, for {M10}, {M1}, {S10} and {S1}.', + "Connect {Start} to {Up} of the component connected to {S1}. Then connect {Carry} of the component for {S1} to {Up} of the component for {S10}, {Carry} for {S10} to {Up} for {M1}, and {Carry} for {M1} to {Up} for {M10}. A digit then goes on only when the digit one lower goes back to 0.", "Press the play button . If {Start} is [OFF] at the first time step, click it to turn it [ON]. Press , and the {Display} goes on like a clock, one time step a second. To see what comes after 59:59, stop , click the number at the bottom, enter 3600 and press the key. It goes to that time step at once and shows 59:59, and the right arrow shows 00:00.", ], }, @@ -150,16 +150,16 @@ export const en = { DISPLAY: "While playing, shows the value of {Pixels} as a picture, one bit per pixel ([1] is black, [0] is white). From the highest digit, the pixels go from the top left row by row in row-major order, or column by column in column-major order. While editing, the gear button sets the resolution and the pixel order.", INPUT: - "Adds an input to the component it is placed in. Where that component is placed as a part, the input is a pin on its left. While playing, its value can be changed on the placed {Input}.", + "Adds an input to the component it is placed in. Where that component is placed, the input is a pin on its left. While playing, its value can be changed on the placed {Input}.", OUTPUT: - "Adds an output to the component it is placed in. Where that component is placed as a part, the output is a pin on its right. While playing, it shows the value it receives.", + "Adds an output to the component it is placed in. Where that component is placed, the output is a pin on its right. While playing, it shows the value it receives.", } satisfies Record, pinBitWidth: (pinName: string, canAddPins: boolean) => canAddPins ? `The number in an {${pinName}} pin is its number of bits. Click an {${pinName}} pin while editing, and a box for each {${pinName}} pin appears, from the top. adds a box at the bottom, and removes the bottom one. Change the numbers in the boxes and press , and the {${pinName}} pins follow the boxes.` : `The number in the {${pinName}} pin is its number of bits. To change it, click the pin while editing, change the number in the box and press .`, about: (name: string) => `About ${name}`, - ofStage: "Available parts", + ofStage: "Available components", }, header: { language: "Language", @@ -188,7 +188,8 @@ export const en = { reset: "Reset", selectToEdit: "Select a component to start editing.", create: "Create", - nodeCount: (count: number) => `${count} ${count === 1 ? "node" : "nodes"}`, + nodeCount: (count: number) => + `Uses ${count} ${count === 1 ? "component" : "components"}`, componentMenu: "Component menu", resetDialog: { title: "Reset all components?", @@ -202,7 +203,7 @@ export const en = { title: (componentName: string) => `Delete ${componentName}?`, unused: "This cannot be undone.", used: (count: number, places: readonly string[], otherCount: number) => - `It is used ${count === 1 ? "once" : `${count} times`} in ${places.join(", ")}${otherCount > 0 ? ` and ${otherCount} other ${otherCount === 1 ? "component" : "components"}` : ""}. Deleting it also removes those nodes and their connections. This cannot be undone.`, + `It is used ${count === 1 ? "once" : `${count} times`} in ${places.join(", ")}${otherCount > 0 ? ` and ${otherCount} other ${otherCount === 1 ? "component" : "components"}` : ""}. Deleting it also removes it from those places, with its connections. This cannot be undone.`, }, errors: { read: (fileName: string) => `Could not read ${fileName}.`, @@ -238,7 +239,7 @@ export const en = { tutorial: { lead: [ "Starting at the first stage, build circuit after circuit, and finish a stopwatch in the last stage.", - "When a stage needs a circuit from an earlier one, it hands it to you as a finished part, so you can start from any stage.", + "When a stage needs a circuit from an earlier one, it hands it to you as a finished component, so you can start from any stage.", ], stageNumber: (number: number) => `Stage ${number}`, cleared: "Cleared", @@ -251,7 +252,6 @@ export const en = { }, startOverFailed: "Could not start the tutorial over.", stages: "Stages", - parts: "Parts", goalHeading: "Goal", stepsHeading: "Steps", digitsLegend: @@ -350,7 +350,7 @@ export const en = { }, connectionRejection: { sameDirection: "Cannot connect two input pins or two output pins", - sameNode: "Cannot connect pins of the same node", + sameNode: "Cannot connect two pins of one placed component", differentParentComponent: "Cannot connect pins placed in different components", inputAlreadyConnected: "This input pin is already connected", diff --git a/src/i18n/ja.ts b/src/i18n/ja.ts index eba25b8..0b18a45 100644 --- a/src/i18n/ja.ts +++ b/src/i18n/ja.ts @@ -32,16 +32,16 @@ export const ja: Messages = { DISPLAY: "再生中、{Pixels} の値を、1ビットを1ピクセルとして絵にする([1] は黒、[0] は白)。上の桁から順に、行優先なら左上から横に1行ずつ、列優先なら縦に1列ずつ並ぶ。解像度とピクセルの並び順は、編集中に歯車のボタンで変えられる。", INPUT: - "置いた先のコンポーネントに、入力を1つ足す。そのコンポーネントを部品として置くと、左側のピンになる。再生中は、置いた {Input} の上で値を変えられる。", + "置いた先のコンポーネントに、入力を1つ足す。そのコンポーネントを置くと、入力は左側のピンになる。再生中は、置いた {Input} の上で値を変えられる。", OUTPUT: - "置いた先のコンポーネントに、出力を1つ足す。そのコンポーネントを部品として置くと、右側のピンになる。再生中は、受け取った値を見せる。", + "置いた先のコンポーネントに、出力を1つ足す。そのコンポーネントを置くと、出力は右側のピンになる。再生中は、受け取った値を見せる。", }, pinBitWidth: (pinName, canAddPins) => canAddPins ? `{${pinName}} のピンの中の数字は、そのピンのビット数。編集中にピンをクリックすると、{${pinName}} のピンごとの欄が上から順に並ぶ。でいちばん下に欄を足し、でいちばん下の欄を消せる。欄の数字を書きかえてを押すと、{${pinName}} のピンが欄のとおりになる。` : `{${pinName}} のピンの中の数字は、そのピンのビット数。編集中にピンをクリックし、出てきた欄の数字を書きかえてを押す。`, about: (name) => `${name} について`, - ofStage: "使える部品", + ofStage: "使えるコンポーネント", }, header: { language: "言語", @@ -70,7 +70,7 @@ export const ja: Messages = { reset: "リセット", selectToEdit: "編集するコンポーネントを選んでください。", create: "作成", - nodeCount: (count) => `${count} 個のノード`, + nodeCount: (count) => `${count} 個のコンポーネントを使用`, componentMenu: "コンポーネントのメニュー", resetDialog: { title: "すべてのコンポーネントをリセットしますか?", @@ -84,7 +84,7 @@ export const ja: Messages = { title: (componentName) => `${componentName} を削除しますか?`, unused: "元に戻せません。", used: (count, places, otherCount) => - `${places.join("、")}${otherCount > 0 ? ` ほか ${otherCount} 個のコンポーネントで` : " で"} ${count} か所使われています。削除すると、それらのノードと、つながっている線も消えます。元に戻せません。`, + `${places.join("、")}${otherCount > 0 ? ` ほか ${otherCount} 個のコンポーネントで` : " で"} ${count} か所使われています。削除すると、使われているところからも消え、つながっている線も消えます。元に戻せません。`, }, errors: { read: (fileName) => `${fileName} を読み込めませんでした。`, @@ -120,7 +120,7 @@ export const ja: Messages = { tutorial: { lead: [ "最初の課題から順に回路を組み立てていき、最後にストップウォッチを完成させます。", - "前の課題で作った回路が必要な課題では、その回路が完成した部品として渡されるので、どの課題からでも始められます。", + "前の課題で作った回路が必要な課題では、その回路が完成したコンポーネントとして渡されるので、どの課題からでも始められます。", ], stageNumber: (number) => `課題 ${number}`, cleared: "クリア", @@ -133,7 +133,6 @@ export const ja: Messages = { }, startOverFailed: "チュートリアルをやり直せませんでした。", stages: "課題の一覧", - parts: "部品", goalHeading: "目標", stepsHeading: "手順", digitsLegend: "課題の回路の表では、ON を 1、OFF を 0 と書いています。", @@ -170,9 +169,9 @@ export const ja: Messages = { "スイッチ {A} と {B} が両方 [ON] のときだけ、ランプ {Out} が [ON] になるようにしましょう。下の表のとおりに動けばクリアです。", ], steps: [ - "「部品」の一覧から部品を選び、右のエディタにドラッグして置きます。", - "部品の端にある小さな四角を「ピン」といいます。左側のピンは [ON] か [OFF] を受け取る「入力」、右側のピンは [ON] か [OFF] を送り出す「出力」です。出力のピンと入力のピンのあいだをドラッグして、線でつなぎます。", - "{Out} と、置いた部品の入力のピンがすべてつながると、右下の再生ボタンが押せるようになります。入力のピンが空いている部品が残っていると押せません。", + "「コンポーネント」の一覧からコンポーネントを1つ選び、右のエディタにドラッグして置きます。", + "コンポーネントの端にある小さな四角を「ピン」といいます。左側のピンは [ON] か [OFF] を受け取る「入力」、右側のピンは [ON] か [OFF] を送り出す「出力」です。出力のピンと入力のピンのあいだをドラッグして、線でつなぎます。", + "{Out} と、置いたコンポーネントの入力のピンがすべてつながると、右下の再生ボタンが押せるようになります。入力のピンが空いているコンポーネントが残っていると押せません。", "再生ボタンを押したら、スイッチ {A} と {B} をクリックして [ON] と [OFF] を切り替え、ランプ {Out} を見ます。回路を直すときは、同じ場所の鉛筆のボタンで編集に戻ります。", "表のとおりに動いたら、を押します。", ], @@ -180,14 +179,14 @@ export const ja: Messages = { "a-only": { title: "A だけ ON で ON", goal: [ - "スイッチ {A} が [ON] で、{B} が [OFF] のときだけ、ランプ {Out} が [ON] になるようにしましょう。今度は、部品を1つ置くだけではできません。", + "スイッチ {A} が [ON] で、{B} が [OFF] のときだけ、ランプ {Out} が [ON] になるようにしましょう。今度は、コンポーネントを1つ置くだけではできません。", ], steps: [], }, xor: { title: "片方だけ ON で ON", goal: [ - "スイッチ {A} と {B} のどちらか片方だけが [ON] のときに、ランプ {Out} が [ON] になるようにしましょう。両方 [ON] のときは [OFF] です。「{A だけ ON で ON}」を部品として使えます。", + "スイッチ {A} と {B} のどちらか片方だけが [ON] のときに、ランプ {Out} が [ON] になるようにしましょう。両方 [ON] のときは [OFF] です。「{A だけ ON で ON}」をコンポーネントとして使えます。", ], steps: [], }, @@ -202,7 +201,7 @@ export const ja: Messages = { "full-adder": { title: "桁上がりつきの足し算", goal: [ - "{A}+{B}+{Cin} の答えを、2桁の2進数で {C} と {S} に出しましょう。{Cin} は、下の桁から来る桁上がりです。答えは 0 から 3 で、3 は2進数で [11] です。「{1桁の足し算}」を部品として使えます。1つで {A} と {B} を足し、もう1つでその {S} と {Cin} を足します。この回路を「全加算器」といいます。", + "{A}+{B}+{Cin} の答えを、2桁の2進数で {C} と {S} に出しましょう。{Cin} は、下の桁から来る桁上がりです。答えは 0 から 3 で、3 は2進数で [11] です。「{1桁の足し算}」をコンポーネントとして使えます。1つで {A} と {B} を足し、もう1つでその {S} と {Cin} を足します。この回路を「全加算器」といいます。", ], steps: [], }, @@ -255,8 +254,8 @@ export const ja: Messages = { ], steps: [ "「{0〜5 のカウンタ}」を2つと、「{0〜9 のカウンタ}」を2つ置きます。「{0〜5 のカウンタ}」は「{0〜9 のカウンタ}」と同じつくりで、9 の次ではなく 5 の次で 0 に戻り、上の桁に桁上がりを知らせます。", - "置いた4つの部品を、{M10}・{M1}・{S10}・{S1} に1つずつ割り当てます。{M10} と {S10} には「{0〜5 のカウンタ}」を、{M1} と {S1} には「{0〜9 のカウンタ}」を使います。それぞれの {Count} を、割り当てた桁と同じ名前の右の出力と、その桁の {7seg} につなぎます。{7seg} は、上から {M10}・{M1}・{S10}・{S1} 用です。", - "{S1} につないだ部品の {Up} に {Start} をつなぎます。次に、{S1} の部品の {Carry} を {S10} の部品の {Up} に、{S10} の {Carry} を {M1} の {Up} に、{M1} の {Carry} を {M10} の {Up} につなぎます。こうすると、1つ下の桁が 0 に戻るときだけ、その上の桁が進みます。", + "置いた4つのコンポーネントを、{M10}・{M1}・{S10}・{S1} に1つずつ割り当てます。{M10} と {S10} には「{0〜5 のカウンタ}」を、{M1} と {S1} には「{0〜9 のカウンタ}」を使います。それぞれの {Count} を、割り当てた桁と同じ名前の右の出力と、その桁の {7seg} につなぎます。{7seg} は、上から {M10}・{M1}・{S10}・{S1} 用です。", + "{S1} につないだコンポーネントの {Up} に {Start} をつなぎます。次に、{S1} のコンポーネントの {Carry} を {S10} のコンポーネントの {Up} に、{S10} の {Carry} を {M1} の {Up} に、{M1} の {Carry} を {M10} の {Up} につなぎます。こうすると、1つ下の桁が 0 に戻るときだけ、その上の桁が進みます。", "再生ボタンを押します。最初のステップで {Start} が [OFF] なら、クリックして [ON] にします。を押すと、1秒に1ステップずつ、{Display} が時計のように進みます。59:59 の次を見るには、を止めて下の数字をクリックし、3600 と入れてキーを押します。そのステップまで一度に進んで 59:59 になり、右の矢印を押すと 00:00 に戻ります。", ], }, @@ -313,7 +312,7 @@ export const ja: Messages = { }, connectionRejection: { sameDirection: "入力ピン同士、出力ピン同士はつなげません", - sameNode: "同じノードのピン同士はつなげません", + sameNode: "置いた1つのコンポーネントのピン同士はつなげません", differentParentComponent: "別のコンポーネントに置かれたピン同士はつなげません", inputAlreadyConnected: "この入力ピンにはすでに線がつながっています", @@ -332,9 +331,9 @@ export const ja: Messages = { interfaceNode: (type, pin) => `${type === "input" ? "入力" : "出力"} ${pin}`, sentences: (sentences) => sentences.join(""), - loop: "赤い枠の部品は、自分の出力が線をたどって自分の入力に戻ってきます。出力を決めるのにその出力自身が必要になるので、このままでは動きません。線をつなぎ直すか、その途中に FlipFlop を入れてください。", + loop: "赤い枠のコンポーネントは、自分の出力が線をたどって自分の入力に戻ってきます。出力を決めるのにその出力自身が必要になるので、このままでは動きません。線をつなぎ直すか、その途中に FlipFlop を入れてください。", loopInside: (place, component) => - `${place} の中に、自分の出力が線をたどって自分の入力に戻ってくる部品があります。出力を決めるのにその出力自身が必要になるので、このままでは動きません。${component} を開いて線をつなぎ直すか、その途中に FlipFlop を入れてください。`, + `${place} の中に、自分の出力が線をたどって自分の入力に戻ってくるコンポーネントがあります。出力を決めるのにその出力自身が必要になるので、このままでは動きません。${component} を開いて線をつなぎ直すか、その途中に FlipFlop を入れてください。`, unconnectedPin: (pin, node) => `${node} の ${pin} のピンがつながっていません。`, unconnectedNode: (node) => `${node} がつながっていません。`, diff --git a/src/pages/edit/Editor/store/slices/core/index.test.ts b/src/pages/edit/Editor/store/slices/core/index.test.ts index 86e6628..7112cfd 100644 --- a/src/pages/edit/Editor/store/slices/core/index.test.ts +++ b/src/pages/edit/Editor/store/slices/core/index.test.ts @@ -187,10 +187,10 @@ describe("simulation errors", () => { const { editorMode, simulationError } = editorStore.getState(); expect(editorMode).toBe("edit"); expect(simulationError?.messageByLanguage.en).toMatch( - /^The output of each part outlined in red/, + /^The output of each component outlined in red/, ); expect(simulationError?.messageByLanguage.ja).toMatch( - /^赤い枠の部品は、自分の出力が/, + /^赤い枠のコンポーネントは、自分の出力が/, ); expect(simulationError?.nodeIds).toEqual(new Set([first.id, second.id])); }); diff --git a/src/pages/home/componentDeletion.test.ts b/src/pages/home/componentDeletion.test.ts index 169f3c0..222c024 100644 --- a/src/pages/home/componentDeletion.test.ts +++ b/src/pages/home/componentDeletion.test.ts @@ -18,7 +18,7 @@ describe("describeComponentDeletion", () => { ); }); - it("tells where the component is used, as its nodes are removed too", () => { + it("tells where the component is used, as it is removed from there too", () => { const store = createTestStore(); const adder = registerTestComponent(store, "Adder"); const alu = registerTestComponent(store, "ALU"); @@ -28,7 +28,7 @@ describe("describeComponentDeletion", () => { registerTestNode(store, cpu.id, adder.id); expect(describeComponentDeletion(store, adder.id, en)).toBe( - "It is used 3 times in ALU, CPU. Deleting it also removes those nodes and their connections. This cannot be undone.", + "It is used 3 times in ALU, CPU. Deleting it also removes it from those places, with its connections. This cannot be undone.", ); }); @@ -52,7 +52,7 @@ describe("describeComponentDeletion", () => { registerTestNode(store, alu.id, adder.id); expect(describeComponentDeletion(store, adder.id, ja)).toBe( - "ALU で 1 か所使われています。削除すると、それらのノードと、つながっている線も消えます。元に戻せません。", + "ALU で 1 か所使われています。削除すると、使われているところからも消え、つながっている線も消えます。元に戻せません。", ); }); @@ -65,7 +65,7 @@ describe("describeComponentDeletion", () => { } expect(describeComponentDeletion(store, adder.id, en)).toBe( - "It is used 5 times in A, B, C and 2 other components. Deleting it also removes those nodes and their connections. This cannot be undone.", + "It is used 5 times in A, B, C and 2 other components. Deleting it also removes it from those places, with its connections. This cannot be undone.", ); expect(describeComponentDeletion(store, adder.id, ja)).toMatch( /^A、B、C ほか 2 個のコンポーネントで 5 か所使われています。/, diff --git a/src/pages/tutorial/stage.tsx b/src/pages/tutorial/stage.tsx index faa1058..8b7ad9e 100644 --- a/src/pages/tutorial/stage.tsx +++ b/src/pages/tutorial/stage.tsx @@ -359,7 +359,7 @@ function StageView({ stage }: { stage: TutorialStage }) { color="textSecondary" variant="body2" > - {texts.parts} + {messages.common.components} { SimulationCombinationalLoopError, ); expect(error.message).toBe( - "The output of each part outlined in red comes back to its own input along the wires. Working out its output needs that same output, so the circuit cannot run as it is. Reconnect a wire, or put a FlipFlop somewhere along the way.", + "The output of each component outlined in red comes back to its own input along the wires. Working out its output needs that same output, so the circuit cannot run as it is. Reconnect a wire, or put a FlipFlop somewhere along the way.", ); expect(new Set(error.nodePaths.map((path) => path[0]))).toEqual( new Set([first.id, second.id]), @@ -325,7 +325,7 @@ describe("simulateComponent", () => { SimulationCombinationalLoopError, ); expect(error.message).toBe( - "The output of each part outlined in red comes back to its own input along the wires. Working out its output needs that same output, so the circuit cannot run as it is. Reconnect a wire, or put a FlipFlop somewhere along the way.", + "The output of each component outlined in red comes back to its own input along the wires. Working out its output needs that same output, so the circuit cannot run as it is. Reconnect a wire, or put a FlipFlop somewhere along the way.", ); expect(new Set(error.nodePaths.map((path) => path[0]))).toEqual( new Set([first.id, second.id]), @@ -357,7 +357,7 @@ describe("simulateComponent", () => { SimulationCombinationalLoopError, ); expect(error.message).toBe( - "Inside Ring, the output of some parts comes back to their own input along the wires. Working out their output needs that same output, so the circuit cannot run as it is. Open Ring to reconnect a wire, or put a FlipFlop somewhere along the way.", + "Inside Ring, the output of some components comes back to their own input along the wires. Working out their output needs that same output, so the circuit cannot run as it is. Open Ring to reconnect a wire, or put a FlipFlop somewhere along the way.", ); expect(new Set(error.nodePaths.map((path) => path[0]))).toEqual( new Set([ringNode.id]), @@ -434,7 +434,9 @@ describe("simulateComponent", () => { () => simulateComponent(store, root.id, new Map()), SimulationCombinationalLoopError, ); - expect(error.message).toMatch(/^The output of each part outlined in red/); + expect(error.message).toMatch( + /^The output of each component outlined in red/, + ); expect(new Set(error.nodePaths.map((path) => path[0]))).toEqual( new Set([chainNode.id, bufferNode.id]), ); diff --git a/src/store/simulationErrorTexts.ts b/src/store/simulationErrorTexts.ts index 99b5ef0..0b3e7e8 100644 --- a/src/store/simulationErrorTexts.ts +++ b/src/store/simulationErrorTexts.ts @@ -18,9 +18,9 @@ export const englishSimulationErrorTexts: SimulationErrorTexts = { interfaceNode: (type, pin) => `${type === "input" ? "Input" : "Output"} ${pin}`, sentences: (sentences) => sentences.join(" "), - loop: "The output of each part outlined in red comes back to its own input along the wires. Working out its output needs that same output, so the circuit cannot run as it is. Reconnect a wire, or put a FlipFlop somewhere along the way.", + loop: "The output of each component outlined in red comes back to its own input along the wires. Working out its output needs that same output, so the circuit cannot run as it is. Reconnect a wire, or put a FlipFlop somewhere along the way.", loopInside: (place, component) => - `Inside ${place}, the output of some parts comes back to their own input along the wires. Working out their output needs that same output, so the circuit cannot run as it is. Open ${component} to reconnect a wire, or put a FlipFlop somewhere along the way.`, + `Inside ${place}, the output of some components comes back to their own input along the wires. Working out their output needs that same output, so the circuit cannot run as it is. Open ${component} to reconnect a wire, or put a FlipFlop somewhere along the way.`, unconnectedPin: (pin, node) => `Pin ${pin} of ${node} is not connected.`, unconnectedNode: (node) => `${node} is not connected.`, openToConnect: (component) => `Open ${component} to connect it.`, From f34f1dc44a742235cfd2b67c1d7229e2b21269e1 Mon Sep 17 00:00:00 2001 From: Rn86222 Date: Sat, 21 Nov 2026 03:04:07 +0900 Subject: [PATCH 2/4] fix: say where an Input or Output is placed, what a refused connection did, and what a component is Co-Authored-By: Claude Opus 5.5 --- src/i18n/en.ts | 10 +++++----- src/i18n/ja.ts | 13 +++++++------ src/pages/home/componentDeletion.test.ts | 6 +++--- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/i18n/en.ts b/src/i18n/en.ts index 5a5ba10..c010544 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -25,7 +25,7 @@ const stageTexts: Record = { "Make the lamp {Out} turn [ON] only when both switches {A} and {B} are [ON]. The stage is cleared when the circuit works as in the table below.", ], steps: [ - "Pick a component in the Components list and drag it onto the editor on the right.", + "The pieces a circuit is built from are called components. Pick one in the Components list and drag it onto the editor on the right.", "The small squares on the edges of a component are its pins. A pin on the left side is an input, which receives [ON] or [OFF], and a pin on the right side is an output, which sends [ON] or [OFF]. Drag between an output pin and an input pin to connect them with a wire.", "Once {Out} and every input pin of the components you placed are connected, the play button at the bottom right can be pressed. It cannot be pressed while a component has a free input pin.", "After pressing the play button , click the switches {A} and {B} to turn them [ON] and [OFF], and watch the lamp {Out}. To fix the circuit, the pencil button in the same place takes you back to editing.", @@ -150,9 +150,9 @@ export const en = { DISPLAY: "While playing, shows the value of {Pixels} as a picture, one bit per pixel ([1] is black, [0] is white). From the highest digit, the pixels go from the top left row by row in row-major order, or column by column in column-major order. While editing, the gear button sets the resolution and the pixel order.", INPUT: - "Adds an input to the component it is placed in. Where that component is placed, the input is a pin on its left. While playing, its value can be changed on the placed {Input}.", + "Adds an input to the component it is placed in. Where that component is placed in another one, the input is a pin on its left. While playing, its value can be changed on the placed {Input}.", OUTPUT: - "Adds an output to the component it is placed in. Where that component is placed, the output is a pin on its right. While playing, it shows the value it receives.", + "Adds an output to the component it is placed in. Where that component is placed in another one, the output is a pin on its right. While playing, it shows the value it receives.", } satisfies Record, pinBitWidth: (pinName: string, canAddPins: boolean) => canAddPins @@ -203,7 +203,7 @@ export const en = { title: (componentName: string) => `Delete ${componentName}?`, unused: "This cannot be undone.", used: (count: number, places: readonly string[], otherCount: number) => - `It is used ${count === 1 ? "once" : `${count} times`} in ${places.join(", ")}${otherCount > 0 ? ` and ${otherCount} other ${otherCount === 1 ? "component" : "components"}` : ""}. Deleting it also removes it from those places, with its connections. This cannot be undone.`, + `It is used ${count === 1 ? "once" : `${count} times`} in ${places.join(", ")}${otherCount > 0 ? ` and ${otherCount} other ${otherCount === 1 ? "component" : "components"}` : ""}. Deleting it also removes it from those components, along with the wires connected to it. This cannot be undone.`, }, errors: { read: (fileName: string) => `Could not read ${fileName}.`, @@ -350,7 +350,7 @@ export const en = { }, connectionRejection: { sameDirection: "Cannot connect two input pins or two output pins", - sameNode: "Cannot connect two pins of one placed component", + sameNode: "Cannot connect a component's output to its own input", differentParentComponent: "Cannot connect pins placed in different components", inputAlreadyConnected: "This input pin is already connected", diff --git a/src/i18n/ja.ts b/src/i18n/ja.ts index 0b18a45..27dc9bc 100644 --- a/src/i18n/ja.ts +++ b/src/i18n/ja.ts @@ -32,9 +32,9 @@ export const ja: Messages = { DISPLAY: "再生中、{Pixels} の値を、1ビットを1ピクセルとして絵にする([1] は黒、[0] は白)。上の桁から順に、行優先なら左上から横に1行ずつ、列優先なら縦に1列ずつ並ぶ。解像度とピクセルの並び順は、編集中に歯車のボタンで変えられる。", INPUT: - "置いた先のコンポーネントに、入力を1つ足す。そのコンポーネントを置くと、入力は左側のピンになる。再生中は、置いた {Input} の上で値を変えられる。", + "置いた先のコンポーネントに、入力を1つ足す。そのコンポーネントをほかのコンポーネントの中に置くと、入力は左側のピンになる。再生中は、置いた {Input} の上で値を変えられる。", OUTPUT: - "置いた先のコンポーネントに、出力を1つ足す。そのコンポーネントを置くと、出力は右側のピンになる。再生中は、受け取った値を見せる。", + "置いた先のコンポーネントに、出力を1つ足す。そのコンポーネントをほかのコンポーネントの中に置くと、出力は右側のピンになる。再生中は、受け取った値を見せる。", }, pinBitWidth: (pinName, canAddPins) => canAddPins @@ -70,7 +70,7 @@ export const ja: Messages = { reset: "リセット", selectToEdit: "編集するコンポーネントを選んでください。", create: "作成", - nodeCount: (count) => `${count} 個のコンポーネントを使用`, + nodeCount: (count) => `コンポーネントを ${count} 個使用`, componentMenu: "コンポーネントのメニュー", resetDialog: { title: "すべてのコンポーネントをリセットしますか?", @@ -84,7 +84,7 @@ export const ja: Messages = { title: (componentName) => `${componentName} を削除しますか?`, unused: "元に戻せません。", used: (count, places, otherCount) => - `${places.join("、")}${otherCount > 0 ? ` ほか ${otherCount} 個のコンポーネントで` : " で"} ${count} か所使われています。削除すると、使われているところからも消え、つながっている線も消えます。元に戻せません。`, + `${places.join("、")}${otherCount > 0 ? ` ほか ${otherCount} 個のコンポーネントで` : " で"} ${count} か所使われています。削除すると、使われているところから、つながっている線ごと消えます。元に戻せません。`, }, errors: { read: (fileName) => `${fileName} を読み込めませんでした。`, @@ -169,7 +169,7 @@ export const ja: Messages = { "スイッチ {A} と {B} が両方 [ON] のときだけ、ランプ {Out} が [ON] になるようにしましょう。下の表のとおりに動けばクリアです。", ], steps: [ - "「コンポーネント」の一覧からコンポーネントを1つ選び、右のエディタにドラッグして置きます。", + "回路を組み立てる部品を「コンポーネント」といいます。「コンポーネント」の一覧から1つ選び、右のエディタにドラッグして置きます。", "コンポーネントの端にある小さな四角を「ピン」といいます。左側のピンは [ON] か [OFF] を受け取る「入力」、右側のピンは [ON] か [OFF] を送り出す「出力」です。出力のピンと入力のピンのあいだをドラッグして、線でつなぎます。", "{Out} と、置いたコンポーネントの入力のピンがすべてつながると、右下の再生ボタンが押せるようになります。入力のピンが空いているコンポーネントが残っていると押せません。", "再生ボタンを押したら、スイッチ {A} と {B} をクリックして [ON] と [OFF] を切り替え、ランプ {Out} を見ます。回路を直すときは、同じ場所の鉛筆のボタンで編集に戻ります。", @@ -312,7 +312,8 @@ export const ja: Messages = { }, connectionRejection: { sameDirection: "入力ピン同士、出力ピン同士はつなげません", - sameNode: "置いた1つのコンポーネントのピン同士はつなげません", + sameNode: + "コンポーネントの出力を、そのコンポーネント自身の入力にはつなげません", differentParentComponent: "別のコンポーネントに置かれたピン同士はつなげません", inputAlreadyConnected: "この入力ピンにはすでに線がつながっています", diff --git a/src/pages/home/componentDeletion.test.ts b/src/pages/home/componentDeletion.test.ts index 222c024..3e40255 100644 --- a/src/pages/home/componentDeletion.test.ts +++ b/src/pages/home/componentDeletion.test.ts @@ -28,7 +28,7 @@ describe("describeComponentDeletion", () => { registerTestNode(store, cpu.id, adder.id); expect(describeComponentDeletion(store, adder.id, en)).toBe( - "It is used 3 times in ALU, CPU. Deleting it also removes it from those places, with its connections. This cannot be undone.", + "It is used 3 times in ALU, CPU. Deleting it also removes it from those components, along with the wires connected to it. This cannot be undone.", ); }); @@ -52,7 +52,7 @@ describe("describeComponentDeletion", () => { registerTestNode(store, alu.id, adder.id); expect(describeComponentDeletion(store, adder.id, ja)).toBe( - "ALU で 1 か所使われています。削除すると、使われているところからも消え、つながっている線も消えます。元に戻せません。", + "ALU で 1 か所使われています。削除すると、使われているところから、つながっている線ごと消えます。元に戻せません。", ); }); @@ -65,7 +65,7 @@ describe("describeComponentDeletion", () => { } expect(describeComponentDeletion(store, adder.id, en)).toBe( - "It is used 5 times in A, B, C and 2 other components. Deleting it also removes it from those places, with its connections. This cannot be undone.", + "It is used 5 times in A, B, C and 2 other components. Deleting it also removes it from those components, along with the wires connected to it. This cannot be undone.", ); expect(describeComponentDeletion(store, adder.id, ja)).toMatch( /^A、B、C ほか 2 個のコンポーネントで 5 か所使われています。/, From d4d24a7719ab0b81724a5ce2b3bc8e23a0c16a78 Mon Sep 17 00:00:00 2001 From: Rn86222 Date: Sat, 21 Nov 2026 03:04:21 +0900 Subject: [PATCH 3/4] fix: join the places a component is used with "and" in English Co-Authored-By: Claude Opus 5.5 --- src/i18n/en.ts | 2 +- src/pages/home/componentDeletion.test.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/i18n/en.ts b/src/i18n/en.ts index c010544..cc78da1 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -203,7 +203,7 @@ export const en = { title: (componentName: string) => `Delete ${componentName}?`, unused: "This cannot be undone.", used: (count: number, places: readonly string[], otherCount: number) => - `It is used ${count === 1 ? "once" : `${count} times`} in ${places.join(", ")}${otherCount > 0 ? ` and ${otherCount} other ${otherCount === 1 ? "component" : "components"}` : ""}. Deleting it also removes it from those components, along with the wires connected to it. This cannot be undone.`, + `It is used ${count === 1 ? "once" : `${count} times`} in ${otherCount > 0 ? `${places.join(", ")} and ${otherCount} other ${otherCount === 1 ? "component" : "components"}` : listOf(places)}. Deleting it also removes it from those components, along with the wires connected to it. This cannot be undone.`, }, errors: { read: (fileName: string) => `Could not read ${fileName}.`, diff --git a/src/pages/home/componentDeletion.test.ts b/src/pages/home/componentDeletion.test.ts index 3e40255..04743cc 100644 --- a/src/pages/home/componentDeletion.test.ts +++ b/src/pages/home/componentDeletion.test.ts @@ -28,7 +28,7 @@ describe("describeComponentDeletion", () => { registerTestNode(store, cpu.id, adder.id); expect(describeComponentDeletion(store, adder.id, en)).toBe( - "It is used 3 times in ALU, CPU. Deleting it also removes it from those components, along with the wires connected to it. This cannot be undone.", + "It is used 3 times in ALU and CPU. Deleting it also removes it from those components, along with the wires connected to it. This cannot be undone.", ); }); @@ -41,7 +41,7 @@ describe("describeComponentDeletion", () => { registerTestNode(store, second.id, adder.id); expect(describeComponentDeletion(store, adder.id, en)).toMatch( - /^It is used 2 times in ALU, ALU\./, + /^It is used 2 times in ALU and ALU\./, ); }); From 7f7ce4331c1d03cd4c1aadaadce558edb71d831d Mon Sep 17 00:00:00 2001 From: Rn86222 Date: Sat, 21 Nov 2026 03:24:44 +0900 Subject: [PATCH 4/4] fix: keep the free mode list's node count as it was, to be reconsidered later Co-Authored-By: Claude Opus 5.5 --- src/i18n/en.ts | 3 +-- src/i18n/ja.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/i18n/en.ts b/src/i18n/en.ts index cc78da1..8d7d181 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -188,8 +188,7 @@ export const en = { reset: "Reset", selectToEdit: "Select a component to start editing.", create: "Create", - nodeCount: (count: number) => - `Uses ${count} ${count === 1 ? "component" : "components"}`, + nodeCount: (count: number) => `${count} ${count === 1 ? "node" : "nodes"}`, componentMenu: "Component menu", resetDialog: { title: "Reset all components?", diff --git a/src/i18n/ja.ts b/src/i18n/ja.ts index 27dc9bc..1babba6 100644 --- a/src/i18n/ja.ts +++ b/src/i18n/ja.ts @@ -70,7 +70,7 @@ export const ja: Messages = { reset: "リセット", selectToEdit: "編集するコンポーネントを選んでください。", create: "作成", - nodeCount: (count) => `コンポーネントを ${count} 個使用`, + nodeCount: (count) => `${count} 個のノード`, componentMenu: "コンポーネントのメニュー", resetDialog: { title: "すべてのコンポーネントをリセットしますか?",