Implement CPS language selection

This commit is contained in:
Marcus Kida 2026-02-18 22:12:55 +01:00
parent e0f8220639
commit 2c401af85d
8 changed files with 47 additions and 9 deletions

View file

@ -68,6 +68,7 @@
var cpsAddTgInput = document.getElementById("cps-add-tg-input"); var cpsAddTgInput = document.getElementById("cps-add-tg-input");
var cpsAcList = document.getElementById("cps-ac-list"); var cpsAcList = document.getElementById("cps-ac-list");
var cpsAliasFormat = document.getElementById("cps-alias-format"); var cpsAliasFormat = document.getElementById("cps-alias-format");
var cpsLanguage = document.getElementById("cps-language");
var cpsContactsBtn = document.getElementById("cps-contacts-btn"); var cpsContactsBtn = document.getElementById("cps-contacts-btn");
var cpsDownloadBtn = document.getElementById("cps-download-btn"); var cpsDownloadBtn = document.getElementById("cps-download-btn");
var cpsCopyBtn = document.getElementById("cps-copy-btn"); var cpsCopyBtn = document.getElementById("cps-copy-btn");
@ -367,6 +368,7 @@
renderTgTable(); renderTgTable();
updateChannelCount(); updateChannelCount();
updateCpsButtons(); updateCpsButtons();
cpsLanguage.value = (getLocale() === "de") ? "de" : "en";
translateDOM(); 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_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"; "Delete_PhoneCalls,PhoneCalls-PHNUCLELL_CALLID,PhoneCalls-PHNUCLELL_RINGTYPE";
var CPS_CSV_HEADER2 = "Kontaktname,Delete_Contact,Rename_Contact,Kommentare," + var CPS_LOCALE = {
de: {
header2: "Kontaktname,Delete_Contact,Rename_Contact,Kommentare," +
"Delete_FiveToneCalls,F\u00fcnf-Ton-Rufe - Telegramm,F\u00fcnf-Ton-Rufe - Adresse," + "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_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_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_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_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"; "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) { 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) { talkgroups.forEach(function (tg) {
var name = ("TG" + tg.id + " " + (tg.name || "")).trim().substring(0, 16); var name = ("TG" + tg.id + " " + (tg.name || "")).trim().substring(0, 16);
var row = name + ",False,,," + var row = name + ",False,,," +
"False,,," + "False,,," +
"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,,,,,,," +
"False,,"; "False,,";
rows.push(row); rows.push(row);

View file

@ -94,6 +94,13 @@
<option value="tg-ts">TG262-TS2</option> <option value="tg-ts">TG262-TS2</option>
</select> </select>
</div> </div>
<div class="cps-alias-format">
<label data-i18n="cps_language">CPS language</label>
<select id="cps-language">
<option value="de">Deutsch</option>
<option value="en">English</option>
</select>
</div>
<table class="cps-tg-table"> <table class="cps-tg-table">
<thead> <thead>
<tr> <tr>

View file

@ -47,6 +47,7 @@
"cps_tg_slot": "Zeitschlitz", "cps_tg_slot": "Zeitschlitz",
"cps_add_tg_placeholder": "TG per ID oder Name hinzufügen...", "cps_add_tg_placeholder": "TG per ID oder Name hinzufügen...",
"cps_alias_format": "Kanal-Alias-Format", "cps_alias_format": "Kanal-Alias-Format",
"cps_language": "CPS-Sprache",
"cps_step1_label": "Schritt 1: Kontakte importieren", "cps_step1_label": "Schritt 1: Kontakte importieren",
"cps_download_contacts": "Kontakte CSV herunterladen", "cps_download_contacts": "Kontakte CSV herunterladen",
"cps_step2_label": "Schritt 2: Zone einfügen", "cps_step2_label": "Schritt 2: Zone einfügen",

View file

@ -47,6 +47,7 @@
"cps_tg_slot": "Timeslot", "cps_tg_slot": "Timeslot",
"cps_add_tg_placeholder": "Add TG by ID or name...", "cps_add_tg_placeholder": "Add TG by ID or name...",
"cps_alias_format": "Channel alias format", "cps_alias_format": "Channel alias format",
"cps_language": "CPS language",
"cps_step1_label": "Step 1: Import contacts", "cps_step1_label": "Step 1: Import contacts",
"cps_download_contacts": "Download Contacts CSV", "cps_download_contacts": "Download Contacts CSV",
"cps_step2_label": "Step 2: Paste zone", "cps_step2_label": "Step 2: Paste zone",

View file

@ -47,6 +47,7 @@
"cps_tg_slot": "Timeslot", "cps_tg_slot": "Timeslot",
"cps_add_tg_placeholder": "Añadir TG por ID o nombre...", "cps_add_tg_placeholder": "Añadir TG por ID o nombre...",
"cps_alias_format": "Formato de alias del canal", "cps_alias_format": "Formato de alias del canal",
"cps_language": "Idioma CPS",
"cps_step1_label": "Paso 1: Importar contactos", "cps_step1_label": "Paso 1: Importar contactos",
"cps_download_contacts": "Descargar contactos CSV", "cps_download_contacts": "Descargar contactos CSV",
"cps_step2_label": "Paso 2: Pegar zona", "cps_step2_label": "Paso 2: Pegar zona",

View file

@ -47,6 +47,7 @@
"cps_tg_slot": "Timeslot", "cps_tg_slot": "Timeslot",
"cps_add_tg_placeholder": "Ajouter TG par ID ou nom...", "cps_add_tg_placeholder": "Ajouter TG par ID ou nom...",
"cps_alias_format": "Format d'alias du canal", "cps_alias_format": "Format d'alias du canal",
"cps_language": "Langue CPS",
"cps_step1_label": "Étape 1 : Importer les contacts", "cps_step1_label": "Étape 1 : Importer les contacts",
"cps_download_contacts": "Télécharger contacts CSV", "cps_download_contacts": "Télécharger contacts CSV",
"cps_step2_label": "Étape 2 : Coller la zone", "cps_step2_label": "Étape 2 : Coller la zone",

View file

@ -47,6 +47,7 @@
"cps_tg_slot": "Timeslot", "cps_tg_slot": "Timeslot",
"cps_add_tg_placeholder": "Aggiungi TG per ID o nome...", "cps_add_tg_placeholder": "Aggiungi TG per ID o nome...",
"cps_alias_format": "Formato alias canale", "cps_alias_format": "Formato alias canale",
"cps_language": "Lingua CPS",
"cps_step1_label": "Passo 1: Importa contatti", "cps_step1_label": "Passo 1: Importa contatti",
"cps_download_contacts": "Scarica contatti CSV", "cps_download_contacts": "Scarica contatti CSV",
"cps_step2_label": "Passo 2: Incolla zona", "cps_step2_label": "Passo 2: Incolla zona",

View file

@ -49,6 +49,7 @@
"cps_tg_slot": "Timeslot", "cps_tg_slot": "Timeslot",
"cps_add_tg_placeholder": "Dodaj TG po ID lub nazwie...", "cps_add_tg_placeholder": "Dodaj TG po ID lub nazwie...",
"cps_alias_format": "Format aliasu kanału", "cps_alias_format": "Format aliasu kanału",
"cps_language": "J\u0119zyk CPS",
"cps_step1_label": "Krok 1: Importuj kontakty", "cps_step1_label": "Krok 1: Importuj kontakty",
"cps_download_contacts": "Pobierz kontakty CSV", "cps_download_contacts": "Pobierz kontakty CSV",
"cps_step2_label": "Krok 2: Wklej strefę", "cps_step2_label": "Krok 2: Wklej strefę",