131 lines
8.8 KiB
JavaScript
131 lines
8.8 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Run: node deploy/patch-i18n-threema.mjs
|
|
*
|
|
* Idempotently injects (or overwrites) customer-facing Threema texts:
|
|
* - packages.threema.{description, instructions, disclaimer}
|
|
* - channelUsers.threemaIdHelp
|
|
* - channelUsers.threemaSetup.{title, step1, step2, step3, qrAlt}
|
|
*
|
|
* Replaces the earlier version of this script entirely. The new texts:
|
|
* - Drop "Gateway account" jargon (customers don't know it)
|
|
* - Drop asterisk-prefix references (customers don't see / type it)
|
|
* - Tell the customer to add their OWN Threema ID, not someone else's
|
|
* - Disclose that Threema charges per message via the gateway
|
|
* - Walk through the QR-scan + add-your-ID flow explicitly
|
|
*
|
|
* Re-running is safe — keys are set, not merged, so this is the
|
|
* source of truth for the values it touches.
|
|
*/
|
|
import { readFileSync, writeFileSync } from "fs";
|
|
|
|
const i18n = {
|
|
en: {
|
|
pkg: {
|
|
description:
|
|
"Send and receive messages through Threema. Each inbound and outbound message uses the shared PieCed messaging service and incurs a per-message charge from Threema — a third-party cost, separate from your PieCed subscription.",
|
|
instructions:
|
|
"1. Enable this package.\n2. Open Threema on your phone, scan the QR code shown under Authorized Users → threema, and accept the contact.\n3. Add your own Threema ID under Authorized Users → threema so the assistant recognises your messages.\n4. Send a message from Threema to start chatting with the assistant.",
|
|
disclaimer:
|
|
"Messages between Threema and PieCed are end-to-end encrypted up to PieCed's messaging service, where they are decrypted to be routed to your assistant. Each message sent or received is counted toward Threema's per-message billing — see your plan for current rates.",
|
|
},
|
|
channelHelp:
|
|
"Enter your own Threema ID — the 8 characters shown in your Threema app under Settings → My Threema ID. Once added, you'll be able to chat with the assistant directly from Threema.",
|
|
setup: {
|
|
title: "Add the assistant to your Threema",
|
|
step1: "Open Threema on your phone.",
|
|
step2: "Tap the scan icon and scan this QR code to add the assistant as a contact.",
|
|
step3: "Then add your own Threema ID below.",
|
|
qrAlt: "QR code to add {gateway} as a Threema contact",
|
|
bannerTitle: "Set up Threema",
|
|
bannerBody: "Open Threema on your phone and scan our QR code to add the assistant as a contact. Then add your own Threema ID below.",
|
|
bannerButton: "Show QR code",
|
|
},
|
|
},
|
|
de: {
|
|
pkg: {
|
|
description:
|
|
"Senden und empfangen Sie Nachrichten über Threema. Jede eingehende und ausgehende Nachricht läuft über den gemeinsamen PieCed-Messaging-Dienst und verursacht eine Gebühr pro Nachricht bei Threema — eine Drittanbieter-Kostenposition, unabhängig von Ihrem PieCed-Abonnement.",
|
|
instructions:
|
|
"1. Aktivieren Sie dieses Paket.\n2. Öffnen Sie Threema auf Ihrem Telefon, scannen Sie den QR-Code unter Autorisierte Benutzer → threema und akzeptieren Sie den Kontakt.\n3. Tragen Sie Ihre eigene Threema-ID unter Autorisierte Benutzer → threema ein, damit der Assistent Ihre Nachrichten erkennt.\n4. Schreiben Sie eine Nachricht aus Threema, um das Gespräch zu beginnen.",
|
|
disclaimer:
|
|
"Nachrichten zwischen Threema und PieCed werden Ende-zu-Ende verschlüsselt bis zum PieCed-Messaging-Dienst, wo sie entschlüsselt und an Ihren Assistenten weitergeleitet werden. Jede gesendete oder empfangene Nachricht wird gemäss Threema-Tarif pro Nachricht abgerechnet — die aktuellen Preise finden Sie in Ihrem Plan.",
|
|
},
|
|
channelHelp:
|
|
"Geben Sie Ihre eigene Threema-ID ein — die 8 Zeichen, die in Ihrer Threema-App unter Einstellungen → Meine Threema-ID angezeigt werden. Anschliessend können Sie direkt aus Threema mit dem Assistenten chatten.",
|
|
setup: {
|
|
title: "Assistenten zu Threema hinzufügen",
|
|
step1: "Öffnen Sie Threema auf Ihrem Telefon.",
|
|
step2: "Tippen Sie auf das Scan-Symbol und scannen Sie diesen QR-Code, um den Assistenten als Kontakt hinzuzufügen.",
|
|
step3: "Fügen Sie anschliessend unten Ihre eigene Threema-ID hinzu.",
|
|
qrAlt: "QR-Code, um {gateway} als Threema-Kontakt hinzuzufügen",
|
|
bannerTitle: "Threema einrichten",
|
|
bannerBody: "Öffnen Sie Threema auf Ihrem Telefon und scannen Sie unseren QR-Code, um den Assistenten als Kontakt hinzuzufügen. Geben Sie anschliessend unten Ihre eigene Threema-ID ein.",
|
|
bannerButton: "QR-Code anzeigen",
|
|
},
|
|
},
|
|
fr: {
|
|
pkg: {
|
|
description:
|
|
"Envoyez et recevez des messages via Threema. Chaque message entrant ou sortant transite par le service de messagerie PieCed partagé et entraîne des frais par message facturés par Threema — un coût tiers, distinct de votre abonnement PieCed.",
|
|
instructions:
|
|
"1. Activez ce package.\n2. Ouvrez Threema sur votre téléphone, scannez le QR code affiché dans Utilisateurs autorisés → threema, puis acceptez le contact.\n3. Ajoutez votre propre identifiant Threema sous Utilisateurs autorisés → threema afin que l'assistant reconnaisse vos messages.\n4. Envoyez un message depuis Threema pour commencer la conversation.",
|
|
disclaimer:
|
|
"Les messages entre Threema et PieCed sont chiffrés de bout en bout jusqu'au service de messagerie PieCed, où ils sont déchiffrés pour être acheminés vers votre assistant. Chaque message envoyé ou reçu est facturé par Threema selon son tarif par message — consultez votre plan pour les tarifs en vigueur.",
|
|
},
|
|
channelHelp:
|
|
"Saisissez votre propre identifiant Threema — les 8 caractères affichés dans votre application Threema sous Réglages → Mon identifiant Threema. Une fois ajouté, vous pourrez discuter directement avec l'assistant depuis Threema.",
|
|
setup: {
|
|
title: "Ajouter l'assistant à Threema",
|
|
step1: "Ouvrez Threema sur votre téléphone.",
|
|
step2: "Appuyez sur l'icône de scan et scannez ce QR code pour ajouter l'assistant comme contact.",
|
|
step3: "Puis ajoutez votre propre identifiant Threema ci-dessous.",
|
|
qrAlt: "QR code pour ajouter {gateway} comme contact Threema",
|
|
bannerTitle: "Configurer Threema",
|
|
bannerBody: "Ouvrez Threema sur votre téléphone et scannez notre QR code pour ajouter l'assistant comme contact. Saisissez ensuite votre propre identifiant Threema ci-dessous.",
|
|
bannerButton: "Afficher le QR code",
|
|
},
|
|
},
|
|
it: {
|
|
pkg: {
|
|
description:
|
|
"Invia e ricevi messaggi tramite Threema. Ogni messaggio in entrata e in uscita passa attraverso il servizio di messaggistica condiviso di PieCed e comporta un addebito per messaggio da parte di Threema — un costo di terzi, separato dall'abbonamento PieCed.",
|
|
instructions:
|
|
"1. Attiva questo pacchetto.\n2. Apri Threema sul tuo telefono, scansiona il QR code mostrato in Utenti autorizzati → threema e accetta il contatto.\n3. Aggiungi il tuo ID Threema sotto Utenti autorizzati → threema affinché l'assistente riconosca i tuoi messaggi.\n4. Invia un messaggio da Threema per iniziare la conversazione.",
|
|
disclaimer:
|
|
"I messaggi tra Threema e PieCed sono cifrati end-to-end fino al servizio di messaggistica PieCed, dove vengono decifrati per essere inoltrati al tuo assistente. Ogni messaggio inviato o ricevuto viene addebitato da Threema secondo la sua tariffa per messaggio — consulta il tuo piano per i prezzi attuali.",
|
|
},
|
|
channelHelp:
|
|
"Inserisci il tuo ID Threema — gli 8 caratteri mostrati nella tua app Threema sotto Impostazioni → Il mio ID Threema. Una volta aggiunto, potrai conversare con l'assistente direttamente da Threema.",
|
|
setup: {
|
|
title: "Aggiungi l'assistente a Threema",
|
|
step1: "Apri Threema sul tuo telefono.",
|
|
step2: "Tocca l'icona di scansione e scansiona questo QR code per aggiungere l'assistente ai contatti.",
|
|
step3: "Quindi aggiungi il tuo ID Threema qui sotto.",
|
|
qrAlt: "QR code per aggiungere {gateway} come contatto Threema",
|
|
bannerTitle: "Configura Threema",
|
|
bannerBody: "Apri Threema sul tuo telefono e scansiona il nostro QR code per aggiungere l'assistente ai contatti. Inserisci poi il tuo ID Threema qui sotto.",
|
|
bannerButton: "Mostra QR code",
|
|
},
|
|
},
|
|
};
|
|
|
|
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;
|
|
json.channelUsers.threemaSetup = entries.setup;
|
|
|
|
writeFileSync(path, JSON.stringify(json, null, 2) + "\n");
|
|
console.log(`Patched ${path}`);
|
|
}
|