aboutsummaryrefslogtreecommitdiff
path: root/client-web/source/resource/file.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client-web/source/resource/file.ts')
-rw-r--r--client-web/source/resource/file.ts22
1 files changed, 11 insertions, 11 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`);