Skip to content

Commit dead45f

Browse files
committed
Expand locale encoding diagnostics
1 parent 52289f4 commit dead45f

4 files changed

Lines changed: 74 additions & 4 deletions

File tree

data/error-recipes.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,26 @@
102102
"乱码",
103103
"mojibake",
104104
"locale",
105+
"shift[-_ ]?jis",
106+
"\\bsjis\\b",
107+
"\\bcp932\\b",
108+
"code page 932",
109+
"language for non-unicode programs",
110+
"ms gothic",
111+
"ms ui gothic",
112+
"ms pgothic",
113+
"MS ?ゴシック",
105114
"\\?{4,}",
106115
"\\uFFFD",
107116
"区域设置",
108117
"日区"
109118
],
110-
"cause": "脚本、文件名或字体可能按日文系统区域保存,非日区环境下会乱码、找不到文件或直接闪退。",
111-
"action": "尝试日区环境或 Locale Emulator,并把游戏移动到英文短路径。",
119+
"cause": "脚本、文件名或字体可能按日文系统区域保存,尤其是 Shift-JIS/CP932、MS Gothic/MS UI Gothic 一类旧日文环境线索。非日区环境下会乱码、找不到文件或直接闪退。",
120+
"action": "尝试日区环境或 Locale Emulator,并把游戏移动到英文短路径;如果报错点名字体,确认系统有可用日文字体",
112121
"checklist": [
113122
"移动到 C:/Games/VNName",
114123
"使用日区环境或 Locale Emulator",
124+
"确认 Shift-JIS/CP932 文件名没有在解压时变成乱码",
115125
"安装日文字体"
116126
]
117127
},

docs/ERROR_RECIPES.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,25 @@ Keep DirectPlay separate from the DirectX 9-era runtime route because the beginn
9292

9393
The recommended action should point to Windows Features: enable `Legacy Components / DirectPlay`, then retry from GalAid's recommended launcher.
9494

95+
## Locale Encoding Evidence
96+
97+
The `locale-encoding` recipe should catch concrete Japanese locale, Shift-JIS/CP932, and old Japanese font clues without treating every generic font or path issue as locale-related.
98+
99+
Good locale clues:
100+
101+
- `文字化け`
102+
- `mojibake`
103+
- `Shift-JIS`
104+
- `SJIS`
105+
- `CP932`
106+
- `code page 932`
107+
- `Language for non-Unicode programs`
108+
- `MS Gothic`
109+
- `MS UI Gothic`
110+
- `MS ゴシック`
111+
112+
Avoid broad positives such as plain `font`, `path`, or `unicode` unless the surrounding text clearly names the Japanese locale/code page issue.
113+
95114
## Flash And Borland Legacy Evidence
96115

97116
Keep Flash/ActiveX and Borland/Delphi rules narrow. They should explain old launcher/config-tool failures without implying every game needs these components.

src/error-recipes.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,26 @@ window.GALAID_ERROR_RECIPES = [
104104
"乱码",
105105
"mojibake",
106106
"locale",
107+
"shift[-_ ]?jis",
108+
"\\bsjis\\b",
109+
"\\bcp932\\b",
110+
"code page 932",
111+
"language for non-unicode programs",
112+
"ms gothic",
113+
"ms ui gothic",
114+
"ms pgothic",
115+
"MS ?ゴシック",
107116
"\\?{4,}",
108117
"\\uFFFD",
109118
"区域设置",
110119
"日区"
111120
],
112-
"cause": "脚本、文件名或字体可能按日文系统区域保存,非日区环境下会乱码、找不到文件或直接闪退。",
113-
"action": "尝试日区环境或 Locale Emulator,并把游戏移动到英文短路径。",
121+
"cause": "脚本、文件名或字体可能按日文系统区域保存,尤其是 Shift-JIS/CP932、MS Gothic/MS UI Gothic 一类旧日文环境线索。非日区环境下会乱码、找不到文件或直接闪退。",
122+
"action": "尝试日区环境或 Locale Emulator,并把游戏移动到英文短路径;如果报错点名字体,确认系统有可用日文字体。",
114123
"checklist": [
115124
"移动到 C:/Games/VNName",
116125
"使用日区环境或 Locale Emulator",
126+
"确认 Shift-JIS/CP932 文件名没有在解压时变成乱码",
117127
"安装日文字体"
118128
]
119129
},

tests/galaid-smoke.spec.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,37 @@ test("DirectPlay recipe and import hints route old Windows component guidance",
188188
expect(result.roadmapIds).toContain("error-directplay-legacy");
189189
});
190190

191+
test("locale recipe covers Shift-JIS code page and Japanese font clues", async ({ page }) => {
192+
await page.goto("/");
193+
194+
const result = await page.evaluate(() => {
195+
const examples = [
196+
"Failed to decode Shift-JIS script.",
197+
"SJIS filename conversion failed.",
198+
"CP932 conversion failed.",
199+
"Code page 932 is required.",
200+
"Language for non-Unicode programs is not Japanese.",
201+
"MS Gothic font was not found.",
202+
"MS UI Gothic is missing.",
203+
"MS ゴシック が見つかりません。",
204+
];
205+
206+
return {
207+
positives: examples.map((text) => buildErrorDiagnostics(text).matches.map((match) => match.id)),
208+
genericFont: buildErrorDiagnostics("The font size is too small.").matches.map((match) => match.id),
209+
genericShift: buildErrorDiagnostics("Shift into fullscreen mode before starting.").matches.map((match) => match.id),
210+
genericPage: buildErrorDiagnostics("Page 932 of the manual is missing.").matches.map((match) => match.id),
211+
};
212+
});
213+
214+
for (const matches of result.positives) {
215+
expect(matches).toContain("locale-encoding");
216+
}
217+
expect(result.genericFont).not.toContain("locale-encoding");
218+
expect(result.genericShift).not.toContain("locale-encoding");
219+
expect(result.genericPage).not.toContain("locale-encoding");
220+
});
221+
191222
test("old video component recipe covers DirectShow, MCI, and codec clues", async ({ page }) => {
192223
await page.goto("/");
193224

0 commit comments

Comments
 (0)