diff options
author | metamuffin <metamuffin@disroot.org> | 2025-03-22 14:27:25 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-03-22 14:27:25 +0100 |
commit | 5d4cb7864dc3ca19669877def6c298eb96d19b16 (patch) | |
tree | 92444bfd31c9080e8c09aa7368e3f6cb4156ed35 /client-web/source/resource | |
parent | 2f5d47d21dfc308c1b930cf45e13b34445d3a8e5 (diff) | |
download | keks-meet-5d4cb7864dc3ca19669877def6c298eb96d19b16.tar keks-meet-5d4cb7864dc3ca19669877def6c298eb96d19b16.tar.bz2 keks-meet-5d4cb7864dc3ca19669877def6c298eb96d19b16.tar.zst |
new translation system
Diffstat (limited to 'client-web/source/resource')
-rw-r--r-- | client-web/source/resource/file.ts | 22 | ||||
-rw-r--r-- | client-web/source/resource/track.ts | 16 |
2 files changed, 19 insertions, 19 deletions
diff --git a/client-web/source/resource/file.ts b/client-web/source/resource/file.ts index 0554e2f..4bd92ed 100644 --- a/client-web/source/resource/file.ts +++ b/client-web/source/resource/file.ts @@ -10,7 +10,7 @@ import { log } from "../logger.ts"; import { StreamDownload } from "../download_stream.ts"; import { RemoteUser } from "../user/remote.ts"; import { LocalResource, ResourceHandlerDecl } from "./mod.ts"; -import { PO } from "../locale/mod.ts"; +import { tr } from "../locale.ts"; const MAX_CHUNK_SIZE = 1 << 15; @@ -20,14 +20,14 @@ export const resource_file: ResourceHandlerDecl = { const download_button = e("button", { onclick: self => { enable() - self.textContent = PO.downloading + self.textContent = tr("res.file.downloading") self.disabled = true } - }, PO.download) + }, tr("res.file.download")) return { info, el: e("div", {}, - e("span", {}, `${PO.file}: ${JSON.stringify(info.label)} (${display_filesize(info.size!)})`), + e("span", {}, `${tr("res.file")}: ${JSON.stringify(info.label)} (${display_filesize(info.size!)})`), download_button, ), on_statechange(_s) { }, @@ -38,7 +38,7 @@ export const resource_file: ResourceHandlerDecl = { this.el.appendChild(display.el) const reset = () => { download_button.disabled = false - download_button.textContent = PO.download_again + download_button.textContent = tr("res.file.download_again") this.el.removeChild(display.el) disable() } @@ -124,7 +124,7 @@ function file_res_inner(file: File): LocalResource { transfers_abort.forEach(abort => abort()) }, el: e("div", { class: "file" }, - e("button", { class: "abort", onclick(_) { destroy() } }, PO.stop_sharing), + e("button", { class: "abort", onclick(_) { destroy() } }, tr("res.stop_sharing")), e("span", {}, `Sharing file: ${JSON.stringify(file.name)}`), transfers_el ), @@ -137,16 +137,16 @@ function file_res_inner(file: File): LocalResource { log("dc", `${user.display_name} started transfer`); const display = transfer_status_el(user) transfers_el.appendChild(display.el) - display.status = PO.status_await_channel_open + display.status = tr("status_await_channel_open") let position = 0 const finish = async () => { channel.send("end") while (channel.bufferedAmount) { - display.status = PO.status_drain_buffer(channel.bufferedAmount) + display.status = tr("status.drain_buffer", { amount: channel.bufferedAmount.toString() }) await sleep(10) } - display.status = PO.status_await_channel_close + display.status = tr("status.await_channel_close") } const feed = async () => { const { value: chunk, done }: { value?: Uint8Array, done: boolean } = await reader.read() @@ -171,7 +171,7 @@ function file_res_inner(file: File): LocalResource { const abort_cb = () => { channel.close(); } channel.onbufferedamountlow = () => feed_until_full() channel.onopen = _ev => { - display.status = PO.status_buffering + display.status = tr("status.buffering") log("dc", `${user.display_name}: channel open`); feed_until_full() } @@ -179,7 +179,7 @@ function file_res_inner(file: File): LocalResource { log("dc", `${user.display_name}: channel error`); } channel.onclosing = _ev => { - display.status = PO.status_closing + display.status = tr("status.closing") } channel.onclose = _ev => { log("dc", `${user.display_name}: channel closed`); diff --git a/client-web/source/resource/track.ts b/client-web/source/resource/track.ts index e2af5e9..ac1e8a6 100644 --- a/client-web/source/resource/track.ts +++ b/client-web/source/resource/track.ts @@ -6,7 +6,7 @@ /// <reference lib="dom" /> import { ProvideInfo } from "../../../common/packets.d.ts"; import { e } from "../helper.ts"; -import { PO } from "../locale/mod.ts"; +import { tr } from "../locale.ts"; import { log } from "../logger.ts"; import { on_pref_changed, PREFS } from "../preferences/mod.ts"; import { get_rnnoise_node } from "../rnnoise.ts"; @@ -20,12 +20,12 @@ export const resource_track: ResourceHandlerDecl = { if (preview_enabled) user.send_to({ preview_request: { id: info.id } }) let preview_request_timeout: number | undefined; - const enable_label = PO.enable(`"${info.label ?? info.kind}"`) + const enable_label = tr("res.enable", { name: `"${info.label ?? info.kind}"` }) const enable_button = e("button", { class: "center", onclick: self => { self.disabled = true; - self.textContent = PO.status_await_stream; + self.textContent = tr("status.await_stream"); enable() } }, enable_label) @@ -71,7 +71,7 @@ export const resource_track: ResourceHandlerDecl = { enable_button.textContent = enable_label; self.remove() } - }, PO.disable)) + }, tr("res.disable"))) create_track_display(this.el, stream, false) }, } @@ -81,7 +81,7 @@ export const resource_track: ResourceHandlerDecl = { export function new_local_track(info: ProvideInfo, stream: MediaStream, ...extra_controls: HTMLElement[]): LocalResource { let destroy: () => void; const el = e("div", { class: `media-${stream.getVideoTracks().length > 0 ? "video" : "audio"}` }, - e("button", { icon: "stop", class: ["abort", "topleft"], onclick: () => destroy() }, PO.stop_sharing), + e("button", { icon: "stop", class: ["abort", "topleft"], onclick: () => destroy() }, tr("res.stop_sharing")), ...extra_controls ); @@ -151,7 +151,7 @@ function create_track_display(target: HTMLElement, stream: MediaStream, local: b media_el.srcObject = stream media_el.autoplay = true media_el.controls = !is_video - media_el.ariaLabel = is_video ? PO.video_stream : PO.audio_stream + media_el.ariaLabel = is_video ? tr("res.video_stream") : tr("res.audio_stream") media_el.addEventListener("pause", () => media_el.play()) if (local) media_el.muted = true @@ -177,7 +177,7 @@ function create_track_display(target: HTMLElement, stream: MediaStream, local: b else media_el.requestFullscreen() } - }, PO.fullscreen) + }, tr("res.fullscreen")) target.prepend(fullscreen) } @@ -263,7 +263,7 @@ export async function create_mic_res() { const mute = document.createElement("input") mute.type = "checkbox" - const mute_label = e("label", { class: "check-button" }, PO.mute) + const mute_label = e("label", { class: "check-button" }, tr("res.microphone.mute")) mute_label.prepend(mute) const res = new_local_track({ id: destination.stream.id, kind: "track", track_kind: "audio", label: "Microphone" }, destination.stream, mute_label) |