2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-01 11:10:54 +00:00

JS translation fix (#6288)

* Implement {% jstrans %} template

- Forces string escaping in translated text
- Required for js written in templates

* Fix part_base.html

* Update .html files

- Change any templated javascript code to use {% jstrans %}

* Update .js files

- Explicitly use {% jstrans %}

* Update CI checks
This commit is contained in:
Oliver
2024-01-19 12:16:17 +11:00
committed by GitHub
parent 914743627b
commit 4f8dddc597
49 changed files with 1682 additions and 1658 deletions

View File

@ -276,7 +276,7 @@
},
multi_delete: true,
method: 'DELETE',
title: '{% trans "Delete Test Data" %}',
title: '{% jstrans "Delete Test Data" %}',
preFormContent: html,
refreshTable: '#test-result-table',
});
@ -293,7 +293,7 @@
fields: stockItemTestResultFields({
stock_item: {{ item.pk }},
}),
title: '{% trans "Add Test Result" %}',
title: '{% jstrans "Add Test Result" %}',
refreshTable: '#test-result-table',
});
});

View File

@ -504,7 +504,7 @@ $("#stock-test-report").click(function() {
$("#print-label").click(function() {
printLabels({
items: [{{ item.pk }}],
singular_name: '{% trans "stock item" %}',
singular_name: '{% jstrans "stock item" %}',
url: '{% url "api-stockitem-label-list" %}',
key: 'item',
});
@ -529,7 +529,7 @@ $('#stock-edit-status').click(function () {
status: {},
},
reload: true,
title: '{% trans "Edit Stock Status" %}',
title: '{% jstrans "Edit Stock Status" %}',
});
});
@ -538,7 +538,7 @@ $('#stock-edit-status').click(function () {
{% if barcodes %}
$("#show-qr-code").click(function() {
showQRDialog(
'{% trans "Stock Item QR Code" %}',
'{% jstrans "Stock Item QR Code" %}',
'{"stockitem": {{ item.pk }} }',
);
});
@ -549,7 +549,7 @@ $("#barcode-link").click(function() {
stockitem: {{ item.pk }},
},
{
title: '{% trans "Link Barcode to Stock Item" %}',
title: '{% jstrans "Link Barcode to Stock Item" %}',
}
);
});
@ -625,7 +625,7 @@ $("#stock-convert").click(function() {
'{% url "api-stock-item-convert" item.pk %}',
{
method: 'POST',
title: '{% trans "Convert Stock Item" %}',
title: '{% jstrans "Convert Stock Item" %}',
preFormContent: html,
reload: true,
fields: {
@ -659,7 +659,7 @@ $("#stock-return-from-customer").click(function() {
},
},
method: 'POST',
title: '{% trans "Return to Stock" %}',
title: '{% jstrans "Return to Stock" %}',
reload: true,
});

View File

@ -286,7 +286,7 @@
printLabels({
items: locs,
singular_name: '{% trans "stock location" %}',
singular_name: '{% jstrans "stock location" %}',
key: 'location',
url: '{% url "api-stocklocation-label-list" %}',
});
@ -314,7 +314,7 @@
{
onSuccess: function() {
showMessage(
'{% trans "Scanned stock container into this location" %}',
'{% jstrans "Scanned stock container into this location" %}',
{
style: 'success',
}
@ -387,7 +387,7 @@
{% if barcodes %}
$('#show-qr-code').click(function() {
showQRDialog(
'{% trans "Stock Location QR Code" %}',
'{% jstrans "Stock Location QR Code" %}',
'{"stocklocation": {{ location.pk }} }'
);
});
@ -398,7 +398,7 @@
stocklocation: {{ location.pk }},
},
{
title: '{% trans "Link Barcode to Stock Location" %}',
title: '{% jstrans "Link Barcode to Stock Location" %}',
}
);
});