WaylandKeybinds: localized info panel with setup steps

- Info panel in the plugin modal: live status with the number of keybinds
  GNOME registered, the three setup steps and a button that opens
  Discord's Keybinds page (closes only the plugin modal, which otherwise
  blocks settings navigation).
- Follows Discord's language: English, Portuguese (pt-BR) and Spanish
  (es-ES and es-419 use each region's action names); bold labels quote
  Discord's own strings.
- Shared helpers moved to discord.ts; copy and locale choice in copy.ts,
  covered by basis-path tests (41 tests).
- README: current settings path (User Settings > System > Keybinds).
This commit is contained in:
Evandro Fonseca Junior committed 2026-11-02 01:24:50 -03:00
1 parent a3a9149184
commit 34b61e2509
7 files changed
+351 -18

No files matched your search

+48
View File
@@ -8,6 +8,7 @@
import assert from "node:assert/strict";
import { describe, test } from "node:test";
import { EN, ES_419, ES_ES, pickCopy, PT } from "./copy";
import { adjustOptions, createDispatcher, ECHO_MS, FIRST_PROBE_MS, fixPortalState, normalizeTrigger, planRegistration, PROBE_WINDOW_MS } from "./logic";
function recorder() {
@@ -241,3 +242,50 @@ describe("fixPortalState (V(G)=5)", () => {
assert.equal(fixPortalState(gnome, "CTRL+ALT+F12"), gnome);
});
});
describe("pickCopy (V(G)=4)", () => {
test("P1 português → PT", () => {
assert.equal(pickCopy("pt-BR"), PT);
});
test("P2 espanhol da América Latina → ES_419", () => {
assert.equal(pickCopy("es-419"), ES_419);
});
test("P3 espanhol da Espanha → ES_ES", () => {
assert.equal(pickCopy("es-ES"), ES_ES);
});
test("P4 inglês → EN", () => {
assert.equal(pickCopy("en-US"), EN);
});
test("borda: idioma fora dos três → EN", () => {
assert.equal(pickCopy("fr"), EN);
assert.equal(pickCopy("ja"), EN);
});
test("borda: idioma vazio → EN", () => {
assert.equal(pickCopy(""), EN);
});
test("borda: maiúsculas e minúsculas não importam", () => {
assert.equal(pickCopy("PT-br"), PT);
assert.equal(pickCopy("ES-419"), ES_419);
});
});
describe("textos do painel", () => {
test("botão citado no passo 2 é o rótulo oficial do Discord em cada idioma", () => {
assert.equal(EN.steps[1][1], "Add a Keybind");
assert.equal(PT.steps[1][1], "Adicionar atalho");
assert.equal(ES_ES.steps[1][1], "Añadir un atajo de teclado");
assert.equal(ES_419.steps[1][1], "Añadir un atajo de teclado");
});
test("as variantes de espanhol usam os nomes de ação de cada região", () => {
assert.match(ES_ES.steps[1][2], /Alternar silencio, Alternar ensordecimiento/);
assert.match(ES_419.steps[1][2], /Activar o desactivar silencio, Activar o desactivar ensordecer/);
});
test("plural do status", () => {
for (const copy of [EN, PT, ES_ES]) {
assert.notEqual(copy.active(0), copy.active(1));
assert.notEqual(copy.active(1).replace("1", "2"), copy.active(2));
}
assert.equal(ES_ES.active(1), "Activo en este sistema · 1 atajo registrado");
assert.equal(ES_ES.active(2), "Activo en este sistema · 2 atajos registrados");
});
});