From 2c401af85ddc8faacb71082d1b35a87c2a07309f Mon Sep 17 00:00:00 2001 From: Marcus Kida Date: Wed, 18 Feb 2026 22:12:55 +0100 Subject: [PATCH] Implement CPS language selection --- static/app.js | 43 +++++++++++++++++++++++++++++++++--------- static/index.html | 7 +++++++ static/locales/de.json | 1 + static/locales/en.json | 1 + static/locales/es.json | 1 + static/locales/fr.json | 1 + static/locales/it.json | 1 + static/locales/pl.json | 1 + 8 files changed, 47 insertions(+), 9 deletions(-) diff --git a/static/app.js b/static/app.js index e1379ac..7313847 100644 --- a/static/app.js +++ b/static/app.js @@ -68,6 +68,7 @@ var cpsAddTgInput = document.getElementById("cps-add-tg-input"); var cpsAcList = document.getElementById("cps-ac-list"); var cpsAliasFormat = document.getElementById("cps-alias-format"); + var cpsLanguage = document.getElementById("cps-language"); var cpsContactsBtn = document.getElementById("cps-contacts-btn"); var cpsDownloadBtn = document.getElementById("cps-download-btn"); var cpsCopyBtn = document.getElementById("cps-copy-btn"); @@ -367,6 +368,7 @@ renderTgTable(); updateChannelCount(); updateCpsButtons(); + cpsLanguage.value = (getLocale() === "de") ? "de" : "en"; translateDOM(); } @@ -531,23 +533,46 @@ "Delete_CapacityPlusCalls,CapacityPlusCalls-CAPPLUSUCL_CALLLSTID,CapacityPlusCalls-CAPPLUSUCL_ROUTETYPE,CapacityPlusCalls-CAPPLUSUCL_CALLPRCDTNEN,CapacityPlusCalls-CAPPLUSUCL_RINGTYPE,CapacityPlusCalls-CAPPLUSUCL_TXTMSGALTTNTP,CapacityPlusCalls-CAPPLUSUCL_CALLTYPE," + "Delete_PhoneCalls,PhoneCalls-PHNUCLELL_CALLID,PhoneCalls-PHNUCLELL_RINGTYPE"; - var CPS_CSV_HEADER2 = "Kontaktname,Delete_Contact,Rename_Contact,Kommentare," + - "Delete_FiveToneCalls,F\u00fcnf-Ton-Rufe - Telegramm,F\u00fcnf-Ton-Rufe - Adresse," + - "Delete_MDCCalls,MDC-Rufe - Ruf-ID (Hex),MDC-Rufe - MDC-System,MDC-Rufe - Revert-Kanalzone,MDC-Rufe - Quittungskanal,MDC-Rufe - TPL/DPL ausschlie\u00dfen,MDC-Rufe - Rufart," + - "Delete_QuikCallIICalls,Quik Call II-Rufe - Quik-Call II-System,Quik Call II-Rufe - Revert-Kanalzone,Quik Call II-Rufe - Quittungskanal,Quik Call II-Rufe - Rufformat,Quik Call II-Rufe - Freq. Ton A (Hz),Quik Call II-Rufe - Code Ton A,Quik Call II-Rufe - Freq. Ton B (Hz),Quik Call II-Rufe - Code Ton B,Quik Call II-Rufe - TPL/DPL ausschlie\u00dfen," + - "Delete_DigitalCalls,Digitale Rufe - Ruf-ID,Digitale Rufe - Routentyp,Digitale Rufe - Rufempfangston,Digitale Rufe - Ruftonart,Digitale Rufe - Hinweiston Textnachricht,Digitale Rufe - Rufart,Digitale Rufe - DU_OVCMCALL," + - "Delete_CapacityPlusCalls,Capacity Plus-Rufe - Ruf-ID,Capacity Plus-Rufe - Routentyp,Capacity Plus-Rufe - Rufempfangston,Capacity Plus-Rufe - Ruftonart,Capacity Plus-Rufe - Hinweiston Textnachricht,Capacity Plus-Rufe - Rufart," + - "Delete_PhoneCalls,Telefonanrufe - Nummer,Telefonanrufe - Klingelton"; + var CPS_LOCALE = { + de: { + header2: "Kontaktname,Delete_Contact,Rename_Contact,Kommentare," + + "Delete_FiveToneCalls,F\u00fcnf-Ton-Rufe - Telegramm,F\u00fcnf-Ton-Rufe - Adresse," + + "Delete_MDCCalls,MDC-Rufe - Ruf-ID (Hex),MDC-Rufe - MDC-System,MDC-Rufe - Revert-Kanalzone,MDC-Rufe - Quittungskanal,MDC-Rufe - TPL/DPL ausschlie\u00dfen,MDC-Rufe - Rufart," + + "Delete_QuikCallIICalls,Quik Call II-Rufe - Quik-Call II-System,Quik Call II-Rufe - Revert-Kanalzone,Quik Call II-Rufe - Quittungskanal,Quik Call II-Rufe - Rufformat,Quik Call II-Rufe - Freq. Ton A (Hz),Quik Call II-Rufe - Code Ton A,Quik Call II-Rufe - Freq. Ton B (Hz),Quik Call II-Rufe - Code Ton B,Quik Call II-Rufe - TPL/DPL ausschlie\u00dfen," + + "Delete_DigitalCalls,Digitale Rufe - Ruf-ID,Digitale Rufe - Routentyp,Digitale Rufe - Rufempfangston,Digitale Rufe - Ruftonart,Digitale Rufe - Hinweiston Textnachricht,Digitale Rufe - Rufart,Digitale Rufe - DU_OVCMCALL," + + "Delete_CapacityPlusCalls,Capacity Plus-Rufe - Ruf-ID,Capacity Plus-Rufe - Routentyp,Capacity Plus-Rufe - Rufempfangston,Capacity Plus-Rufe - Ruftonart,Capacity Plus-Rufe - Hinweiston Textnachricht,Capacity Plus-Rufe - Rufart," + + "Delete_PhoneCalls,Telefonanrufe - Nummer,Telefonanrufe - Klingelton", + routeType: "Regul\u00e4r", + ringType: "Keine Art", + txtMsgAlertType: "Wiederholt", + callType: "Gruppenruf" + }, + en: { + header2: "Contact Name,Delete_Contact,Rename_Contact,Comments," + + "Delete_FiveToneCalls,Five Tone Calls - Telegram,Five Tone Calls - Address," + + "Delete_MDCCalls,MDC Calls - Call ID (Hex),MDC Calls - MDC System,MDC Calls - Revert Channel Zone,MDC Calls - Revert Channel,MDC Calls - Strip TPL/DPL,MDC Calls - Call Type," + + "Delete_QuikCallIICalls,Quik Call II Calls - Quik Call II System,Quik Call II Calls - Revert Channel Zone,Quik Call II Calls - Revert Channel,Quik Call II Calls - Call Format,Quik Call II Calls - Tone A TX Freq (Hz),Quik Call II Calls - Code A,Quik Call II Calls - Tone B TX Freq (Hz),Quik Call II Calls - Code B,Quik Call II Calls - Strip TPL/DPL," + + "Delete_DigitalCalls,Digital Calls - Call ID,Digital Calls - Route Type,Digital Calls - Call Receive Tone,Digital Calls - Ring Style,Digital Calls - Text Message Alert Tone,Digital Calls - Call Type,Digital Calls - DU_OVCMCALL," + + "Delete_CapacityPlusCalls,Capacity Plus Calls - Call ID,Capacity Plus Calls - Route Type,Capacity Plus Calls - Call Receive Tone,Capacity Plus Calls - Ring Style,Capacity Plus Calls - Text Message Alert Tone,Capacity Plus Calls - Call Type," + + "Delete_PhoneCalls,Phone Calls - Number,Phone Calls - Ring Tone", + routeType: "Regular", + ringType: "No Style", + txtMsgAlertType: "Repetitive", + callType: "Group Call" + } + }; function generateContactsCsv(talkgroups) { - var rows = [CPS_CSV_HEADER, CPS_CSV_HEADER2]; + var lang = cpsLanguage.value || "de"; + var locale = CPS_LOCALE[lang] || CPS_LOCALE["de"]; + var rows = [CPS_CSV_HEADER, locale.header2]; talkgroups.forEach(function (tg) { var name = ("TG" + tg.id + " " + (tg.name || "")).trim().substring(0, 16); var row = name + ",False,,," + "False,,," + "False,,,,,,," + "False,,,,,,,,,," + - "False," + tg.id + ",Regular,False,No Style,Repetitive,Group Call,False," + + "False," + tg.id + "," + locale.routeType + ",False," + locale.ringType + "," + locale.txtMsgAlertType + "," + locale.callType + ",False," + "False,,,,,,," + "False,,"; rows.push(row); diff --git a/static/index.html b/static/index.html index 478e308..7dd9bd9 100644 --- a/static/index.html +++ b/static/index.html @@ -94,6 +94,13 @@ +
+ + +
diff --git a/static/locales/de.json b/static/locales/de.json index 64e3053..c9e4766 100644 --- a/static/locales/de.json +++ b/static/locales/de.json @@ -47,6 +47,7 @@ "cps_tg_slot": "Zeitschlitz", "cps_add_tg_placeholder": "TG per ID oder Name hinzufügen...", "cps_alias_format": "Kanal-Alias-Format", + "cps_language": "CPS-Sprache", "cps_step1_label": "Schritt 1: Kontakte importieren", "cps_download_contacts": "Kontakte CSV herunterladen", "cps_step2_label": "Schritt 2: Zone einfügen", diff --git a/static/locales/en.json b/static/locales/en.json index b198fd0..786a659 100644 --- a/static/locales/en.json +++ b/static/locales/en.json @@ -47,6 +47,7 @@ "cps_tg_slot": "Timeslot", "cps_add_tg_placeholder": "Add TG by ID or name...", "cps_alias_format": "Channel alias format", + "cps_language": "CPS language", "cps_step1_label": "Step 1: Import contacts", "cps_download_contacts": "Download Contacts CSV", "cps_step2_label": "Step 2: Paste zone", diff --git a/static/locales/es.json b/static/locales/es.json index dccd6db..10188fa 100644 --- a/static/locales/es.json +++ b/static/locales/es.json @@ -47,6 +47,7 @@ "cps_tg_slot": "Timeslot", "cps_add_tg_placeholder": "Añadir TG por ID o nombre...", "cps_alias_format": "Formato de alias del canal", + "cps_language": "Idioma CPS", "cps_step1_label": "Paso 1: Importar contactos", "cps_download_contacts": "Descargar contactos CSV", "cps_step2_label": "Paso 2: Pegar zona", diff --git a/static/locales/fr.json b/static/locales/fr.json index 6c1eb85..c04f77a 100644 --- a/static/locales/fr.json +++ b/static/locales/fr.json @@ -47,6 +47,7 @@ "cps_tg_slot": "Timeslot", "cps_add_tg_placeholder": "Ajouter TG par ID ou nom...", "cps_alias_format": "Format d'alias du canal", + "cps_language": "Langue CPS", "cps_step1_label": "Étape 1 : Importer les contacts", "cps_download_contacts": "Télécharger contacts CSV", "cps_step2_label": "Étape 2 : Coller la zone", diff --git a/static/locales/it.json b/static/locales/it.json index e1e76ff..839021c 100644 --- a/static/locales/it.json +++ b/static/locales/it.json @@ -47,6 +47,7 @@ "cps_tg_slot": "Timeslot", "cps_add_tg_placeholder": "Aggiungi TG per ID o nome...", "cps_alias_format": "Formato alias canale", + "cps_language": "Lingua CPS", "cps_step1_label": "Passo 1: Importa contatti", "cps_download_contacts": "Scarica contatti CSV", "cps_step2_label": "Passo 2: Incolla zona", diff --git a/static/locales/pl.json b/static/locales/pl.json index d58c1c7..6f70001 100644 --- a/static/locales/pl.json +++ b/static/locales/pl.json @@ -49,6 +49,7 @@ "cps_tg_slot": "Timeslot", "cps_add_tg_placeholder": "Dodaj TG po ID lub nazwie...", "cps_alias_format": "Format aliasu kanału", + "cps_language": "J\u0119zyk CPS", "cps_step1_label": "Krok 1: Importuj kontakty", "cps_download_contacts": "Pobierz kontakty CSV", "cps_step2_label": "Krok 2: Wklej strefę",