Skip to content

Commit 86d9f00

Browse files
committed
tools: allow translation of messages
Change-Id: I915b194bc703ed3ffed70ad770db90b17a0a3e57
1 parent 9234fc8 commit 86d9f00

2 files changed

Lines changed: 22 additions & 10 deletions

File tree

assets/js/tools.js

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -632,9 +632,14 @@ const photoboothTools = (function () {
632632
api.printPayment = function (imageSrc, copies, cb) {
633633
const priceCents = Number(config.payments?.price_cents || 0);
634634
const priceEuro = (priceCents / 100).toFixed(2).replace('.', ',');
635-
const paymentMessage = (config.payments?.message || 'Bitte zahlen Sie %price% €').replace('%price%', priceEuro);
636-
637-
api.overlay.show('💠' + paymentMessage);
635+
const paymentMessage = (config.payments?.message || api.getTranslation('payments_message')).replace(
636+
'%price%',
637+
priceEuro
638+
);
639+
const paymentQrMsg = api.getTranslation('payments_qr_message');
640+
const paymentTerminalMsg = api.getTranslation('payments_terminal_message');
641+
642+
api.overlay.show(paymentMessage);
638643
api.isPrinting = true;
639644
if (typeof remoteBuzzerClient !== 'undefined') {
640645
remoteBuzzerClient.inProgress('print');
@@ -651,15 +656,15 @@ const photoboothTools = (function () {
651656
api.isPrinting = false;
652657
api.printImage(imageSrc, copies, cb);
653658
} else if (data.status === 'success') {
654-
api.overlay.show(data.message || '✅ Zahlung erfolgreich – Druck startet...');
659+
api.overlay.show(data.message || api.getTranslation('payments_success'));
655660
setTimeout(() => {
656661
api.overlay.close();
657662
api.isPrinting = false;
658663
api.printImage(imageSrc, copies, cb);
659664
}, 1200);
660665
} else if (data.status === 'qr' || data.status === 'both') {
661666
if (!data.payment_url) {
662-
api.overlay.showError('QR-Zahlungslink fehlt');
667+
api.overlay.showError(api.getTranslation('payments_url_missing'));
663668
api.resetPrintErrorMessage(cb, notificationTimeout);
664669
return;
665670
}
@@ -668,20 +673,20 @@ const photoboothTools = (function () {
668673
encodeURIComponent(data.payment_url);
669674
api.overlay.show(`
670675
<div style="text-align:center;">
671-
<div style="font-size:1.4em; margin-bottom:12px;">💠${paymentMessage}</div>
672-
<div style="margin-bottom:10px;">QR-Code scannen und bezahlen</div>
676+
<div style="font-size:1.4em; margin-bottom:12px;">${paymentMessage}</div>
677+
<div style="margin-bottom:10px;">${paymentQrMsg}</div>
673678
<img src="${qrUrl}" alt="QR Code" style="max-width:300px; width:80%; height:auto; background:#fff; padding:10px; border-radius:12px;">
674-
${data.status === 'both' ? '<div style="margin-top:12px;">Oder direkt am Terminal bezahlen</div>' : ''}
679+
${data.status === 'both' ? `<div style="margin-top:12px;">${paymentTerminalMsg}</div>` : ''}
675680
</div>
676681
`);
677682
api.isPrinting = false;
678683
} else {
679-
api.overlay.showError(data.error || 'Zahlung fehlgeschlagen');
684+
api.overlay.showError(data.error || api.getTranslation('payments_failed'));
680685
api.resetPrintErrorMessage(cb, notificationTimeout);
681686
}
682687
},
683688
error: () => {
684-
api.overlay.showError('Zahlungsfehler');
689+
api.overlay.showError(api.getTranslation('payments_error'));
685690
api.resetPrintErrorMessage(cb, notificationTimeout);
686691
}
687692
});

resources/lang/en.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,13 @@
862862
"no_printing": "File type can't be printed.",
863863
"path": "Path:",
864864
"payments": "Payment systems",
865+
"payments_error": "Payment error",
866+
"payments_failed": "Payment failed",
867+
"payments_message": "Please pay %price%",
868+
"payments_qr_message": "Scan the QR code and pay",
869+
"payments_success": "Payment successful! Printing starts...",
870+
"payments_terminal_message": "or pay directly at the terminal",
871+
"payments_url_missing": "QR payment link missing",
865872
"payments:payments_background": "Background image",
866873
"payments:payments_display_mode": "Payment mode",
867874
"payments:payments_enabled": "Enable payment system",

0 commit comments

Comments
 (0)