diff --git a/input/Manoonchai.json b/input/Manoonchai.json index 02a6f64..4c17625 100644 --- a/input/Manoonchai.json +++ b/input/Manoonchai.json @@ -6,6 +6,7 @@ "license": "MIT", "os": { "windows": { + "installerName": "ThaiMnc", "company": "Manoonchai", "localeId": "0000041e" } diff --git a/main.ts b/main.ts index 8dd1df5..1fb78b3 100644 --- a/main.ts +++ b/main.ts @@ -105,7 +105,7 @@ export async function generateKlc( } const lines = [ - `KBD\t${layout.name}\t"${layout.language} ${layout.name} v${layout.version}"`, + `KBD\t${layout.os.windows.installerName}\t"${layout.language} ${layout.name} v${layout.version}"`, `COPYRIGHT\t"MIT"`, `COMPANY\t"${layout.os.windows.company}"`, `LOCALENAME\t"${klcLocales[layout.language]}"`, @@ -132,12 +132,13 @@ export async function generateKlc( fs.writeFileSync( "./output/test.klc", - [ - lines.join("\r\n\r\n"), - shiftStateLines.join("\r\n"), - layoutLines.join("\r\n"), - "ENDKBD", - ].join("\r\n\r\n"), + "\ufeff" + + [ + lines.join("\r\n\r\n"), + shiftStateLines.join("\r\n"), + layoutLines.join("\r\n"), + "ENDKBD", + ].join("\r\n\r\n"), { encoding: "utf16le", } @@ -434,5 +435,5 @@ export class Layout { } interface OSAttributes { - windows: { company: string; localeId: string } + windows: { company: string; localeId: string; installerName: string } } diff --git a/output/test.klc b/output/test.klc index 3810314..7a0a642 100644 Binary files a/output/test.klc and b/output/test.klc differ diff --git a/test/main.test.ts b/test/main.test.ts index 5d661cb..bb42eb5 100644 --- a/test/main.test.ts +++ b/test/main.test.ts @@ -433,7 +433,7 @@ describe("generateKlc", () => { .filter(Boolean) // Assert file headers - expect(lines[0]).toEqual(`KBD\tManoonchai\t"Thai Manoonchai v1.0"`) + expect(lines[0]).toEqual(`\ufeffKBD\tThaiMnc\t"Thai Manoonchai v1.0"`) expect(lines[1]).toEqual(`COPYRIGHT\t"MIT"`) expect(lines[2]).toEqual(`COMPANY\t"Manoonchai"`) expect(lines[3]).toEqual(`LOCALENAME\t"th-TH"`)