81 lines
4.9 KiB
JavaScript
81 lines
4.9 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Run: node deploy/patch-i18n-threema.mjs
|
|
*
|
|
* Idempotently injects:
|
|
* - packages.threema.{description, instructions, disclaimer}
|
|
* - channelUsers.threemaIdHelp
|
|
*
|
|
* into all four message files. Run from the pieced-portal repo root.
|
|
*/
|
|
import { readFileSync, writeFileSync } from "fs";
|
|
|
|
const i18n = {
|
|
en: {
|
|
pkg: {
|
|
description:
|
|
"Threema messaging routed through the PieCed central gateway. No Gateway account of your own required — PieCed mints credentials when you enable this package.",
|
|
instructions:
|
|
"1. Enable this package — PieCed provisions a central-gateway slot for your tenant.\n2. Add the Threema IDs you want to talk to under Authorized Users → threema.\n3. Each Threema ID can only belong to one PieCed tenant; if a registration fails, that ID is already in use elsewhere.",
|
|
disclaimer:
|
|
"Messages are end-to-end encrypted at the Threema boundary by the PieCed central gateway. Inbound and outbound message counts are logged per tenant for billing.",
|
|
},
|
|
channelHelp:
|
|
"Enter the 8-character Threema ID (uppercase letters and digits, no asterisk) of the person you want to talk to. The * prefix is for Gateway accounts, which PieCed manages on your behalf.",
|
|
},
|
|
de: {
|
|
pkg: {
|
|
description:
|
|
"Threema-Messaging über das zentrale PieCed-Gateway. Sie benötigen kein eigenes Gateway-Konto — PieCed stellt die Anmeldedaten beim Aktivieren dieses Pakets bereit.",
|
|
instructions:
|
|
"1. Aktivieren Sie dieses Paket — PieCed richtet einen zentralen Gateway-Slot für Ihren Tenant ein.\n2. Fügen Sie die Threema-IDs, mit denen Sie kommunizieren wollen, unter Autorisierte Benutzer → threema hinzu.\n3. Jede Threema-ID kann nur einem PieCed-Tenant zugeordnet sein; wenn die Registrierung fehlschlägt, ist die ID bereits anderweitig vergeben.",
|
|
disclaimer:
|
|
"Die Nachrichten werden am Threema-Übergang vom zentralen PieCed-Gateway Ende-zu-Ende verschlüsselt. Eingehende und ausgehende Nachrichten werden pro Tenant für die Abrechnung gezählt.",
|
|
},
|
|
channelHelp:
|
|
"Geben Sie die 8-stellige Threema-ID (Großbuchstaben und Ziffern, ohne Sternchen) der Person ein, mit der Sie kommunizieren möchten. Das *-Präfix gehört zu Gateway-Konten, die PieCed für Sie verwaltet.",
|
|
},
|
|
fr: {
|
|
pkg: {
|
|
description:
|
|
"Messagerie Threema via la passerelle centrale PieCed. Aucun compte Gateway personnel requis — PieCed génère les identifiants à l'activation du package.",
|
|
instructions:
|
|
"1. Activez ce package — PieCed approvisionne un slot de passerelle centrale pour votre tenant.\n2. Ajoutez les identifiants Threema avec lesquels vous souhaitez échanger sous Utilisateurs autorisés → threema.\n3. Chaque identifiant Threema ne peut appartenir qu'à un seul tenant PieCed ; si l'enregistrement échoue, l'identifiant est déjà utilisé ailleurs.",
|
|
disclaimer:
|
|
"Les messages sont chiffrés de bout en bout côté Threema par la passerelle centrale PieCed. Les volumes entrant et sortant sont consignés par tenant pour la facturation.",
|
|
},
|
|
channelHelp:
|
|
"Saisissez l'identifiant Threema à 8 caractères (lettres majuscules et chiffres, sans astérisque) de la personne avec qui vous souhaitez communiquer. Le préfixe * concerne les comptes Gateway, gérés par PieCed pour vous.",
|
|
},
|
|
it: {
|
|
pkg: {
|
|
description:
|
|
"Messaggistica Threema instradata tramite il gateway centrale PieCed. Non è necessario un account Gateway proprio — PieCed crea le credenziali quando attivi il pacchetto.",
|
|
instructions:
|
|
"1. Attiva questo pacchetto — PieCed predispone uno slot del gateway centrale per il tuo tenant.\n2. Aggiungi gli ID Threema con cui vuoi comunicare sotto Utenti autorizzati → threema.\n3. Ogni ID Threema può appartenere a un solo tenant PieCed; se la registrazione fallisce, l'ID è già usato altrove.",
|
|
disclaimer:
|
|
"I messaggi sono cifrati end-to-end al confine con Threema dal gateway centrale PieCed. I conteggi di messaggi in ingresso e uscita vengono registrati per tenant ai fini della fatturazione.",
|
|
},
|
|
channelHelp:
|
|
"Inserisci l'ID Threema di 8 caratteri (lettere maiuscole e cifre, senza asterisco) della persona con cui vuoi comunicare. Il prefisso * appartiene agli account Gateway, gestiti da PieCed per te.",
|
|
},
|
|
};
|
|
|
|
for (const [lang, entries] of Object.entries(i18n)) {
|
|
const path = `src/messages/${lang}.json`;
|
|
const json = JSON.parse(readFileSync(path, "utf8"));
|
|
|
|
json.packages = json.packages ?? {};
|
|
json.packages.threema = {
|
|
description: entries.pkg.description,
|
|
instructions: entries.pkg.instructions,
|
|
disclaimer: entries.pkg.disclaimer,
|
|
};
|
|
|
|
json.channelUsers = json.channelUsers ?? {};
|
|
json.channelUsers.threemaIdHelp = entries.channelHelp;
|
|
|
|
writeFileSync(path, JSON.stringify(json, null, 2) + "\n");
|
|
console.log(`Patched ${path} — added packages.threema and channelUsers.threemaIdHelp`);
|
|
}
|