aboutsummaryrefslogtreecommitdiff
path: root/client-web/source/locale/mod.ts
blob: 108233008a7b61d5b34fe65b0f5693bf86285473 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import { PO_DE } from "./de.ts";
import { PO_EN } from "./en.ts";
import { PREF_DECLS } from "../preferences/decl.ts";
import { PO_JA } from "./ja.ts";
import { PO_ES } from "./es.ts";

export let PO: LanguageStrings;

export function init_locale(lang: string) {
    if (lang == "system") lang = navigator.language
    if (!LOCALES[lang]) lang = "en-US"
    PO = LOCALES[lang]
}

export const LOCALES: { [key: string]: LanguageStrings } = {
    "en": PO_EN,
    "en-US": PO_EN,
    "en-GB": PO_EN, // close enough
    "de": PO_DE,
    "de-DE": PO_DE,
    "ja": PO_JA,
    "ja-JP": PO_JA,
    "es": PO_ES,
    "es-ES": PO_ES,
}

export interface LanguageStrings {
    microphone: string,
    camera: string,
    screen: string,
    file: string,
    fullscreen: string,
    local: string,
    warn_short_secret: string,
    warn_no_webrtc: string,
    warn_secure_context: string,
    warn_no_crypto: string,
    warn_no_sw: string,
    warn_old_url: string,
    warn_mem_download: string,
    chatbox_placeholder: string,
    chatbox_label: string,
    confirm_quit: string,
    controls: string,
    license: string,
    source_code: string,
    documentation: string,
    chat: string,
    settings: string,
    known_rooms: string,
    leave: string,
    confirm_update: string,
    image_alt: string,
    join_message(author: HTMLElement | string): (HTMLElement | string)[],
    leave_message(author: HTMLElement | string): (HTMLElement | string)[],
    summary_empty_message: string,
    summery_image: string,
    edit: string,
    finish_edit: string,
    add_current_room: string,
    add: string,
    move_up: string,
    move_down: string,
    unknown_user: string,
    status_connected: string,
    status_no_conn: string,
    status_checking: string,
    status_disconnected: string,
    status_failed: string,
    downloading: string,
    download: string,
    download_again: string,
    stop_sharing: string,
    status_await_channel_open: string,
    status_await_channel_close: string,
    status_drain_buffer(amount: number): string,
    status_buffering: string,
    status_closing: string,
    mute: string,
    video_stream: string,
    audio_stream: string,
    enable: (thing: string) => string,
    disable: string,
    notification_perm_explain: string,
    grant: string,
    status_await_stream: string,
    clear_prefs: string,
    setting_descs: { [key in keyof typeof PREF_DECLS]: string },
}