From 2e1f8b86607e42f56fb1ecb6055083e3f6362c1e Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 5 Aug 2026 14:17:08 +0100 Subject: [PATCH] Bug 30144: (QA follow-up) Make servicing instruction UI strings translatable The servicing instructions widget added new user-facing strings (alerts, button labels, hints) built entirely in JS via string concatenation, none of which were wrapped for translation - unlike the pre-existing JS in the same file, which already uses _() throughout. Wrap them the same way, using _("...").format(...) for the strings that interpolate a value, matching the existing pattern used elsewhere in this file. Signed-off-by: Pedro Amorim --- .../prog/en/modules/acqui/neworderempty.tt | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt index 95d5011fdc..8222aef258 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt @@ -292,7 +292,7 @@ // Validate: max 2 instructions per group if (group.length >= 2) { - alert("Each service group can contain at most 2 instructions (one LVC and/or one LVT)."); + alert(_("Each service group can contain at most 2 instructions (one LVC and/or one LVT).")); return; } @@ -308,11 +308,11 @@ }); if (type === "LVC" && hasLVC) { - alert("This group already has an LVC instruction. Each group can have only one LVC."); + alert(_("This group already has an LVC instruction. Each group can have only one LVC.")); return; } if (type === "LVT" && hasLVT) { - alert("This group already has an LVT instruction. Each group can have only one LVT."); + alert(_("This group already has an LVT instruction. Each group can have only one LVT.")); return; } @@ -333,7 +333,7 @@ // Check if changing type would create a duplicate for (var i = 0; i < group.length; i++) { if (i !== instructionIndex && group[i].type === type) { - alert("This group already has a " + type + " instruction. Each group can have only one of each type."); + alert(_("This group already has a %s instruction. Each group can have only one of each type.").format(type)); renderServicingInstructions(); // Re-render to reset the select return; } @@ -348,7 +348,7 @@ container.empty(); if (servicingInstructionGroups.length === 0) { - container.append('
No servicing instructions added. Click "Add servicing group" to add one.
'); + container.append('
' + _("No servicing instructions added yet. Use the Add servicing group button to add one.") + "
"); return; } @@ -363,24 +363,24 @@ }); var groupHeader = $('
'); - groupHeader.append("Service Group " + (groupIndex + 1) + " "); + groupHeader.append("" + _("Service Group %s").format(groupIndex + 1) + " "); groupHeader.append( - $('').on("click", function () { + $('").on("click", function () { removeServicingGroup(groupIndex); }) ); groupDiv.append(groupHeader); if (group.length === 0) { - groupDiv.append('
Empty group
'); + groupDiv.append('
' + _("Empty group") + "
"); } group.forEach(function (instruction, instructionIndex) { var instructionDiv = $('
'); var typeSelect = $('') - .append('") - .append('") + .append('") + .append('") .on("change", function () { var newType = $(this).val(); var valueInput = $(this).next(); @@ -391,7 +391,7 @@ var valueInput; if (instruction.type === "LVC" && servicingInstructionAVs.length > 0) { valueInput = $(''); - valueInput.append(''); + valueInput.append('"); servicingInstructionAVs.forEach(function (av) { valueInput.append( $("") @@ -408,7 +408,7 @@ updateInstruction(groupIndex, instructionIndex, typeSelect.val(), $(this).val()); }); - var removeBtn = $('').on("click", function () { + var removeBtn = $('").on("click", function () { removeInstructionFromGroup(groupIndex, instructionIndex); }); @@ -428,14 +428,15 @@ var canAddMore = group.length < 2; if (canAddMore) { - var btnText = ' Add instruction'; + var btnLabel = _("Add instruction"); if (hasLVC && !hasLVT) { - btnText += " (LVT only)"; + btnLabel += " " + _("(LVT only)"); } else if (hasLVT && !hasLVC) { - btnText += " (LVC only)"; + btnLabel += " " + _("(LVC only)"); } else if (group.length === 0) { - btnText += " to this group"; + btnLabel += " " + _("to this group"); } + var btnText = ' ' + btnLabel; var addInstructionBtn = $('").on("click", function () { // Determine default type based on what's already in the group @@ -446,7 +447,7 @@ }); groupDiv.append(addInstructionBtn); } else { - var maxMsg = $('
' + "Maximum 2 instructions per group (one LVC + one LVT)
"); + var maxMsg = $('
' + _("Maximum 2 instructions per group (one LVC + one LVT)") + "
"); groupDiv.append(maxMsg); }