diff --git a/InvenTree/build/templates/build/build_base.html b/InvenTree/build/templates/build/build_base.html
index 3eb50e1270..e9de6bf97a 100644
--- a/InvenTree/build/templates/build/build_base.html
+++ b/InvenTree/build/templates/build/build_base.html
@@ -270,7 +270,7 @@ src="{% static 'img/blank_image.png' %}"
'{% url "api-build-detail" build.pk %}',
{
method: 'DELETE',
- title: '{% trans "Delete Build Order" %}',
+ title: '{% jstrans "Delete Build Order" %}',
redirect: "{% url 'build-index' %}",
}
);
@@ -280,7 +280,7 @@ src="{% static 'img/blank_image.png' %}"
$('#show-qr-code').click(function() {
showQRDialog(
- '{% trans "Build Order QR Code" %}',
+ '{% jstrans "Build Order QR Code" %}',
'{"build": {{ build.pk }} }'
);
});
@@ -292,7 +292,7 @@ src="{% static 'img/blank_image.png' %}"
build: {{ build.pk }},
},
{
- title: '{% trans "Link Barcode to Build Order" %}',
+ title: '{% jstrans "Link Barcode to Build Order" %}',
}
);
});
diff --git a/InvenTree/build/templates/build/detail.html b/InvenTree/build/templates/build/detail.html
index 8f60cc31df..a290ce7021 100644
--- a/InvenTree/build/templates/build/detail.html
+++ b/InvenTree/build/templates/build/detail.html
@@ -419,8 +419,8 @@ function allocateSelectedLines() {
if (unallocated_lines.length == 0) {
showAlertDialog(
- '{% trans "Allocation Complete" %}',
- '{% trans "All lines have been fully allocated" %}',
+ '{% jstrans "Allocation Complete" %}',
+ '{% jstrans "All lines have been fully allocated" %}',
);
} else {
diff --git a/InvenTree/company/templates/company/company_base.html b/InvenTree/company/templates/company/company_base.html
index 238c53847e..70dfd364cb 100644
--- a/InvenTree/company/templates/company/company_base.html
+++ b/InvenTree/company/templates/company/company_base.html
@@ -159,7 +159,7 @@
$('#company-delete').click(function() {
constructForm('{% url "api-company-detail" company.pk %}', {
method: 'DELETE',
- title: '{% trans "Delete Company" %}',
+ title: '{% jstrans "Delete Company" %}',
redirect: '{% url "company-index" %}',
});
});
@@ -202,10 +202,10 @@
$('#company-image-delete').click(function(event) {
event.stopPropagation();
showQuestionDialog(
- '{% trans "Remove Image" %}',
- '{% trans "Remove associated image from this company" %}',
+ '{% jstrans "Remove Image" %}',
+ '{% jstrans "Remove associated image from this company" %}',
{
- accept_text: '{% trans "Remove" %}',
+ accept_text: '{% jstrans "Remove" %}',
submitClass: 'danger',
accept: function() {
inventreePut(
@@ -234,7 +234,7 @@
fields: {
image: {},
},
- title: '{% trans "Upload Image" %}',
+ title: '{% jstrans "Upload Image" %}',
onSuccess: function(data) {
reloadImage(data);
}
@@ -249,7 +249,7 @@
'{% url "api-company-detail" company.pk %}',
{
method: 'PATCH',
- title: '{% trans "Download Image" %}',
+ title: '{% jstrans "Download Image" %}',
fields: {
remote_image: {},
},
diff --git a/InvenTree/company/templates/company/manufacturer_part.html b/InvenTree/company/templates/company/manufacturer_part.html
index 1987c1d204..50ad8048b2 100644
--- a/InvenTree/company/templates/company/manufacturer_part.html
+++ b/InvenTree/company/templates/company/manufacturer_part.html
@@ -203,7 +203,7 @@ $('#parameter-create').click(function() {
hidden: true,
}
},
- title: '{% trans "Add Parameter" %}',
+ title: '{% jstrans "Add Parameter" %}',
refreshTable: '#parameter-table',
});
});
diff --git a/InvenTree/company/templates/company/supplier_part.html b/InvenTree/company/templates/company/supplier_part.html
index eeb158653e..b30c55f04e 100644
--- a/InvenTree/company/templates/company/supplier_part.html
+++ b/InvenTree/company/templates/company/supplier_part.html
@@ -273,7 +273,7 @@ src="{% static 'img/blank_image.png' %}"
$("#show-qr-code").click(function() {
showQRDialog(
- '{% trans "Supplier Part QR Code" %}',
+ '{% jstrans "Supplier Part QR Code" %}',
'{"supplierpart": {{ part.pk }} }'
);
});
@@ -284,7 +284,7 @@ $("#barcode-link").click(function() {
supplierpart: {{ part.pk }},
},
{
- title: '{% trans "Link Barcode to Supplier Part" %}',
+ title: '{% jstrans "Link Barcode to Supplier Part" %}',
}
);
});
@@ -356,7 +356,7 @@ $('#update-part-availability').click(function() {
fields: {
available: {},
},
- title: '{% trans "Update Part Availability" %}',
+ title: '{% jstrans "Update Part Availability" %}',
onSuccess: function() {
location.reload();
}
diff --git a/InvenTree/order/templates/order/order_base.html b/InvenTree/order/templates/order/order_base.html
index 2a064794d8..fbd3dcac67 100644
--- a/InvenTree/order/templates/order/order_base.html
+++ b/InvenTree/order/templates/order/order_base.html
@@ -315,7 +315,7 @@ $("#export-order").click(function() {
$('#show-qr-code').click(function() {
showQRDialog(
- '{% trans "Purchase Order QR Code" %}',
+ '{% jstrans "Purchase Order QR Code" %}',
'{"purchaseorder": {{ order.pk }} }'
);
});
@@ -327,7 +327,7 @@ $("#barcode-link").click(function() {
purchaseorder: {{ order.pk }},
},
{
- title: '{% trans "Link Barcode to Purchase Order" %}',
+ title: '{% jstrans "Link Barcode to Purchase Order" %}',
}
);
});
diff --git a/InvenTree/order/templates/order/return_order_base.html b/InvenTree/order/templates/order/return_order_base.html
index b9c0f5e370..1a5542b2d8 100644
--- a/InvenTree/order/templates/order/return_order_base.html
+++ b/InvenTree/order/templates/order/return_order_base.html
@@ -260,7 +260,7 @@ $('#print-order-report').click(function() {
$('#show-qr-code').click(function() {
showQRDialog(
- '{% trans "Return Order QR Code" %}',
+ '{% jstrans "Return Order QR Code" %}',
'{"returnorder": {{ order.pk }} }'
);
});
@@ -272,7 +272,7 @@ $("#barcode-link").click(function() {
returnorder: {{ order.pk }},
},
{
- title: '{% trans "Link Barcode to Return Order" %}',
+ title: '{% jstrans "Link Barcode to Return Order" %}',
}
);
});
diff --git a/InvenTree/order/templates/order/sales_order_base.html b/InvenTree/order/templates/order/sales_order_base.html
index 53d15b2aa0..736765959e 100644
--- a/InvenTree/order/templates/order/sales_order_base.html
+++ b/InvenTree/order/templates/order/sales_order_base.html
@@ -309,7 +309,7 @@ $('#print-order-report').click(function() {
$('#show-qr-code').click(function() {
showQRDialog(
- '{% trans "Sales Order QR Code" %}',
+ '{% jstrans "Sales Order QR Code" %}',
'{"salesorder": {{ order.pk }} }'
);
});
@@ -321,7 +321,7 @@ $("#barcode-link").click(function() {
salesorder: {{ order.pk }},
},
{
- title: '{% trans "Link Barcode to Sales Order" %}',
+ title: '{% jstrans "Link Barcode to Sales Order" %}',
}
);
});
diff --git a/InvenTree/part/templates/part/detail.html b/InvenTree/part/templates/part/detail.html
index 6f9a11147b..335527c8c6 100644
--- a/InvenTree/part/templates/part/detail.html
+++ b/InvenTree/part/templates/part/detail.html
@@ -656,7 +656,7 @@
value: {{ part.pk }},
},
part_2: {
- label: '{% trans "Related Part" %}',
+ label: '{% jstrans "Related Part" %}',
filters: {
exclude_id: {{ part.pk }},
exclude_related: {{ part.pk }},
@@ -664,7 +664,7 @@
}
},
focus: 'part_2',
- title: '{% trans "Add Related Part" %}',
+ title: '{% jstrans "Add Related Part" %}',
refreshTable: '#related-parts-table',
});
});
@@ -749,7 +749,7 @@
fields: partTestTemplateFields({
part: {{ part.pk }}
}),
- title: '{% trans "Add Test Result Template" %}',
+ title: '{% jstrans "Add Test Result Template" %}',
refreshTable: '#test-template-table',
});
});
diff --git a/InvenTree/part/templates/part/part_base.html b/InvenTree/part/templates/part/part_base.html
index 3dcfeebb78..cc71f8e19b 100644
--- a/InvenTree/part/templates/part/part_base.html
+++ b/InvenTree/part/templates/part/part_base.html
@@ -441,7 +441,7 @@
{% if barcodes %}
$("#show-qr-code").click(function() {
showQRDialog(
- '{% trans "Part QR Code" %}',
+ '{% jstrans "Part QR Code" %}',
'{"part": {{ part.pk }} }',
);
});
@@ -458,7 +458,7 @@
part: {{ part.pk }},
},
{
- title: '{% trans "Link Barcode to Part" %}',
+ title: '{% jstrans "Link Barcode to Part" %}',
}
);
});
@@ -469,7 +469,7 @@
printLabels({
items: [{{ part.pk }}],
key: 'part',
- singular_name: '{% trans "part" %}',
+ singular_name: 'part',
url: '{% url "api-part-label-list" %}',
});
});
@@ -509,7 +509,7 @@
launchModalForm(
"{% url 'part-pricing' part.id %}",
{
- submit_text: '{% trans "Calculate" %}',
+ submit_text: '{% jstrans "Calculate" %}',
hideErrorMessage: true,
}
);
@@ -525,10 +525,10 @@
$('#part-image-delete').click(function(event) {
event.stopPropagation();
showQuestionDialog(
- '{% trans "Remove Image" %}',
- '{% trans "Remove associated image from this part" %}',
+ '{% jstrans "Remove Image" %}',
+ '{% jstrans "Remove associated image from this part" %}',
{
- accept_text: '{% trans "Remove" %}',
+ accept_text: '{% jstrans "Remove" %}',
submitClass: 'danger',
accept: function() {
inventreePut(
@@ -557,7 +557,7 @@
fields: {
image: {},
},
- title: '{% trans "Upload Image" %}',
+ title: '{% jstrans "Upload Image" %}',
onSuccess: function(data) {
reloadImage(data);
}
@@ -577,7 +577,7 @@
sidePagination: 'server',
singleSelect: true,
formatNoMatches: function() {
- return '{% trans "No matching images found" %}';
+ return '{% jstrans "No matching images found" %}';
},
columns: [
{
@@ -611,7 +611,7 @@
'{% url "api-part-detail" part.pk %}',
{
method: 'PATCH',
- title: '{% trans "Download Image" %}',
+ title: '{% jstrans "Download Image" %}',
fields: {
remote_image: {},
},
@@ -673,13 +673,13 @@
// Callback function when the "part details" panel is shown
$('#collapse-part-details').on('show.bs.collapse', function() {
- $('#toggle-details-button').html('{% trans "Hide Part Details" %}');
+ $('#toggle-details-button').html('{% jstrans "Hide Part Details" %}');
inventreeSave('show-part-details', true);
});
// Callback function when the "part details" panel is hidden
$('#collapse-part-details').on('hide.bs.collapse', function() {
- $('#toggle-details-button').html('{% trans "Show Part Details" %}');
+ $('#toggle-details-button').html('{% jstrans "Show Part Details" %}');
inventreeSave('show-part-details', false);
});
diff --git a/InvenTree/part/templates/part/pricing_javascript.html b/InvenTree/part/templates/part/pricing_javascript.html
index 42976e530e..ae3795bdcc 100644
--- a/InvenTree/part/templates/part/pricing_javascript.html
+++ b/InvenTree/part/templates/part/pricing_javascript.html
@@ -21,7 +21,7 @@ $('#part-pricing-refresh').click(function() {
$('#part-pricing-edit').click(function() {
constructForm('{% url "api-part-pricing" part.pk %}', {
- title: '{% trans "Update Pricing" %}',
+ title: '{% jstrans "Update Pricing" %}',
fields: {
override_min: {},
override_min_currency: {},
diff --git a/InvenTree/part/templatetags/i18n.py b/InvenTree/part/templatetags/i18n.py
index 54af6040f6..29e8dc5629 100644
--- a/InvenTree/part/templatetags/i18n.py
+++ b/InvenTree/part/templatetags/i18n.py
@@ -27,6 +27,14 @@ def translation_stats(lang_code):
class CustomTranslateNode(TranslateNode):
"""Custom translation node class, which sanitizes the translated strings for javascript use"""
+ def __init__(self, filter_expression, noop, asvar, message_context, escape=False):
+ """Custom constructor for TranslateNode class.
+
+ - Adds an 'escape' argument, which is passed to the render function
+ """
+ super().__init__(filter_expression, noop, asvar, message_context)
+ self.escape = escape
+
def render(self, context):
"""Custom render function overrides / extends default behaviour"""
result = super().render(context)
@@ -41,18 +49,21 @@ class CustomTranslateNode(TranslateNode):
for c in ['\\', '`', ';', '|', '&']:
result = result.replace(c, '')
- # Escape any quotes contained in the string
- result = result.replace("'", r"\'")
- result = result.replace('"', r'\"')
+ # Escape any quotes contained in the string, if the request is for a javascript file
+ request = context.get('request', None)
+
+ if self.escape or (request and request.path.endswith('.js')):
+ result = result.replace("'", r'\'')
+ result = result.replace('"', r'\"')
# Return the 'clean' resulting string
return result
-@register.tag("translate")
-@register.tag("trans")
-def do_translate(parser, token):
- """Custom translation function, lifted from https://github.com/django/django/blob/main/django/templatetags/i18n.py
+@register.tag('translate')
+@register.tag('trans')
+def do_translate(parser, token, escape=False):
+ """Custom translation function.
The only difference is that we pass this to our custom rendering node class
"""
@@ -109,7 +120,21 @@ def do_translate(parser, token):
)
seen.add(option)
- return CustomTranslateNode(message_string, noop, asvar, message_context)
+ return CustomTranslateNode(
+ message_string, noop, asvar, message_context, escape=escape
+ )
+
+
+@register.tag('jstrans')
+def do_jstrans(parser, token):
+ """Custom translation function for javascript strings.
+
+ - Usage: {% jstrans "String to translate" %}
+ - Performs the same function as the 'trans' tag, but also escapes the translated string.
+ - Explicitly required for javascript code within a .html template
+ - Note: Any {% trans %} tag is automatically escaped in a .js file
+ """
+ return do_translate(parser, token, escape=True)
# Re-register tags which we have not explicitly overridden
diff --git a/InvenTree/stock/templates/stock/item.html b/InvenTree/stock/templates/stock/item.html
index a36dd54f91..78076a1c9a 100644
--- a/InvenTree/stock/templates/stock/item.html
+++ b/InvenTree/stock/templates/stock/item.html
@@ -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',
});
});
diff --git a/InvenTree/stock/templates/stock/item_base.html b/InvenTree/stock/templates/stock/item_base.html
index 5e36025014..aeb5287817 100644
--- a/InvenTree/stock/templates/stock/item_base.html
+++ b/InvenTree/stock/templates/stock/item_base.html
@@ -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,
});
diff --git a/InvenTree/stock/templates/stock/location.html b/InvenTree/stock/templates/stock/location.html
index f6178465c8..f4e1c20179 100644
--- a/InvenTree/stock/templates/stock/location.html
+++ b/InvenTree/stock/templates/stock/location.html
@@ -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" %}',
}
);
});
diff --git a/InvenTree/templates/InvenTree/index.html b/InvenTree/templates/InvenTree/index.html
index 4d7fecd67a..013c638e2b 100644
--- a/InvenTree/templates/InvenTree/index.html
+++ b/InvenTree/templates/InvenTree/index.html
@@ -33,10 +33,10 @@
{% to_list setting_part_starred setting_part_latest setting_bom_validation as settings_list_part %}
{% if roles.part.view and True in settings_list_part %}
-addHeaderTitle('{% trans "Parts" %}');
+addHeaderTitle('{% jstrans "Parts" %}');
{% if setting_part_starred %}
-addHeaderAction('starred-parts', '{% trans "Subscribed Parts" %}', 'fa-bell');
+addHeaderAction('starred-parts', '{% jstrans "Subscribed Parts" %}', 'fa-bell');
loadSimplePartTable("#table-starred-parts", "{% url 'api-part-list' %}", {
name: 'starred-parts',
params: {
@@ -49,7 +49,7 @@ loadSimplePartTable("#table-starred-parts", "{% url 'api-part-list' %}", {
{% endif %}
{% if setting_category_starred %}
-addHeaderAction('starred-categories', '{% trans "Subscribed Categories" %}', 'fa-bell');
+addHeaderAction('starred-categories', '{% jstrans "Subscribed Categories" %}', 'fa-bell');
loadPartCategoryTable($('#table-starred-categories'), {
params: {
starred: true,
@@ -59,7 +59,7 @@ loadPartCategoryTable($('#table-starred-categories'), {
{% endif %}
{% if setting_part_latest %}
-addHeaderAction('latest-parts', '{% trans "Latest Parts" %}', 'fa-newspaper');
+addHeaderAction('latest-parts', '{% jstrans "Latest Parts" %}', 'fa-newspaper');
loadSimplePartTable("#table-latest-parts", "{% url 'api-part-list' %}", {
name: 'latest-parts',
params: {
@@ -74,7 +74,7 @@ loadSimplePartTable("#table-latest-parts", "{% url 'api-part-list' %}", {
{% endif %}
{% if setting_bom_validation %}
-addHeaderAction('bom-validation', '{% trans "BOM Waiting Validation" %}', 'fa-times-circle');
+addHeaderAction('bom-validation', '{% jstrans "BOM Waiting Validation" %}', 'fa-times-circle');
loadSimplePartTable("#table-bom-validation", "{% url 'api-part-list' %}", {
name: 'parts-invalid-bom',
params: {
@@ -103,7 +103,7 @@ loadSimplePartTable("#table-bom-validation", "{% url 'api-part-list' %}", {
{% if roles.stock.view %}
{% if setting_stock_recent %}
-addHeaderAction('recently-updated-stock', '{% trans "Recently Updated" %}', 'fa-clock');
+addHeaderAction('recently-updated-stock', '{% jstrans "Recently Updated" %}', 'fa-clock');
loadStockTable($('#table-recently-updated-stock'), {
disableFilters: true,
params: {
@@ -117,7 +117,7 @@ loadStockTable($('#table-recently-updated-stock'), {
{% endif %}
{% if setting_stock_low %}
-addHeaderAction('low-stock', '{% trans "Low Stock" %}', 'fa-flag');
+addHeaderAction('low-stock', '{% jstrans "Low Stock" %}', 'fa-flag');
loadSimplePartTable("#table-low-stock", "{% url 'api-part-list' %}", {
name: 'parts-low-stock',
params: {
@@ -131,7 +131,7 @@ loadSimplePartTable("#table-low-stock", "{% url 'api-part-list' %}", {
{% endif %}
{% if setting_stock_depleted %}
-addHeaderAction('depleted-stock', '{% trans "Depleted Stock" %}', 'fa-times');
+addHeaderAction('depleted-stock', '{% jstrans "Depleted Stock" %}', 'fa-times');
loadSimplePartTable("#table-depleted-stock", "{% url 'api-part-list' %}", {
name: 'parts-depleted-stock',
params: {
@@ -145,7 +145,7 @@ loadSimplePartTable("#table-depleted-stock", "{% url 'api-part-list' %}", {
{% endif %}
{% if setting_stock_needed %}
-addHeaderAction('stock-to-build', '{% trans "Required for Build Orders" %}', 'fa-bullhorn');
+addHeaderAction('stock-to-build', '{% jstrans "Required for Build Orders" %}', 'fa-bullhorn');
loadRequiredForBuildsPartsTable("#table-stock-to-build", {});
{% endif %}
@@ -153,7 +153,7 @@ loadRequiredForBuildsPartsTable("#table-stock-to-build", {});
{% if expiry %}
{% if setting_stock_expired %}
-addHeaderAction('expired-stock', '{% trans "Expired Stock" %}', 'fa-calendar-times');
+addHeaderAction('expired-stock', '{% jstrans "Expired Stock" %}', 'fa-calendar-times');
loadStockTable($("#table-expired-stock"), {
disableFilters: true,
params: {
@@ -169,7 +169,7 @@ loadStockTable($("#table-expired-stock"), {
{% endif %}
{% if setting_stock_stale %}
-addHeaderAction('stale-stock', '{% trans "Stale Stock" %}', 'fa-stopwatch');
+addHeaderAction('stale-stock', '{% jstrans "Stale Stock" %}', 'fa-stopwatch');
loadStockTable($("#table-stale-stock"), {
disableFilters: true,
params: {
@@ -193,10 +193,10 @@ loadStockTable($("#table-stale-stock"), {
{% to_list setting_build_pending setting_build_overdue as settings_list_build %}
{% if roles.build.view and True in settings_list_build %}
-addHeaderTitle('{% trans "Build Orders" %}');
+addHeaderTitle('{% jstrans "Build Orders" %}');
{% if setting_build_pending %}
-addHeaderAction('build-pending', '{% trans "Build Orders In Progress" %}', 'fa-cogs');
+addHeaderAction('build-pending', '{% jstrans "Build Orders In Progress" %}', 'fa-cogs');
loadBuildTable("#table-build-pending", {
locale: '{{ request.LANGUAGE_CODE }}',
params: {
@@ -207,7 +207,7 @@ loadBuildTable("#table-build-pending", {
{% endif %}
{% if setting_build_overdue %}
-addHeaderAction('build-overdue', '{% trans "Overdue Build Orders" %}', 'fa-calendar-times');
+addHeaderAction('build-overdue', '{% jstrans "Overdue Build Orders" %}', 'fa-calendar-times');
loadBuildTable("#table-build-overdue", {
locale: '{{ request.LANGUAGE_CODE }}',
params: {
@@ -224,10 +224,10 @@ loadBuildTable("#table-build-overdue", {
{% to_list setting_po_outstanding setting_po_overdue as settings_list_po %}
{% if roles.purchase_order.view and True in settings_list_po %}
-addHeaderTitle('{% trans "Purchase Orders" %}');
+addHeaderTitle('{% jstrans "Purchase Orders" %}');
{% if setting_po_outstanding %}
-addHeaderAction('po-outstanding', '{% trans "Outstanding Purchase Orders" %}', 'fa-sign-in-alt');
+addHeaderAction('po-outstanding', '{% jstrans "Outstanding Purchase Orders" %}', 'fa-sign-in-alt');
loadPurchaseOrderTable("#table-po-outstanding", {
url: "{% url 'api-po-list' %}",
params: {
@@ -238,7 +238,7 @@ loadPurchaseOrderTable("#table-po-outstanding", {
{% endif %}
{% if setting_po_overdue %}
-addHeaderAction('po-overdue', '{% trans "Overdue Purchase Orders" %}', 'fa-calendar-times');
+addHeaderAction('po-overdue', '{% jstrans "Overdue Purchase Orders" %}', 'fa-calendar-times');
loadPurchaseOrderTable("#table-po-overdue", {
url: "{% url 'api-po-list' %}",
params: {
@@ -256,10 +256,10 @@ loadPurchaseOrderTable("#table-po-overdue", {
{% to_list setting_so_outstanding setting_so_overdue setting_so_shipments_pending as settings_list_so %}
{% if roles.sales_order.view and True in settings_list_so %}
-addHeaderTitle('{% trans "Sales Orders" %}');
+addHeaderTitle('{% jstrans "Sales Orders" %}');
{% if setting_so_outstanding %}
-addHeaderAction('so-outstanding', '{% trans "Outstanding Sales Orders" %}', 'fa-sign-out-alt');
+addHeaderAction('so-outstanding', '{% jstrans "Outstanding Sales Orders" %}', 'fa-sign-out-alt');
loadSalesOrderTable("#table-so-outstanding", {
url: "{% url 'api-so-list' %}",
params: {
@@ -270,7 +270,7 @@ loadSalesOrderTable("#table-so-outstanding", {
{% endif %}
{% if setting_so_overdue %}
-addHeaderAction('so-overdue', '{% trans "Overdue Sales Orders" %}', 'fa-calendar-times');
+addHeaderAction('so-overdue', '{% jstrans "Overdue Sales Orders" %}', 'fa-calendar-times');
loadSalesOrderTable("#table-so-overdue", {
url: "{% url 'api-so-list' %}",
params: {
@@ -281,7 +281,7 @@ loadSalesOrderTable("#table-so-overdue", {
{% endif %}
{% if setting_so_shipments_pending %}
-addHeaderAction('so-shipments', '{% trans "Pending Shipments" %}', 'fa-truck-loading');
+addHeaderAction('so-shipments', '{% jstrans "Pending Shipments" %}', 'fa-truck-loading');
loadSalesOrderShipmentTable("#table-so-shipments", {
url: "{% url 'api-so-shipment-list' %}",
params: {
@@ -296,9 +296,9 @@ loadSalesOrderShipmentTable("#table-so-shipments", {
{% settings_value 'HOMEPAGE_NEWS' user=request.user as setting_news %}
{% if setting_news and user.is_staff %}
-addHeaderTitle('{% trans "InvenTree News" %}');
+addHeaderTitle('{% jstrans "InvenTree News" %}');
-addHeaderAction('news', '{% trans "Current News" %}', 'fa-newspaper');
+addHeaderAction('news', '{% jstrans "Current News" %}', 'fa-newspaper');
loadNewsFeedTable("#table-news", {
url: "{% url 'api-news-list' %}",
});
diff --git a/InvenTree/templates/InvenTree/notifications/notifications.html b/InvenTree/templates/InvenTree/notifications/notifications.html
index 7f95103a28..4ce156805d 100644
--- a/InvenTree/templates/InvenTree/notifications/notifications.html
+++ b/InvenTree/templates/InvenTree/notifications/notifications.html
@@ -35,7 +35,7 @@ loadNotificationTable("#inbox-table", {
params: {
read: false,
},
- no_matches: function() { return '{% trans "No unread notifications found" %}'; },
+ no_matches: function() { return '{% jstrans "No unread notifications found" %}'; },
});
$("#mark-all").on('click', function() {
@@ -55,7 +55,7 @@ $("#mark-all").on('click', function() {
loadNotificationTable("#history-table", {
name: 'history',
url: '{% url 'api-notifications-list' %}',
- no_matches: function() { return '{% trans "No notification history found" %}'; },
+ no_matches: function() { return '{% jstrans "No notification history found" %}'; },
}, true);
$('#history-delete').click(function() {
@@ -72,7 +72,7 @@ $('#history-delete').click(function() {
method: 'DELETE',
multi_delete: true,
preFormContent: html,
- title: '{% trans "Delete Notifications" %}',
+ title: '{% jstrans "Delete Notifications" %}',
refreshTable: '#history-table',
form_data: {
filters: {
@@ -86,7 +86,7 @@ $('#history-delete').click(function() {
$("#history-table").on('click', '.notification-delete', function() {
constructForm(`{% url "api-notifications-list" %}${$(this).attr('pk')}/`, {
method: 'DELETE',
- title: '{% trans "Delete Notification" %}',
+ title: '{% jstrans "Delete Notification" %}',
onSuccess: function(data) {
updateNotificationTables();
}
diff --git a/InvenTree/templates/InvenTree/search.html b/InvenTree/templates/InvenTree/search.html
index 0b4c28c8d1..326e5d84c8 100644
--- a/InvenTree/templates/InvenTree/search.html
+++ b/InvenTree/templates/InvenTree/search.html
@@ -79,9 +79,9 @@
}
{% if roles.part.view %}
- addItemTitle('{% trans "Part" %}');
+ addItemTitle('{% jstrans "Part" %}');
- addItem('part', '{% trans "Parts" %}', 'fa-shapes');
+ addItem('part', '{% jstrans "Parts" %}', 'fa-shapes');
loadPartTable("#table-part",
"{% url 'api-part-list' %}",
@@ -94,7 +94,7 @@
}
);
- addItem('category', '{% trans "Part Categories" %}', 'fa-sitemap');
+ addItem('category', '{% jstrans "Part Categories" %}', 'fa-sitemap');
loadPartCategoryTable($("#table-category"), {
params: {
@@ -102,7 +102,7 @@
}
});
- addItem('manufacturer-part', '{% trans "Manufacturer Parts" %}', 'fa-toolbox');
+ addItem('manufacturer-part', '{% jstrans "Manufacturer Parts" %}', 'fa-toolbox');
loadManufacturerPartTable(
"#table-manufacturer-part",
@@ -117,7 +117,7 @@
}
);
- addItem('supplier-part', '{% trans "Supplier Parts" %}', 'fa-pallet');
+ addItem('supplier-part', '{% jstrans "Supplier Parts" %}', 'fa-pallet');
loadSupplierPartTable(
"#table-supplier-part",
@@ -136,9 +136,9 @@
{% if roles.build.view %}
- addItemTitle('{% trans "Build" %}');
+ addItemTitle('{% jstrans "Build" %}');
- addItem('build-order', '{% trans "Build Orders" %}', 'fa-tools');
+ addItem('build-order', '{% jstrans "Build Orders" %}', 'fa-tools');
loadBuildTable('#table-build-order', {
locale: '{{ request.LANGUAGE_CODE }}',
@@ -150,9 +150,9 @@
{% endif %}
{% if roles.stock.view %}
- addItemTitle('{% trans "Stock" %}');
+ addItemTitle('{% jstrans "Stock" %}');
- addItem('stock', '{% trans "Stock Items" %}', 'fa-boxes');
+ addItem('stock', '{% jstrans "Stock Items" %}', 'fa-boxes');
loadStockTable($('#table-stock'), {
filterKey: 'stocksearch',
@@ -163,7 +163,7 @@
}
});
- addItem('location', '{% trans "Stock Locations" %}', 'fa-map-marker-alt');
+ addItem('location', '{% jstrans "Stock Locations" %}', 'fa-map-marker-alt');
loadStockLocationTable($("#table-location"), {
filterKey: 'locationsearch',
@@ -175,9 +175,9 @@
{% endif %}
{% if roles.purchase_order.view or roles.sales_order.view %}
- addItemTitle('{% trans "Company" %}');
+ addItemTitle('{% jstrans "Company" %}');
- addItem('manufacturer', '{% trans "Manufacturers" %}', 'fa-industry');
+ addItem('manufacturer', '{% jstrans "Manufacturers" %}', 'fa-industry');
loadCompanyTable('#table-manufacturer', "{% url 'api-company-list' %}", {
params: {
@@ -187,7 +187,7 @@
});
{% if roles.purchase_order.view %}
- addItem('supplier', '{% trans "Suppliers" %}', 'fa-building');
+ addItem('supplier', '{% jstrans "Suppliers" %}', 'fa-building');
loadCompanyTable('#table-supplier', "{% url 'api-company-list' %}", {
params: {
@@ -196,7 +196,7 @@
}
});
- addItem('purchase-order', '{% trans "Purchase Orders" %}', 'fa-shopping-cart');
+ addItem('purchase-order', '{% jstrans "Purchase Orders" %}', 'fa-shopping-cart');
loadPurchaseOrderTable('#table-purchase-order', {
params: {
@@ -207,7 +207,7 @@
{% endif %}
{% if roles.sales_order.view %}
- addItem('customer', '{% trans "Customers" %}', 'fa-user-tie');
+ addItem('customer', '{% jstrans "Customers" %}', 'fa-user-tie');
loadCompanyTable('#table-customer', "{% url 'api-company-list' %}", {
params: {
@@ -216,7 +216,7 @@
}
});
- addItem('sales-orders', '{% trans "Sales Orders" %}', 'fa-truck');
+ addItem('sales-orders', '{% jstrans "Sales Orders" %}', 'fa-truck');
loadSalesOrderTable('#table-sales-orders', {
params: {
diff --git a/InvenTree/templates/InvenTree/settings/settings_js.html b/InvenTree/templates/InvenTree/settings/settings_js.html
index 9eff1e7e43..6aea5650e3 100644
--- a/InvenTree/templates/InvenTree/settings/settings_js.html
+++ b/InvenTree/templates/InvenTree/settings/settings_js.html
@@ -55,14 +55,14 @@ $('table').find('.btn-edit-setting').click(function() {
var title = '';
if (plugin != null) {
- title = '{% trans "Edit Plugin Setting" %}';
+ title = '{% jstrans "Edit Plugin Setting" %}';
} else if (notification) {
- title = '{% trans "Edit Notification Setting" %}';
+ title = '{% jstrans "Edit Notification Setting" %}';
setting = $(this).attr('pk');
} else if (is_global) {
- title = '{% trans "Edit Global Setting" %}';
+ title = '{% jstrans "Edit Global Setting" %}';
} else {
- title = '{% trans "Edit User Setting" %}';
+ title = '{% jstrans "Edit User Setting" %}';
}
editSetting(setting, {
diff --git a/InvenTree/templates/InvenTree/settings/settings_staff_js.html b/InvenTree/templates/InvenTree/settings/settings_staff_js.html
index 512d21898d..c762a31cc1 100644
--- a/InvenTree/templates/InvenTree/settings/settings_staff_js.html
+++ b/InvenTree/templates/InvenTree/settings/settings_staff_js.html
@@ -41,12 +41,12 @@ onPanelLoad('pricing', function() {
{
field: 'currency',
sortable: true,
- title: '{% trans "Currency" %}',
+ title: '{% jstrans "Currency" %}',
},
{
field: 'rate',
sortable: true,
- title: '{% trans "Rate" %}',
+ title: '{% jstrans "Rate" %}',
}
]
});
@@ -64,21 +64,21 @@ onPanelLoad('units', function() {
columns: [
{
field: 'name',
- title: '{% trans "Name" %}',
+ title: '{% jstrans "Name" %}',
},
{
field: 'definition',
- title: '{% trans "Definition" %}',
+ title: '{% jstrans "Definition" %}',
},
{
field: 'symbol',
- title: '{% trans "Symbol" %}',
+ title: '{% jstrans "Symbol" %}',
formatter: function(value, row) {
let html = value;
let buttons = '';
- buttons += makeEditButton('button-units-edit', row.pk, '{% trans "Edit" %}');
- buttons += makeDeleteButton('button-units-delete', row.pk, '{% trans "Delete" %}');
+ buttons += makeEditButton('button-units-edit', row.pk, '{% jstrans "Edit" %}');
+ buttons += makeDeleteButton('button-units-delete', row.pk, '{% jstrans "Delete" %}');
html += wrapButtons(buttons);
return html;
@@ -92,7 +92,7 @@ onPanelLoad('units', function() {
let pk = $(this).attr('pk');
constructForm(`{% url "api-custom-unit-list" %}${pk}/`, {
- title: '{% trans "Edit Custom Unit" %}',
+ title: '{% jstrans "Edit Custom Unit" %}',
fields: {
name: {},
definition: {},
@@ -107,7 +107,7 @@ onPanelLoad('units', function() {
let pk = $(this).attr('pk');
constructForm(`{% url "api-custom-unit-list" %}${pk}/`, {
- title: '{% trans "Delete Custom Unit" %}',
+ title: '{% jstrans "Delete Custom Unit" %}',
method: 'DELETE',
refreshTable: '#physical-units-table',
});
@@ -121,7 +121,7 @@ onPanelLoad('units', function() {
definition: {},
symbol: {},
},
- title: '{% trans "New Custom Unit" %}',
+ title: '{% jstrans "New Custom Unit" %}',
method: 'POST',
refreshTable: '#physical-units-table',
});
@@ -137,17 +137,17 @@ onPanelLoad('project-codes', function() {
search: true,
sortable: true,
formatNoMatches: function() {
- return '{% trans "No project codes found" %}';
+ return '{% jstrans "No project codes found" %}';
},
columns: [
{
field: 'code',
sortable: true,
- title: '{% trans "Project Code" %}',
+ title: '{% jstrans "Project Code" %}',
},
{
field: 'responsible',
- title: '{% trans "Responsible" %}',
+ title: '{% jstrans "Responsible" %}',
formatter: function(value, row) {
if (!row.responsible_detail) {
return '-';
@@ -155,7 +155,7 @@ onPanelLoad('project-codes', function() {
var html = row.responsible_detail.name;
- if (row.responsible_detail.label == '{% trans "group" %}') {
+ if (row.responsible_detail.label == '{% jstrans "group" %}') {
html += ``;
} else {
html += ``;
@@ -167,13 +167,13 @@ onPanelLoad('project-codes', function() {
{
field: 'description',
sortable: false,
- title: '{% trans "Description" %}',
+ title: '{% jstrans "Description" %}',
formatter: function(value, row) {
let html = value;
let buttons = '';
- buttons += makeEditButton('button-project-code-edit', row.pk, '{% trans "Edit Project Code" %}');
- buttons += makeDeleteButton('button-project-code-delete', row.pk, '{% trans "Delete Project Code" %}');
+ buttons += makeEditButton('button-project-code-edit', row.pk, '{% jstrans "Edit Project Code" %}');
+ buttons += makeDeleteButton('button-project-code-delete', row.pk, '{% jstrans "Delete Project Code" %}');
html += wrapButtons(buttons);
return html;
@@ -186,7 +186,7 @@ onPanelLoad('project-codes', function() {
let pk = $(this).attr('pk');
constructForm(`{% url "api-project-code-list" %}${pk}/`, {
- title: '{% trans "Edit Project Code" %}',
+ title: '{% jstrans "Edit Project Code" %}',
fields: {
code: {},
description: {},
@@ -200,7 +200,7 @@ onPanelLoad('project-codes', function() {
let pk = $(this).attr('pk');
constructForm(`{% url "api-project-code-list" %}${pk}/`, {
- title: '{% trans "Delete Project Code" %}',
+ title: '{% jstrans "Delete Project Code" %}',
method: 'DELETE',
refreshTable: '#project-code-table',
});
@@ -213,7 +213,7 @@ onPanelLoad('project-codes', function() {
code: {},
description: {},
},
- title: '{% trans "New Project Code" %}',
+ title: '{% jstrans "New Project Code" %}',
method: 'POST',
refreshTable: '#project-code-table',
});
@@ -282,7 +282,7 @@ onPanelLoad('category', function() {
});
$('#cat-param-table').inventreeTable({
- formatNoMatches: function() { return '{% trans "No category parameter templates found" %}'; },
+ formatNoMatches: function() { return '{% jstrans "No category parameter templates found" %}'; },
columns: [
{
field: 'pk',
@@ -292,21 +292,21 @@ onPanelLoad('category', function() {
},
{
field: 'parameter_template_detail.name',
- title: '{% trans "Parameter Template" %}',
+ title: '{% jstrans "Parameter Template" %}',
sortable: 'true',
},
{
field: 'category_detail.pathstring',
- title: '{% trans "Category" %}',
+ title: '{% jstrans "Category" %}',
},
{
field: 'default_value',
- title: '{% trans "Default Value" %}',
+ title: '{% jstrans "Default Value" %}',
sortable: 'true',
formatter: function(value, row, index, field) {
let buttons = '';
- buttons += makeEditButton('template-edit', row.pk, '{% trans "Edit Template" %}');
- buttons += makeDeleteButton('template-delete', row.pk, '{% trans "Delete Template" %}');
+ buttons += makeEditButton('template-edit', row.pk, '{% jstrans "Edit Template" %}');
+ buttons += makeDeleteButton('template-delete', row.pk, '{% jstrans "Delete Template" %}');
let html = value
html += wrapButtons(buttons);
@@ -323,7 +323,7 @@ onPanelLoad('category', function() {
var pk = $(this).attr('pk');
constructForm(`/api/part/category/parameters/${pk}/`, {
- title: '{% trans "Edit Category Parameter Template" %}',
+ title: '{% jstrans "Edit Category Parameter Template" %}',
fields: {
parameter_template: {},
category: {
@@ -350,7 +350,7 @@ onPanelLoad('category', function() {
constructForm(`/api/part/category/parameters/${pk}/`, {
method: 'DELETE',
- title: '{% trans "Delete Category Parameter Template" %}',
+ title: '{% jstrans "Delete Category Parameter Template" %}',
onSuccess: function() {
loadTemplateTable(pk);
}
@@ -385,7 +385,7 @@ onPanelLoad('category', function() {
var pk = $('#category-select').val();
constructForm('{% url "api-part-category-parameter-list" %}', {
- title: '{% trans "Create Category Parameter Template" %}',
+ title: '{% jstrans "Create Category Parameter Template" %}',
method: 'POST',
fields: {
parameter_template: {},
@@ -415,7 +415,7 @@ onPanelLoad('part-parameters', function() {
constructForm('{% url "api-part-parameter-template-list" %}', {
fields: partParameterTemplateFields(),
method: 'POST',
- title: '{% trans "Create Part Parameter Template" %}',
+ title: '{% jstrans "Create Part Parameter Template" %}',
refreshTable: '#param-table',
});
});
@@ -437,34 +437,34 @@ onPanelLoad("stock", function() {
search: true,
sortable: true,
formatNoMatches: function() {
- return '{% trans "No stock location types found" %}';
+ return '{% jstrans "No stock location types found" %}';
},
columns: [
{
field: 'name',
sortable: true,
- title: '{% trans "Name" %}',
+ title: '{% jstrans "Name" %}',
},
{
field: 'description',
sortable: false,
- title: '{% trans "Description" %}',
+ title: '{% jstrans "Description" %}',
},
{
field: 'icon',
sortable: true,
- title: '{% trans "Icon" %}',
+ title: '{% jstrans "Icon" %}',
},
{
field: 'location_count',
sortable: true,
- title: '{% trans "Location count" %}',
+ title: '{% jstrans "Location count" %}',
formatter: function(value, row) {
let html = value;
let buttons = '';
- buttons += makeEditButton('button-location-type-edit', row.pk, '{% trans "Edit Location Type" %}');
- buttons += makeDeleteButton('button-location-type-delete', row.pk, '{% trans "Delete Location type" %}');
+ buttons += makeEditButton('button-location-type-edit', row.pk, '{% jstrans "Edit Location Type" %}');
+ buttons += makeDeleteButton('button-location-type-delete', row.pk, '{% jstrans "Delete Location type" %}');
html += wrapButtons(buttons);
return html;
@@ -477,7 +477,7 @@ onPanelLoad("stock", function() {
let pk = $(this).attr('pk');
constructForm(`{% url "api-location-type-list" %}${pk}/`, {
- title: '{% trans "Edit Location Type" %}',
+ title: '{% jstrans "Edit Location Type" %}',
fields: stockLocationTypeFields(),
refreshTable: '#location-type-table',
});
@@ -487,7 +487,7 @@ onPanelLoad("stock", function() {
let pk = $(this).attr('pk');
constructForm(`{% url "api-location-type-list" %}${pk}/`, {
- title: '{% trans "Delete Location Type" %}',
+ title: '{% jstrans "Delete Location Type" %}',
method: 'DELETE',
refreshTable: '#location-type-table',
});
@@ -497,7 +497,7 @@ onPanelLoad("stock", function() {
// Construct a new location type
constructForm('{% url "api-location-type-list" %}', {
fields: stockLocationTypeFields(),
- title: '{% trans "New Location Type" %}',
+ title: '{% jstrans "New Location Type" %}',
method: 'POST',
refreshTable: '#location-type-table',
});
@@ -526,18 +526,18 @@ onPanelLoad('stocktake', function() {
columns: [
{
field: 'report',
- title: '{% trans "Report" %}',
+ title: '{% jstrans "Report" %}',
formatter: function(value, row) {
return attachmentLink(value);
}
},
{
field: 'part_count',
- title: '{% trans "Part Count" %}',
+ title: '{% jstrans "Part Count" %}',
},
{
field: 'date',
- title: '{% trans "Date" %}',
+ title: '{% jstrans "Date" %}',
sortable: true,
formatter: function(value, row) {
let html = renderDate(value);
diff --git a/InvenTree/templates/InvenTree/settings/user.html b/InvenTree/templates/InvenTree/settings/user.html
index 9a1fbcd135..7933ad72dd 100644
--- a/InvenTree/templates/InvenTree/settings/user.html
+++ b/InvenTree/templates/InvenTree/settings/user.html
@@ -215,7 +215,7 @@
{% block js_ready %}
(function() {
-var message = "{% trans 'Do you really want to remove the selected email address?' %}";
+var message = "{% jstrans 'Do you really want to remove the selected email address?' %}";
var actions = document.getElementsByName('action_remove');
if (actions.length) {
actions[0].addEventListener("click", function(e) {
diff --git a/InvenTree/templates/js/translated/api.js b/InvenTree/templates/js/translated/api.js
index c9bd3dbd1a..fb893c96e0 100644
--- a/InvenTree/templates/js/translated/api.js
+++ b/InvenTree/templates/js/translated/api.js
@@ -222,48 +222,48 @@ function showApiError(xhr, url) {
switch (xhr.status || 0) {
// No response
case 0:
- title = '{% trans "No Response" %}';
- message = '{% trans "No response from the InvenTree server" %}';
+ title = '{% jstrans "No Response" %}';
+ message = '{% jstrans "No response from the InvenTree server" %}';
break;
// Bad request
case 400:
// Note: Normally error code 400 is handled separately,
// and should now be shown here!
- title = '{% trans "Error 400: Bad request" %}';
- message = '{% trans "API request returned error code 400" %}';
+ title = '{% jstrans "Error 400: Bad request" %}';
+ message = '{% jstrans "API request returned error code 400" %}';
break;
// Not authenticated
case 401:
- title = '{% trans "Error 401: Not Authenticated" %}';
- message = '{% trans "Authentication credentials not supplied" %}';
+ title = '{% jstrans "Error 401: Not Authenticated" %}';
+ message = '{% jstrans "Authentication credentials not supplied" %}';
break;
// Permission denied
case 403:
- title = '{% trans "Error 403: Permission Denied" %}';
- message = '{% trans "You do not have the required permissions to access this function" %}';
+ title = '{% jstrans "Error 403: Permission Denied" %}';
+ message = '{% jstrans "You do not have the required permissions to access this function" %}';
break;
// Resource not found
case 404:
- title = '{% trans "Error 404: Resource Not Found" %}';
- message = '{% trans "The requested resource could not be located on the server" %}';
+ title = '{% jstrans "Error 404: Resource Not Found" %}';
+ message = '{% jstrans "The requested resource could not be located on the server" %}';
break;
// Method not allowed
case 405:
- title = '{% trans "Error 405: Method Not Allowed" %}';
- message = '{% trans "HTTP method not allowed at URL" %}';
+ title = '{% jstrans "Error 405: Method Not Allowed" %}';
+ message = '{% jstrans "HTTP method not allowed at URL" %}';
break;
// Timeout
case 408:
- title = '{% trans "Error 408: Timeout" %}';
- message = '{% trans "Connection timeout while requesting data from server" %}';
+ title = '{% jstrans "Error 408: Timeout" %}';
+ message = '{% jstrans "Connection timeout while requesting data from server" %}';
break;
case 503:
- title = '{% trans "Error 503: Service Unavailable" %}';
- message = '{% trans "The server is currently unavailable" %}';
+ title = '{% jstrans "Error 503: Service Unavailable" %}';
+ message = '{% jstrans "The server is currently unavailable" %}';
break;
default:
- title = '{% trans "Unhandled Error Code" %}';
- message = `{% trans "Error code" %}: ${xhr.status}`;
+ title = '{% jstrans "Unhandled Error Code" %}';
+ message = `{% jstrans "Error code" %}: ${xhr.status}`;
var response = xhr.responseJSON;
diff --git a/InvenTree/templates/js/translated/attachment.js b/InvenTree/templates/js/translated/attachment.js
index 4ec0b4b625..f4d551636a 100644
--- a/InvenTree/templates/js/translated/attachment.js
+++ b/InvenTree/templates/js/translated/attachment.js
@@ -45,7 +45,7 @@ function addAttachmentButtonCallbacks(url, fields={}) {
fields: file_fields,
method: 'POST',
refreshTable: '#attachment-table',
- title: '{% trans "Add Attachment" %}',
+ title: '{% jstrans "Add Attachment" %}',
});
});
@@ -67,7 +67,7 @@ function addAttachmentButtonCallbacks(url, fields={}) {
fields: link_fields,
method: 'POST',
refreshTable: '#attachment-table',
- title: '{% trans "Add Link" %}',
+ title: '{% jstrans "Add Link" %}',
});
});
}
@@ -111,13 +111,13 @@ function deleteAttachments(attachments, url, options={}) {
var html = `
- {% trans "All selected attachments will be deleted" %}
+ {% jstrans "All selected attachments will be deleted" %}
|
- {% trans "Attachment" %} |
- {% trans "Comment" %} |
+ {% jstrans "Attachment" %} |
+ {% jstrans "Comment" %} |
${rows}
@@ -126,7 +126,7 @@ function deleteAttachments(attachments, url, options={}) {
constructForm(url, {
method: 'DELETE',
multi_delete: true,
- title: '{% trans "Delete Attachments" %}',
+ title: '{% jstrans "Delete Attachments" %}',
preFormContent: html,
form_data: {
items: ids,
@@ -202,7 +202,7 @@ function makeAttachmentActions(permissions, options) {
actions.push({
label: 'delete',
icon: 'fa-trash-alt icon-red',
- title: '{% trans "Delete attachments" %}',
+ title: '{% jstrans "Delete attachments" %}',
callback: options.callback,
});
}
@@ -250,7 +250,7 @@ function loadAttachmentTable(url, options) {
{
label: 'attachments',
icon: 'fa-tools',
- title: '{% trans "Attachment actions" %}',
+ title: '{% jstrans "Attachment actions" %}',
actions: makeAttachmentActions(permissions, {
callback: function(attachments) {
deleteAttachments(attachments, url, options);
@@ -272,7 +272,7 @@ function loadAttachmentTable(url, options) {
url: url,
name: options.name || 'attachments',
formatNoMatches: function() {
- return '{% trans "No attachments found" %}';
+ return '{% jstrans "No attachments found" %}';
},
sortable: true,
search: true,
@@ -312,7 +312,7 @@ function loadAttachmentTable(url, options) {
}
},
refreshTable: '#attachment-table',
- title: '{% trans "Edit Attachment" %}',
+ title: '{% jstrans "Edit Attachment" %}',
});
});
}
@@ -323,7 +323,7 @@ function loadAttachmentTable(url, options) {
},
{
field: 'attachment',
- title: '{% trans "Attachment" %}',
+ title: '{% jstrans "Attachment" %}',
formatter: function(value, row) {
if (row.attachment) {
@@ -338,12 +338,12 @@ function loadAttachmentTable(url, options) {
},
{
field: 'comment',
- title: '{% trans "Comment" %}',
+ title: '{% jstrans "Comment" %}',
},
{
field: 'upload_date',
sortable: true,
- title: '{% trans "Upload Date" %}',
+ title: '{% jstrans "Upload Date" %}',
formatter: function(value, row) {
var html = renderDate(value);
@@ -363,7 +363,7 @@ function loadAttachmentTable(url, options) {
buttons += makeEditButton(
'button-attachment-edit',
row.pk,
- '{% trans "Edit attachment" %}',
+ '{% jstrans "Edit attachment" %}',
);
}
@@ -371,7 +371,7 @@ function loadAttachmentTable(url, options) {
buttons += makeDeleteButton(
'button-attachment-delete',
row.pk,
- '{% trans "Delete attachment" %}',
+ '{% jstrans "Delete attachment" %}',
);
}
diff --git a/InvenTree/templates/js/translated/barcode.js b/InvenTree/templates/js/translated/barcode.js
index e03d6f3950..966adc6a5e 100644
--- a/InvenTree/templates/js/translated/barcode.js
+++ b/InvenTree/templates/js/translated/barcode.js
@@ -40,23 +40,23 @@ var barcodeInputTimer = null;
*/
function makeBarcodeInput(placeholderText='', hintText='') {
- placeholderText = placeholderText || '{% trans "Scan barcode data here using barcode scanner" %}';
+ placeholderText = placeholderText || '{% jstrans "Scan barcode data here using barcode scanner" %}';
- hintText = hintText || '{% trans "Enter barcode data" %}';
+ hintText = hintText || '{% jstrans "Enter barcode data" %}';
var html = `