diff options
author | metamuffin <metamuffin@disroot.org> | 2024-04-01 16:48:57 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-04-01 16:48:57 +0200 |
commit | 45529def628fd1562bef262312649b428bbdb0f7 (patch) | |
tree | 4d7e54e9d45bbf91c1fe2247bf379e0e879cd89b /client-web/source/preferences | |
parent | 5cd88136c70dc3aae12778180b7f1c2c568a00fc (diff) | |
download | keks-meet-45529def628fd1562bef262312649b428bbdb0f7.tar keks-meet-45529def628fd1562bef262312649b428bbdb0f7.tar.bz2 keks-meet-45529def628fd1562bef262312649b428bbdb0f7.tar.zst |
localization
Diffstat (limited to 'client-web/source/preferences')
-rw-r--r-- | client-web/source/preferences/decl.ts | 9 | ||||
-rw-r--r-- | client-web/source/preferences/ui.ts | 11 |
2 files changed, 12 insertions, 8 deletions
diff --git a/client-web/source/preferences/decl.ts b/client-web/source/preferences/decl.ts index 36ed1a1..a75f1d9 100644 --- a/client-web/source/preferences/decl.ts +++ b/client-web/source/preferences/decl.ts @@ -5,6 +5,8 @@ */ // there should be no deps to dom APIs in this file for the tablegen to work +import { LOCALES } from "../locale/mod.ts"; + export function hex_id(len = 8): string { if (len > 8) return hex_id() + hex_id(len - 8) return Math.floor(Math.random() * 16 ** len).toString(16).padStart(len, "0") @@ -16,6 +18,7 @@ const optional = <T>(a: T): T | undefined => a export const PREF_DECLS = { username: { type: string, default: "guest-" + hex_id(), description: "Username", allow_url: true }, + language: { type: optional(string), possible_values: Object.keys(LOCALES), description: "Interface Language", allow_url: true }, warn_redirect: { type: bool, hidden: true, default: false, description: "Internal option that is set by a server redirect.", allow_url: true }, image_view_popup: { type: bool, default: true, description: "Open image in popup instead of new tab" }, webrtc_debug: { type: bool, default: false, description: "Show additional information for WebRTC related stuff" }, @@ -38,9 +41,9 @@ export const PREF_DECLS = { optional_audio_default_enable: { type: bool, default: true, description: "Enable audio tracks by default" }, optional_video_default_enable: { type: bool, default: false, description: "Enable video tracks by default" }, - notify_chat: { type: bool, default: true, description: "Send notifications for incoming chat messages" }, - notify_join: { type: bool, default: true, description: "Send notifications when users join" }, - notify_leave: { type: bool, default: true, description: "Send notifications when users leave" }, + notify_chat: { type: bool, default: true, description: "Send notifications for incoming chat messages", allow_url: true }, + notify_join: { type: bool, default: true, description: "Send notifications when users join", allow_url: true }, + notify_leave: { type: bool, default: true, description: "Send notifications when users leave", allow_url: true }, enable_onbeforeunload: { type: bool, default: true, description: "Prompt for confirmation when leaving the site while local resources are active" }, room_watches: { type: string, default: "[]", hidden: true, description: "Known rooms (as semicolon seperated list of name=secret pairs)" } diff --git a/client-web/source/preferences/ui.ts b/client-web/source/preferences/ui.ts index 44b3e4e..47f3a4b 100644 --- a/client-web/source/preferences/ui.ts +++ b/client-web/source/preferences/ui.ts @@ -6,6 +6,7 @@ /// <reference lib="dom" /> import { e } from "../helper.ts"; +import { PO } from "../locale/mod.ts"; import { PREF_DECLS } from "./decl.ts"; import { change_pref, on_pref_changed, PrefDecl, PREFS } from "./mod.ts"; @@ -83,19 +84,19 @@ export function ui_preferences(): HTMLElement { }) const notification_perm = Notification.permission == "granted" ? e("div", {}) : e("div", {}, - e("span", {}, "For keks-meet to send notifications, it needs you to grant permission: "), - e("button", { onclick: () => Notification.requestPermission() }, "Grant"), + e("span", {}, PO.notification_perm_explain), + e("button", { onclick: () => Notification.requestPermission() }, PO.grant), ) const reset = e("div", {}, - e("span", {}, "Want to clear all settings? Use this:"), + e("span", {}, PO.clear_prefs), e("button", { onclick: () => { if (confirm("really clear all preferences?")) { localStorage.clear(); window.location.reload() } } }, "RESET"), ) const table = document.createElement("table") table.append(...rows) - return e("div", { class: "preferences", role: "dialog", aria_label: "settings" }, - e("h2", {}, "Settings"), + return e("div", { class: "preferences", role: "dialog", aria_label: PO.settings }, + e("h2", {}, PO.settings), notification_perm, e("br", {}), table, e("br", {}), reset |