Notes
- + +Knobs
+Knobs
CK
(check) to the repeater, and play when it comes back.
diff --git a/static/scripts/i18n.mjs b/static/scripts/i18n.mjs new file mode 100644 index 0000000..f4685ec --- /dev/null +++ b/static/scripts/i18n.mjs @@ -0,0 +1,47 @@ +import {Xlat} from "./xlat.mjs" + +class I18n { + constructor() { + for (let lang of navigator.languages) { + this.table = Xlat[lang] + if (this.table) { + break + } + } + } + + Fill() { + if (!this.table) { + return + } + + for (let e of document.querySelectorAll("[data-i18n]")) { + e.innerHTML = this.lookup(e.dataset.i18n, e.innerHTML) + } + + for (let e of document.querySelectorAll("[data-i18n-placeholder]")) { + e.placeholder = this.lookup(e.dataset.i18nPlaceholder, e.placeholder) + } + + for (let e of document.querySelectorAll("[data-i18n-title")) { + e.title = this.lookup(e.dataset.i18nTitle, e.title) + } + } + + lookup(key, dfl=null) { + let obj = this.table + for (let k of key.split(".")) { + obj = obj[k] + } + return obj || dfl + } +} + +async function Setup() { + let i = new I18n() + i.Fill() +} + +export { + Setup, +} \ No newline at end of file diff --git a/static/scripts/vail.mjs b/static/scripts/vail.mjs index 0a7bd75..6d996da 100644 --- a/static/scripts/vail.mjs +++ b/static/scripts/vail.mjs @@ -3,6 +3,7 @@ import * as Outputs from "./outputs.mjs" import * as Inputs from "./inputs.mjs" import * as Repeaters from "./repeaters.mjs" import * as Chart from "./chart.mjs" +import * as I18n from "./i18n.mjs" const DefaultRepeater = "General" const Millisecond = 1 @@ -453,6 +454,7 @@ function init() { if (navigator.serviceWorker) { navigator.serviceWorker.register("sw.js") } + I18n.Setup() try { window.app = new VailClient() } catch (err) { diff --git a/static/scripts/xlat.mjs b/static/scripts/xlat.mjs new file mode 100644 index 0000000..cfab71c --- /dev/null +++ b/static/scripts/xlat.mjs @@ -0,0 +1,122 @@ +export const Xlat = { + "fr": { + "heading": { + "repeater": "Répéteur", + "mode": "Mode", + "notes": "Remarques", + "knobs": "Réglages" + }, + "key": { + "key": "Key", + "dit": "Dit", + "dah": "Dah" + }, + "keyer": { + "cootie": "Straight Key / Cootie", + "bug": "Bug", + "elbug": "Electronic Bug", + "singledot": "Single Dot", + "ultimatic": "Ultimatic", + "iambic": "Iambic (plain)", + "iambica": "Iambic A", + "iambicb": "Iambic B", + "keyahead": "Keyahead" + }, + "label": { + "wpm": "WPM", + "ms": "ms", + "wiki": "Aide", + "rx-delay": "retard de réception", + "telegraph-sounds": "Sons télégraphiques" + }, + "title": { + "discord": "Chat textuel et du voix, sur Discord", + "wiki": "Vail Wiki" + }, + "description": { + "ck": "Transmettre
CK
(check) au répéteur, et sonner le réponse.",
+ "reset": "Réinitialiser les paramètres par défaut.",
+ "notes": "Écrivez vos nôtes ici."
+ }
+ },
+ "en": {
+ "heading": {
+ "repeater": "Repeater eater",
+ "mode": "Mode",
+ "notes": "Notes",
+ "knobs": "Knobs"
+ },
+ "key": {
+ "key": "Key",
+ "dit": "Dit",
+ "dah": "Dah"
+ },
+ "keyer": {
+ "cootie": "Straight Key / Cootie",
+ "bug": "Bug",
+ "elbug": "Electronic Bug",
+ "singledot": "Single Dot",
+ "ultimatic": "Ultimatic",
+ "iambic": "Iambic (plain)",
+ "iambica": "Iambic A",
+ "iambicb": "Iambic B",
+ "keyahead": "Keyahea"
+ },
+ "label": {
+ "wpm": "WPM",
+ "ms": "ms",
+ "wiki": "Help",
+ "rx-delay": "receive delay",
+ "telegraph-sounds": "Telegraph sounds"
+ },
+ "title": {
+ "discord": "Text/Voice chat on Discord",
+ "wiki": "Vail Wiki"
+ },
+ "description": {
+ "ck": "Send CK
(check) to the repeater, and play when it comes back.",
+ "reset": "Reset all Vail preferences to default.",
+ "notes": "Enter your own notes here."
+ }
+ },
+ "se": {
+ "heading": {
+ "repeater": "Repeater",
+ "mode": "Läge",
+ "notes": "Anteckningar",
+ "knobs": "Rattar"
+ },
+ "key": {
+ "key": "Nyckel",
+ "dit": "Dit",
+ "dah": "Dah"
+ },
+ "keyer": {
+ "cootie": "Handpump / Cootie",
+ "bug": "Bug",
+ "elbug": "Elektronisk Bug",
+ "singledot": "Enkelpunktig",
+ "ultimatic": "Ultimatisk",
+ "iambic": "Iambic (normal)",
+ "iambica": "Iambic-läge A",
+ "iambicb": "Iambic-läge B",
+ "keyahead": "Förtelegrafera"
+ },
+ "label": {
+ "wpm": "Ord per minut",
+ "ms": "Millisekunder",
+ "wiki": "Hjälp",
+ "rx-delay": "Mottagningsfördröjning",
+ "telegraph-sounds": "Telegrafljud"
+ },
+ "title": {
+ "discord": "Text- eller röstkommunicera på Discord",
+ "wiki": "Vail Wiki"
+ },
+ "description": {
+ "ck": "Sänd CK
(kontroll) till repeater:en, och få uppspelat vid återkomst.",
+ "reset": "Återställ till standardinställningarna.",
+ "notes": "Angiv Dina egna anteckningar här."
+ }
+ }
+}