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:
1 parent
a3a9149184
commit
34b61e2509
7 files changed
+351
-18
No files matched your search
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2026 Evandro
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
// Labels in bold quote Discord's own strings for each locale, so users find them on screen
|
||||
export interface Copy {
|
||||
active(registered: number): string;
|
||||
inactive: string;
|
||||
title: string;
|
||||
lead: string;
|
||||
// [before, bold, after]: plain data, because JSX can't run before Vencord has loaded React
|
||||
steps: [string, string, string][];
|
||||
open: string;
|
||||
tip: string;
|
||||
}
|
||||
|
||||
export const EN: Copy = {
|
||||
active: n => n === 0
|
||||
? "Active on this system · no keybinds yet"
|
||||
: `Active on this system · ${n} ${n === 1 ? "keybind" : "keybinds"} registered`,
|
||||
inactive: "Not needed on this system: the fix only acts on Linux with Wayland.",
|
||||
title: "Your Discord keybinds now work in every app",
|
||||
lead: "Set them up the same way as on Windows, on Discord's own Keybinds page.",
|
||||
steps: [
|
||||
["Open ", "Keybinds", " under System in Discord's User Settings."],
|
||||
["Click ", "Add a Keybind", ", choose an action such as Toggle Mute, Toggle Deafen or Push to Talk, and record your keys."],
|
||||
["When your system asks to add the shortcut, ", "allow it", "."]
|
||||
],
|
||||
open: "Open Keybinds",
|
||||
tip: "Push to Talk is most reliable on a single key without modifiers, such as Pause or F13."
|
||||
};
|
||||
|
||||
export const PT: Copy = {
|
||||
active: n => n === 0
|
||||
? "Ativo neste sistema · nenhum atalho ainda"
|
||||
: `Ativo neste sistema · ${n} ${n === 1 ? "atalho registrado" : "atalhos registrados"}`,
|
||||
inactive: "Não é necessário neste sistema: a correção só atua no Linux com Wayland.",
|
||||
title: "Seus atalhos do Discord agora funcionam em qualquer aplicativo",
|
||||
lead: "Configure do mesmo jeito que no Windows, na própria página de atalhos do Discord.",
|
||||
steps: [
|
||||
["Abra ", "Atalhos do teclado", " em Sistema, nas Configurações de usuário."],
|
||||
["Clique em ", "Adicionar atalho", ", escolha a ação (Ativar/desativar microfone, Ativar/desativar áudio, Aperte para Falar…) e grave as teclas."],
|
||||
["Quando o sistema pedir para adicionar o atalho, ", "permita", "."]
|
||||
],
|
||||
open: "Abrir Atalhos do teclado",
|
||||
tip: "No Aperte para Falar, prefira uma tecla única sem modificadores, como Pause ou F13."
|
||||
};
|
||||
|
||||
// Spain and Latin American Spanish name the voice actions differently in Discord
|
||||
function spanish(mute: string, deafen: string): Copy {
|
||||
return {
|
||||
active: n => n === 0
|
||||
? "Activo en este sistema · todavía no hay atajos"
|
||||
: `Activo en este sistema · ${n} ${n === 1 ? "atajo registrado" : "atajos registrados"}`,
|
||||
inactive: "No hace falta en este sistema: la corrección solo actúa en Linux con Wayland.",
|
||||
title: "Tus atajos de Discord ahora funcionan en cualquier aplicación",
|
||||
lead: "Configúralos igual que en Windows, en la propia página de atajos de Discord.",
|
||||
steps: [
|
||||
["Abre ", "Atajos de teclado", " en Sistema, dentro de los Ajustes de usuario."],
|
||||
["Haz clic en ", "Añadir un atajo de teclado", `, elige la acción (${mute}, ${deafen}, Pulsar para hablar…) y graba las teclas.`],
|
||||
["Cuando el sistema pida añadir el atajo, ", "permítelo", "."]
|
||||
],
|
||||
open: "Abrir Atajos de teclado",
|
||||
tip: "Para Pulsar para hablar, mejor usa una sola tecla sin modificadores, como Pause o F13."
|
||||
};
|
||||
}
|
||||
|
||||
export const ES_ES = spanish("Alternar silencio", "Alternar ensordecimiento");
|
||||
export const ES_419 = spanish("Activar o desactivar silencio", "Activar o desactivar ensordecer");
|
||||
|
||||
export function pickCopy(locale: string): Copy {
|
||||
const lang = locale.toLowerCase();
|
||||
if (lang.startsWith("pt")) return PT;
|
||||
if (lang === "es-419") return ES_419;
|
||||
if (lang.startsWith("es")) return ES_ES;
|
||||
return EN;
|
||||
}
|
||||
Reference in new issue
Block a user