CH-J Server Managerserverio valdymas per SSH
Meniu
Paskelbtas šaltinis

CH-J Server Manager

Naršyti aplankus ir failus konkrečiai programai išleisti.

Atsisiųsti šaltinį ZIP
CH-J / Server Manager 339 failai
core-20261014T184258Z-3fbed0b93fdf Pridėta: Data neregistruota · Pastatytas:
Failai
hashI18n.test.js Pridėta: Data neregistruota 2,5 KB · 42 eilutės
Atsiųsti failą
1"use strict";
3const test = require("node:test");
4const assert = require("node:assert/strict");
5const fs = require("node:fs");
6const path = require("node:path");
7const { catalogs, createI18n } = require("../src/main/firstPartyPlugins/chj.hash-checksum/0.0.1/ui/i18n");
8const { ALGORITHMS } = require("../src/main/hashing/hashAlgorithms");
10const uiRoot = path.join(__dirname, "../src/main/firstPartyPlugins/chj.hash-checksum/0.0.1/ui");
12test("hash translations cover all UI phrases, algorithm categories, and result states in CS/DE/EN", () => {
13 const keys = Object.keys(catalogs.en).sort();
14 for (const language of ["cs", "de", "en"]) {
15 assert.deepEqual(Object.keys(catalogs[language]).sort(), keys);
16 for (const key of keys) assert.ok(catalogs[language][key].trim(), `${language}: ${key}`);
17 for (const algorithm of ALGORITHMS) assert.ok(catalogs[language][`category.${algorithm.category}`]);
18 for (const status of ["queued", "running", "completed", "failed", "cancelled", "COMPLETED", "MATCH", "MISMATCH", "ERROR", "MISSING", "INVALID ENTRY"]) assert.ok(catalogs[language][status]);
19 }
20 const html = fs.readFileSync(path.join(uiRoot, "index.html"), "utf8");
21 const script = fs.readFileSync(path.join(uiRoot, "index.js"), "utf8");
22 const usedKeys = [
23 ...[...html.matchAll(/data-i18n(?:-aria-label)?="([^"]+)"/g)].map((match) => match[1].replaceAll("&", "&")),
24 ...[...script.matchAll(/\bt\("([^"]+)"/g)].map((match) => match[1])
25 ];
26 for (const key of usedKeys) assert.ok(Object.hasOwn(catalogs.en, key), `Missing hash phrase: ${key}`);
27});
29test("hash language changes translate interpolation, IPC errors, and states", () => {
30 const i18n = createI18n("cs-CZ");
31 assert.equal(i18n.t("{count} file(s) completed", { count: 2 }), "Dokončeno souborů: 2");
32 assert.equal(i18n.t("MATCH"), "SHODA");
33 assert.equal(i18n.errorMessage(new Error("Error invoking remote method 'plugin:hashing:start': Error: HASH_INVALID_KEY: Invalid key")), catalogs.cs.HASH_INVALID_KEY);
34 i18n.setLanguage("de-DE");
35 assert.equal(i18n.t("COMPLETED"), "ABGESCHLOSSEN");
36 assert.equal(i18n.t("HEX key ({bytes} bytes; zero key if blank)", { bytes: 32 }), "HEX-Schlüssel (32 Bytes; leer = Nullschlüssel)");
37 assert.equal(i18n.errorMessage({ code: "ENOENT", message: "not found" }), catalogs.de.ENOENT);
38 i18n.setLanguage("en");
39 assert.equal(i18n.errorMessage({ code: "HASH_INVALID_KEY", message: "Invalid key" }), "Invalid key");
40 assert.equal(i18n.setLanguage("__proto__"), "en");
41 assert.equal(i18n.t("Unknown phrase"), "Unknown phrase");
42});
SHA-256d1b1c73b054153379f9706d053818963a7005a15e214ca788e8114cf9cb54af2

CH-J Proprietary Software License 1.14 · Šaltinis pateiktas pagal CH-J Proprietary Software License 1.14. Jo prieinamumas nekeičia licencijos sąlygų ir nesuteikia papildomų teisių.

Archyvas SHA-2563df08cf5e899262a6ce92d7ec2caf5c42b683f1f2b57055662b845ff7dde67a8