diff --git a/InvenTree/InvenTree/exceptions.py b/InvenTree/InvenTree/exceptions.py
index b2f014390d..f8742fe027 100644
--- a/InvenTree/InvenTree/exceptions.py
+++ b/InvenTree/InvenTree/exceptions.py
@@ -23,13 +23,18 @@ import InvenTree.sentry
logger = logging.getLogger('inventree')
-def log_error(path):
+def log_error(path, error_name=None, error_info=None, error_data=None):
"""Log an error to the database.
- Uses python exception handling to extract error details
Arguments:
path: The 'path' (most likely a URL) associated with this error (optional)
+
+ kwargs:
+ error_name: The name of the error (optional, overrides 'kind')
+ error_info: The error information (optional, overrides 'info')
+ error_data: The error data (optional, overrides 'data')
"""
kind, info, data = sys.exc_info()
@@ -37,19 +42,31 @@ def log_error(path):
if kind in settings.IGNORED_ERRORS:
return
+ if error_name:
+ kind = error_name
+ else:
+ kind = getattr(kind, '__name__', 'Unknown Error')
+
+ if error_info:
+ info = error_info
+
+ if error_data:
+ data = error_data
+ else:
+ data = '\n'.join(traceback.format_exception(kind, info, data))
+
# Log error to stderr
logger.error(info)
+ # Ensure the error information does not exceed field size limits
+ path = path[:200]
+ kind = kind[:128]
+
try:
- Error.objects.create(
- kind=kind.__name__,
- info=info,
- data='\n'.join(traceback.format_exception(kind, info, data)),
- path=path,
- )
- except (OperationalError, IntegrityError):
+ Error.objects.create(kind=kind, info=info or '', data=data or '', path=path)
+ except Exception:
# Not much we can do if logging the error throws a db exception
- pass
+ logger.exception('Failed to log exception to database')
def exception_handler(exc, context):
diff --git a/InvenTree/InvenTree/forms.py b/InvenTree/InvenTree/forms.py
index b767f45c52..01acaac652 100644
--- a/InvenTree/InvenTree/forms.py
+++ b/InvenTree/InvenTree/forms.py
@@ -336,8 +336,16 @@ class CustomSocialAccountAdapter(
self, request, provider_id, error=None, exception=None, extra_context=None
):
"""Callback method for authentication errors."""
+ if not error:
+ error = request.GET.get('error', None)
+
+ if not exception:
+ exception = request.GET.get('error_description', None)
+
+ path = request.path or 'sso'
+
# Log the error to the database
- log_error(request.path if request else 'sso')
+ log_error(path, error_name=error, error_data=exception)
logger.error("SSO error for provider '%s' - check admin error log", provider_id)
diff --git a/InvenTree/InvenTree/templatetags/i18n.py b/InvenTree/InvenTree/templatetags/i18n.py
index ceaba38625..fffaa352c2 100644
--- a/InvenTree/InvenTree/templatetags/i18n.py
+++ b/InvenTree/InvenTree/templatetags/i18n.py
@@ -62,7 +62,7 @@ class CustomTranslateNode(TranslateNode):
@register.tag('translate')
@register.tag('trans')
-def do_translate(parser, token, escape=False):
+def do_translate(parser, token):
"""Custom translation function.
- Lifted from https://github.com/django/django/blob/main/django/templatetags/i18n.py.
@@ -74,6 +74,7 @@ def do_translate(parser, token, escape=False):
message_string = parser.compile_filter(bits[1])
remaining = bits[2:]
+ escape = False
noop = False
asvar = None
message_context = None
@@ -110,6 +111,8 @@ def do_translate(parser, token, escape=False):
"No argument provided to the '%s' tag for the as option." % bits[0]
)
asvar = value
+ elif option == 'escape':
+ escape = True
else:
raise TemplateSyntaxError(
"Unknown argument for '%s' tag: '%s'. The only options "
@@ -123,18 +126,6 @@ def do_translate(parser, token, escape=False):
)
-@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
register.tag('blocktrans', django.templatetags.i18n.do_block_translate)
register.tag('blocktranslate', django.templatetags.i18n.do_block_translate)
diff --git a/InvenTree/build/templates/build/build_base.html b/InvenTree/build/templates/build/build_base.html
index e9de6bf97a..4ead85bca8 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: '{% jstrans "Delete Build Order" %}',
+ title: '{% trans "Delete Build Order" escape %}',
redirect: "{% url 'build-index' %}",
}
);
@@ -280,7 +280,7 @@ src="{% static 'img/blank_image.png' %}"
$('#show-qr-code').click(function() {
showQRDialog(
- '{% jstrans "Build Order QR Code" %}',
+ '{% trans "Build Order QR Code" escape %}',
'{"build": {{ build.pk }} }'
);
});
@@ -292,7 +292,7 @@ src="{% static 'img/blank_image.png' %}"
build: {{ build.pk }},
},
{
- title: '{% jstrans "Link Barcode to Build Order" %}',
+ title: '{% trans "Link Barcode to Build Order" escape %}',
}
);
});
diff --git a/InvenTree/build/templates/build/detail.html b/InvenTree/build/templates/build/detail.html
index a290ce7021..ffde5c2878 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(
- '{% jstrans "Allocation Complete" %}',
- '{% jstrans "All lines have been fully allocated" %}',
+ '{% trans "Allocation Complete" escape %}',
+ '{% trans "All lines have been fully allocated" escape %}',
);
} else {
diff --git a/InvenTree/company/templates/company/company_base.html b/InvenTree/company/templates/company/company_base.html
index 70dfd364cb..87f8cf10c9 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: '{% jstrans "Delete Company" %}',
+ title: '{% trans "Delete Company" escape %}',
redirect: '{% url "company-index" %}',
});
});
@@ -202,10 +202,10 @@
$('#company-image-delete').click(function(event) {
event.stopPropagation();
showQuestionDialog(
- '{% jstrans "Remove Image" %}',
- '{% jstrans "Remove associated image from this company" %}',
+ '{% trans "Remove Image" escape %}',
+ '{% trans "Remove associated image from this company" escape %}',
{
- accept_text: '{% jstrans "Remove" %}',
+ accept_text: '{% trans "Remove" escape %}',
submitClass: 'danger',
accept: function() {
inventreePut(
@@ -234,7 +234,7 @@
fields: {
image: {},
},
- title: '{% jstrans "Upload Image" %}',
+ title: '{% trans "Upload Image" escape %}',
onSuccess: function(data) {
reloadImage(data);
}
@@ -249,7 +249,7 @@
'{% url "api-company-detail" company.pk %}',
{
method: 'PATCH',
- title: '{% jstrans "Download Image" %}',
+ title: '{% trans "Download Image" escape %}',
fields: {
remote_image: {},
},
diff --git a/InvenTree/company/templates/company/manufacturer_part.html b/InvenTree/company/templates/company/manufacturer_part.html
index 50ad8048b2..08e6f38568 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: '{% jstrans "Add Parameter" %}',
+ title: '{% trans "Add Parameter" escape %}',
refreshTable: '#parameter-table',
});
});
diff --git a/InvenTree/company/templates/company/supplier_part.html b/InvenTree/company/templates/company/supplier_part.html
index b30c55f04e..2949926cb7 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(
- '{% jstrans "Supplier Part QR Code" %}',
+ '{% trans "Supplier Part QR Code" escape %}',
'{"supplierpart": {{ part.pk }} }'
);
});
@@ -284,7 +284,7 @@ $("#barcode-link").click(function() {
supplierpart: {{ part.pk }},
},
{
- title: '{% jstrans "Link Barcode to Supplier Part" %}',
+ title: '{% trans "Link Barcode to Supplier Part" escape %}',
}
);
});
@@ -356,7 +356,7 @@ $('#update-part-availability').click(function() {
fields: {
available: {},
},
- title: '{% jstrans "Update Part Availability" %}',
+ title: '{% trans "Update Part Availability" escape %}',
onSuccess: function() {
location.reload();
}
diff --git a/InvenTree/order/templates/order/order_base.html b/InvenTree/order/templates/order/order_base.html
index fbd3dcac67..173eaeb119 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(
- '{% jstrans "Purchase Order QR Code" %}',
+ '{% trans "Purchase Order QR Code" escape %}',
'{"purchaseorder": {{ order.pk }} }'
);
});
@@ -327,7 +327,7 @@ $("#barcode-link").click(function() {
purchaseorder: {{ order.pk }},
},
{
- title: '{% jstrans "Link Barcode to Purchase Order" %}',
+ title: '{% trans "Link Barcode to Purchase Order" escape %}',
}
);
});
diff --git a/InvenTree/order/templates/order/return_order_base.html b/InvenTree/order/templates/order/return_order_base.html
index 1a5542b2d8..eb80a70d53 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(
- '{% jstrans "Return Order QR Code" %}',
+ '{% trans "Return Order QR Code" escape %}',
'{"returnorder": {{ order.pk }} }'
);
});
@@ -272,7 +272,7 @@ $("#barcode-link").click(function() {
returnorder: {{ order.pk }},
},
{
- title: '{% jstrans "Link Barcode to Return Order" %}',
+ title: '{% trans "Link Barcode to Return Order" escape %}',
}
);
});
diff --git a/InvenTree/order/templates/order/sales_order_base.html b/InvenTree/order/templates/order/sales_order_base.html
index 736765959e..f184d8d2bc 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(
- '{% jstrans "Sales Order QR Code" %}',
+ '{% trans "Sales Order QR Code" escape %}',
'{"salesorder": {{ order.pk }} }'
);
});
@@ -321,7 +321,7 @@ $("#barcode-link").click(function() {
salesorder: {{ order.pk }},
},
{
- title: '{% jstrans "Link Barcode to Sales Order" %}',
+ title: '{% trans "Link Barcode to Sales Order" escape %}',
}
);
});
diff --git a/InvenTree/part/templates/part/detail.html b/InvenTree/part/templates/part/detail.html
index 335527c8c6..4cf36dc387 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: '{% jstrans "Related Part" %}',
+ label: '{% trans "Related Part" escape %}',
filters: {
exclude_id: {{ part.pk }},
exclude_related: {{ part.pk }},
@@ -664,7 +664,7 @@
}
},
focus: 'part_2',
- title: '{% jstrans "Add Related Part" %}',
+ title: '{% trans "Add Related Part" escape %}',
refreshTable: '#related-parts-table',
});
});
@@ -749,7 +749,7 @@
fields: partTestTemplateFields({
part: {{ part.pk }}
}),
- title: '{% jstrans "Add Test Result Template" %}',
+ title: '{% trans "Add Test Result Template" escape %}',
refreshTable: '#test-template-table',
});
});
diff --git a/InvenTree/part/templates/part/part_base.html b/InvenTree/part/templates/part/part_base.html
index cc71f8e19b..16ce73b291 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(
- '{% jstrans "Part QR Code" %}',
+ '{% trans "Part QR Code" escape %}',
'{"part": {{ part.pk }} }',
);
});
@@ -458,7 +458,7 @@
part: {{ part.pk }},
},
{
- title: '{% jstrans "Link Barcode to Part" %}',
+ title: '{% trans "Link Barcode to Part" escape %}',
}
);
});
@@ -509,7 +509,7 @@
launchModalForm(
"{% url 'part-pricing' part.id %}",
{
- submit_text: '{% jstrans "Calculate" %}',
+ submit_text: '{% trans "Calculate" escape %}',
hideErrorMessage: true,
}
);
@@ -525,10 +525,10 @@
$('#part-image-delete').click(function(event) {
event.stopPropagation();
showQuestionDialog(
- '{% jstrans "Remove Image" %}',
- '{% jstrans "Remove associated image from this part" %}',
+ '{% trans "Remove Image" escape %}',
+ '{% trans "Remove associated image from this part" escape %}',
{
- accept_text: '{% jstrans "Remove" %}',
+ accept_text: '{% trans "Remove" escape %}',
submitClass: 'danger',
accept: function() {
inventreePut(
@@ -557,7 +557,7 @@
fields: {
image: {},
},
- title: '{% jstrans "Upload Image" %}',
+ title: '{% trans "Upload Image" escape %}',
onSuccess: function(data) {
reloadImage(data);
}
@@ -577,7 +577,7 @@
sidePagination: 'server',
singleSelect: true,
formatNoMatches: function() {
- return '{% jstrans "No matching images found" %}';
+ return '{% trans "No matching images found" escape %}';
},
columns: [
{
@@ -611,7 +611,7 @@
'{% url "api-part-detail" part.pk %}',
{
method: 'PATCH',
- title: '{% jstrans "Download Image" %}',
+ title: '{% trans "Download Image" escape %}',
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('{% jstrans "Hide Part Details" %}');
+ $('#toggle-details-button').html('{% trans "Hide Part Details" escape %}');
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('{% jstrans "Show Part Details" %}');
+ $('#toggle-details-button').html('{% trans "Show Part Details" escape %}');
inventreeSave('show-part-details', false);
});
diff --git a/InvenTree/part/templates/part/pricing_javascript.html b/InvenTree/part/templates/part/pricing_javascript.html
index ae3795bdcc..2bbbcd7405 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: '{% jstrans "Update Pricing" %}',
+ title: '{% trans "Update Pricing" escape %}',
fields: {
override_min: {},
override_min_currency: {},
diff --git a/InvenTree/stock/templates/stock/item.html b/InvenTree/stock/templates/stock/item.html
index 78076a1c9a..d811aa17f3 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: '{% jstrans "Delete Test Data" %}',
+ title: '{% trans "Delete Test Data" escape %}',
preFormContent: html,
refreshTable: '#test-result-table',
});
@@ -293,7 +293,7 @@
fields: stockItemTestResultFields({
stock_item: {{ item.pk }},
}),
- title: '{% jstrans "Add Test Result" %}',
+ title: '{% trans "Add Test Result" escape %}',
refreshTable: '#test-result-table',
});
});
diff --git a/InvenTree/stock/templates/stock/item_base.html b/InvenTree/stock/templates/stock/item_base.html
index aeb5287817..c0e12b172c 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: '{% jstrans "stock item" %}',
+ singular_name: '{% trans "stock item" escape %}',
url: '{% url "api-stockitem-label-list" %}',
key: 'item',
});
@@ -529,7 +529,7 @@ $('#stock-edit-status').click(function () {
status: {},
},
reload: true,
- title: '{% jstrans "Edit Stock Status" %}',
+ title: '{% trans "Edit Stock Status" escape %}',
});
});
@@ -538,7 +538,7 @@ $('#stock-edit-status').click(function () {
{% if barcodes %}
$("#show-qr-code").click(function() {
showQRDialog(
- '{% jstrans "Stock Item QR Code" %}',
+ '{% trans "Stock Item QR Code" escape %}',
'{"stockitem": {{ item.pk }} }',
);
});
@@ -549,7 +549,7 @@ $("#barcode-link").click(function() {
stockitem: {{ item.pk }},
},
{
- title: '{% jstrans "Link Barcode to Stock Item" %}',
+ title: '{% trans "Link Barcode to Stock Item" escape %}',
}
);
});
@@ -625,7 +625,7 @@ $("#stock-convert").click(function() {
'{% url "api-stock-item-convert" item.pk %}',
{
method: 'POST',
- title: '{% jstrans "Convert Stock Item" %}',
+ title: '{% trans "Convert Stock Item" escape %}',
preFormContent: html,
reload: true,
fields: {
@@ -659,7 +659,7 @@ $("#stock-return-from-customer").click(function() {
},
},
method: 'POST',
- title: '{% jstrans "Return to Stock" %}',
+ title: '{% trans "Return to Stock" escape %}',
reload: true,
});
diff --git a/InvenTree/stock/templates/stock/location.html b/InvenTree/stock/templates/stock/location.html
index f4e1c20179..bfe16dce6a 100644
--- a/InvenTree/stock/templates/stock/location.html
+++ b/InvenTree/stock/templates/stock/location.html
@@ -286,7 +286,7 @@
printLabels({
items: locs,
- singular_name: '{% jstrans "stock location" %}',
+ singular_name: '{% trans "stock location" escape %}',
key: 'location',
url: '{% url "api-stocklocation-label-list" %}',
});
@@ -314,7 +314,7 @@
{
onSuccess: function() {
showMessage(
- '{% jstrans "Scanned stock container into this location" %}',
+ '{% trans "Scanned stock container into this location" escape %}',
{
style: 'success',
}
@@ -387,7 +387,7 @@
{% if barcodes %}
$('#show-qr-code').click(function() {
showQRDialog(
- '{% jstrans "Stock Location QR Code" %}',
+ '{% trans "Stock Location QR Code" escape %}',
'{"stocklocation": {{ location.pk }} }'
);
});
@@ -398,7 +398,7 @@
stocklocation: {{ location.pk }},
},
{
- title: '{% jstrans "Link Barcode to Stock Location" %}',
+ title: '{% trans "Link Barcode to Stock Location" escape %}',
}
);
});
diff --git a/InvenTree/templates/InvenTree/index.html b/InvenTree/templates/InvenTree/index.html
index 013c638e2b..4586c03508 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('{% jstrans "Parts" %}');
+addHeaderTitle('{% trans "Parts" escape %}');
{% if setting_part_starred %}
-addHeaderAction('starred-parts', '{% jstrans "Subscribed Parts" %}', 'fa-bell');
+addHeaderAction('starred-parts', '{% trans "Subscribed Parts" escape %}', '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', '{% jstrans "Subscribed Categories" %}', 'fa-bell');
+addHeaderAction('starred-categories', '{% trans "Subscribed Categories" escape %}', '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', '{% jstrans "Latest Parts" %}', 'fa-newspaper');
+addHeaderAction('latest-parts', '{% trans "Latest Parts" escape %}', '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', '{% jstrans "BOM Waiting Validation" %}', 'fa-times-circle');
+addHeaderAction('bom-validation', '{% trans "BOM Waiting Validation" escape %}', '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', '{% jstrans "Recently Updated" %}', 'fa-clock');
+addHeaderAction('recently-updated-stock', '{% trans "Recently Updated" escape %}', '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', '{% jstrans "Low Stock" %}', 'fa-flag');
+addHeaderAction('low-stock', '{% trans "Low Stock" escape %}', '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', '{% jstrans "Depleted Stock" %}', 'fa-times');
+addHeaderAction('depleted-stock', '{% trans "Depleted Stock" escape %}', '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', '{% jstrans "Required for Build Orders" %}', 'fa-bullhorn');
+addHeaderAction('stock-to-build', '{% trans "Required for Build Orders" escape %}', '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', '{% jstrans "Expired Stock" %}', 'fa-calendar-times');
+addHeaderAction('expired-stock', '{% trans "Expired Stock" escape %}', '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', '{% jstrans "Stale Stock" %}', 'fa-stopwatch');
+addHeaderAction('stale-stock', '{% trans "Stale Stock" escape %}', '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('{% jstrans "Build Orders" %}');
+addHeaderTitle('{% trans "Build Orders" escape %}');
{% if setting_build_pending %}
-addHeaderAction('build-pending', '{% jstrans "Build Orders In Progress" %}', 'fa-cogs');
+addHeaderAction('build-pending', '{% trans "Build Orders In Progress" escape %}', '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', '{% jstrans "Overdue Build Orders" %}', 'fa-calendar-times');
+addHeaderAction('build-overdue', '{% trans "Overdue Build Orders" escape %}', '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('{% jstrans "Purchase Orders" %}');
+addHeaderTitle('{% trans "Purchase Orders" escape %}');
{% if setting_po_outstanding %}
-addHeaderAction('po-outstanding', '{% jstrans "Outstanding Purchase Orders" %}', 'fa-sign-in-alt');
+addHeaderAction('po-outstanding', '{% trans "Outstanding Purchase Orders" escape %}', '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', '{% jstrans "Overdue Purchase Orders" %}', 'fa-calendar-times');
+addHeaderAction('po-overdue', '{% trans "Overdue Purchase Orders" escape %}', '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('{% jstrans "Sales Orders" %}');
+addHeaderTitle('{% trans "Sales Orders" escape %}');
{% if setting_so_outstanding %}
-addHeaderAction('so-outstanding', '{% jstrans "Outstanding Sales Orders" %}', 'fa-sign-out-alt');
+addHeaderAction('so-outstanding', '{% trans "Outstanding Sales Orders" escape %}', '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', '{% jstrans "Overdue Sales Orders" %}', 'fa-calendar-times');
+addHeaderAction('so-overdue', '{% trans "Overdue Sales Orders" escape %}', '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', '{% jstrans "Pending Shipments" %}', 'fa-truck-loading');
+addHeaderAction('so-shipments', '{% trans "Pending Shipments" escape %}', '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('{% jstrans "InvenTree News" %}');
+addHeaderTitle('{% trans "InvenTree News" escape %}');
-addHeaderAction('news', '{% jstrans "Current News" %}', 'fa-newspaper');
+addHeaderAction('news', '{% trans "Current News" escape %}', '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 4ce156805d..4e0788a5ad 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 '{% jstrans "No unread notifications found" %}'; },
+ no_matches: function() { return '{% trans "No unread notifications found" escape %}'; },
});
$("#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 '{% jstrans "No notification history found" %}'; },
+ no_matches: function() { return '{% trans "No notification history found" escape %}'; },
}, true);
$('#history-delete').click(function() {
@@ -72,7 +72,7 @@ $('#history-delete').click(function() {
method: 'DELETE',
multi_delete: true,
preFormContent: html,
- title: '{% jstrans "Delete Notifications" %}',
+ title: '{% trans "Delete Notifications" escape %}',
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: '{% jstrans "Delete Notification" %}',
+ title: '{% trans "Delete Notification" escape %}',
onSuccess: function(data) {
updateNotificationTables();
}
diff --git a/InvenTree/templates/InvenTree/search.html b/InvenTree/templates/InvenTree/search.html
index 326e5d84c8..a295ecaf33 100644
--- a/InvenTree/templates/InvenTree/search.html
+++ b/InvenTree/templates/InvenTree/search.html
@@ -79,9 +79,9 @@
}
{% if roles.part.view %}
- addItemTitle('{% jstrans "Part" %}');
+ addItemTitle('{% trans "Part" escape %}');
- addItem('part', '{% jstrans "Parts" %}', 'fa-shapes');
+ addItem('part', '{% trans "Parts" escape %}', 'fa-shapes');
loadPartTable("#table-part",
"{% url 'api-part-list' %}",
@@ -94,7 +94,7 @@
}
);
- addItem('category', '{% jstrans "Part Categories" %}', 'fa-sitemap');
+ addItem('category', '{% trans "Part Categories" escape %}', 'fa-sitemap');
loadPartCategoryTable($("#table-category"), {
params: {
@@ -102,7 +102,7 @@
}
});
- addItem('manufacturer-part', '{% jstrans "Manufacturer Parts" %}', 'fa-toolbox');
+ addItem('manufacturer-part', '{% trans "Manufacturer Parts" escape %}', 'fa-toolbox');
loadManufacturerPartTable(
"#table-manufacturer-part",
@@ -117,7 +117,7 @@
}
);
- addItem('supplier-part', '{% jstrans "Supplier Parts" %}', 'fa-pallet');
+ addItem('supplier-part', '{% trans "Supplier Parts" escape %}', 'fa-pallet');
loadSupplierPartTable(
"#table-supplier-part",
@@ -136,9 +136,9 @@
{% if roles.build.view %}
- addItemTitle('{% jstrans "Build" %}');
+ addItemTitle('{% trans "Build" escape %}');
- addItem('build-order', '{% jstrans "Build Orders" %}', 'fa-tools');
+ addItem('build-order', '{% trans "Build Orders" escape %}', 'fa-tools');
loadBuildTable('#table-build-order', {
locale: '{{ request.LANGUAGE_CODE }}',
@@ -150,9 +150,9 @@
{% endif %}
{% if roles.stock.view %}
- addItemTitle('{% jstrans "Stock" %}');
+ addItemTitle('{% trans "Stock" escape %}');
- addItem('stock', '{% jstrans "Stock Items" %}', 'fa-boxes');
+ addItem('stock', '{% trans "Stock Items" escape %}', 'fa-boxes');
loadStockTable($('#table-stock'), {
filterKey: 'stocksearch',
@@ -163,7 +163,7 @@
}
});
- addItem('location', '{% jstrans "Stock Locations" %}', 'fa-map-marker-alt');
+ addItem('location', '{% trans "Stock Locations" escape %}', '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('{% jstrans "Company" %}');
+ addItemTitle('{% trans "Company" escape %}');
- addItem('manufacturer', '{% jstrans "Manufacturers" %}', 'fa-industry');
+ addItem('manufacturer', '{% trans "Manufacturers" escape %}', 'fa-industry');
loadCompanyTable('#table-manufacturer', "{% url 'api-company-list' %}", {
params: {
@@ -187,7 +187,7 @@
});
{% if roles.purchase_order.view %}
- addItem('supplier', '{% jstrans "Suppliers" %}', 'fa-building');
+ addItem('supplier', '{% trans "Suppliers" escape %}', 'fa-building');
loadCompanyTable('#table-supplier', "{% url 'api-company-list' %}", {
params: {
@@ -196,7 +196,7 @@
}
});
- addItem('purchase-order', '{% jstrans "Purchase Orders" %}', 'fa-shopping-cart');
+ addItem('purchase-order', '{% trans "Purchase Orders" escape %}', 'fa-shopping-cart');
loadPurchaseOrderTable('#table-purchase-order', {
params: {
@@ -207,7 +207,7 @@
{% endif %}
{% if roles.sales_order.view %}
- addItem('customer', '{% jstrans "Customers" %}', 'fa-user-tie');
+ addItem('customer', '{% trans "Customers" escape %}', 'fa-user-tie');
loadCompanyTable('#table-customer', "{% url 'api-company-list' %}", {
params: {
@@ -216,7 +216,7 @@
}
});
- addItem('sales-orders', '{% jstrans "Sales Orders" %}', 'fa-truck');
+ addItem('sales-orders', '{% trans "Sales Orders" escape %}', '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 6aea5650e3..cbc0b56e05 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 = '{% jstrans "Edit Plugin Setting" %}';
+ title = '{% trans "Edit Plugin Setting" escape %}';
} else if (notification) {
- title = '{% jstrans "Edit Notification Setting" %}';
+ title = '{% trans "Edit Notification Setting" escape %}';
setting = $(this).attr('pk');
} else if (is_global) {
- title = '{% jstrans "Edit Global Setting" %}';
+ title = '{% trans "Edit Global Setting" escape %}';
} else {
- title = '{% jstrans "Edit User Setting" %}';
+ title = '{% trans "Edit User Setting" escape %}';
}
editSetting(setting, {
diff --git a/InvenTree/templates/InvenTree/settings/settings_staff_js.html b/InvenTree/templates/InvenTree/settings/settings_staff_js.html
index c762a31cc1..85d90193db 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: '{% jstrans "Currency" %}',
+ title: '{% trans "Currency" escape %}',
},
{
field: 'rate',
sortable: true,
- title: '{% jstrans "Rate" %}',
+ title: '{% trans "Rate" escape %}',
}
]
});
@@ -64,21 +64,21 @@ onPanelLoad('units', function() {
columns: [
{
field: 'name',
- title: '{% jstrans "Name" %}',
+ title: '{% trans "Name" escape %}',
},
{
field: 'definition',
- title: '{% jstrans "Definition" %}',
+ title: '{% trans "Definition" escape %}',
},
{
field: 'symbol',
- title: '{% jstrans "Symbol" %}',
+ title: '{% trans "Symbol" escape %}',
formatter: function(value, row) {
let html = value;
let buttons = '';
- buttons += makeEditButton('button-units-edit', row.pk, '{% jstrans "Edit" %}');
- buttons += makeDeleteButton('button-units-delete', row.pk, '{% jstrans "Delete" %}');
+ buttons += makeEditButton('button-units-edit', row.pk, '{% trans "Edit" escape %}');
+ buttons += makeDeleteButton('button-units-delete', row.pk, '{% trans "Delete" escape %}');
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: '{% jstrans "Edit Custom Unit" %}',
+ title: '{% trans "Edit Custom Unit" escape %}',
fields: {
name: {},
definition: {},
@@ -107,7 +107,7 @@ onPanelLoad('units', function() {
let pk = $(this).attr('pk');
constructForm(`{% url "api-custom-unit-list" %}${pk}/`, {
- title: '{% jstrans "Delete Custom Unit" %}',
+ title: '{% trans "Delete Custom Unit" escape %}',
method: 'DELETE',
refreshTable: '#physical-units-table',
});
@@ -121,7 +121,7 @@ onPanelLoad('units', function() {
definition: {},
symbol: {},
},
- title: '{% jstrans "New Custom Unit" %}',
+ title: '{% trans "New Custom Unit" escape %}',
method: 'POST',
refreshTable: '#physical-units-table',
});
@@ -137,17 +137,17 @@ onPanelLoad('project-codes', function() {
search: true,
sortable: true,
formatNoMatches: function() {
- return '{% jstrans "No project codes found" %}';
+ return '{% trans "No project codes found" escape %}';
},
columns: [
{
field: 'code',
sortable: true,
- title: '{% jstrans "Project Code" %}',
+ title: '{% trans "Project Code" escape %}',
},
{
field: 'responsible',
- title: '{% jstrans "Responsible" %}',
+ title: '{% trans "Responsible" escape %}',
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 == '{% jstrans "group" %}') {
+ if (row.responsible_detail.label == '{% trans "group" escape %}') {
html += ``;
} else {
html += ``;
@@ -167,13 +167,13 @@ onPanelLoad('project-codes', function() {
{
field: 'description',
sortable: false,
- title: '{% jstrans "Description" %}',
+ title: '{% trans "Description" escape %}',
formatter: function(value, row) {
let html = value;
let buttons = '';
- buttons += makeEditButton('button-project-code-edit', row.pk, '{% jstrans "Edit Project Code" %}');
- buttons += makeDeleteButton('button-project-code-delete', row.pk, '{% jstrans "Delete Project Code" %}');
+ buttons += makeEditButton('button-project-code-edit', row.pk, '{% trans "Edit Project Code" escape %}');
+ buttons += makeDeleteButton('button-project-code-delete', row.pk, '{% trans "Delete Project Code" escape %}');
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: '{% jstrans "Edit Project Code" %}',
+ title: '{% trans "Edit Project Code" escape %}',
fields: {
code: {},
description: {},
@@ -200,7 +200,7 @@ onPanelLoad('project-codes', function() {
let pk = $(this).attr('pk');
constructForm(`{% url "api-project-code-list" %}${pk}/`, {
- title: '{% jstrans "Delete Project Code" %}',
+ title: '{% trans "Delete Project Code" escape %}',
method: 'DELETE',
refreshTable: '#project-code-table',
});
@@ -213,7 +213,7 @@ onPanelLoad('project-codes', function() {
code: {},
description: {},
},
- title: '{% jstrans "New Project Code" %}',
+ title: '{% trans "New Project Code" escape %}',
method: 'POST',
refreshTable: '#project-code-table',
});
@@ -282,7 +282,7 @@ onPanelLoad('category', function() {
});
$('#cat-param-table').inventreeTable({
- formatNoMatches: function() { return '{% jstrans "No category parameter templates found" %}'; },
+ formatNoMatches: function() { return '{% trans "No category parameter templates found" escape %}'; },
columns: [
{
field: 'pk',
@@ -292,21 +292,21 @@ onPanelLoad('category', function() {
},
{
field: 'parameter_template_detail.name',
- title: '{% jstrans "Parameter Template" %}',
+ title: '{% trans "Parameter Template" escape %}',
sortable: 'true',
},
{
field: 'category_detail.pathstring',
- title: '{% jstrans "Category" %}',
+ title: '{% trans "Category" escape %}',
},
{
field: 'default_value',
- title: '{% jstrans "Default Value" %}',
+ title: '{% trans "Default Value" escape %}',
sortable: 'true',
formatter: function(value, row, index, field) {
let buttons = '';
- buttons += makeEditButton('template-edit', row.pk, '{% jstrans "Edit Template" %}');
- buttons += makeDeleteButton('template-delete', row.pk, '{% jstrans "Delete Template" %}');
+ buttons += makeEditButton('template-edit', row.pk, '{% trans "Edit Template" escape %}');
+ buttons += makeDeleteButton('template-delete', row.pk, '{% trans "Delete Template" escape %}');
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: '{% jstrans "Edit Category Parameter Template" %}',
+ title: '{% trans "Edit Category Parameter Template" escape %}',
fields: {
parameter_template: {},
category: {
@@ -350,7 +350,7 @@ onPanelLoad('category', function() {
constructForm(`/api/part/category/parameters/${pk}/`, {
method: 'DELETE',
- title: '{% jstrans "Delete Category Parameter Template" %}',
+ title: '{% trans "Delete Category Parameter Template" escape %}',
onSuccess: function() {
loadTemplateTable(pk);
}
@@ -385,7 +385,7 @@ onPanelLoad('category', function() {
var pk = $('#category-select').val();
constructForm('{% url "api-part-category-parameter-list" %}', {
- title: '{% jstrans "Create Category Parameter Template" %}',
+ title: '{% trans "Create Category Parameter Template" escape %}',
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: '{% jstrans "Create Part Parameter Template" %}',
+ title: '{% trans "Create Part Parameter Template" escape %}',
refreshTable: '#param-table',
});
});
@@ -437,34 +437,34 @@ onPanelLoad("stock", function() {
search: true,
sortable: true,
formatNoMatches: function() {
- return '{% jstrans "No stock location types found" %}';
+ return '{% trans "No stock location types found" escape %}';
},
columns: [
{
field: 'name',
sortable: true,
- title: '{% jstrans "Name" %}',
+ title: '{% trans "Name" escape %}',
},
{
field: 'description',
sortable: false,
- title: '{% jstrans "Description" %}',
+ title: '{% trans "Description" escape %}',
},
{
field: 'icon',
sortable: true,
- title: '{% jstrans "Icon" %}',
+ title: '{% trans "Icon" escape %}',
},
{
field: 'location_count',
sortable: true,
- title: '{% jstrans "Location count" %}',
+ title: '{% trans "Location count" escape %}',
formatter: function(value, row) {
let html = value;
let buttons = '';
- buttons += makeEditButton('button-location-type-edit', row.pk, '{% jstrans "Edit Location Type" %}');
- buttons += makeDeleteButton('button-location-type-delete', row.pk, '{% jstrans "Delete Location type" %}');
+ buttons += makeEditButton('button-location-type-edit', row.pk, '{% trans "Edit Location Type" escape %}');
+ buttons += makeDeleteButton('button-location-type-delete', row.pk, '{% trans "Delete Location type" escape %}');
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: '{% jstrans "Edit Location Type" %}',
+ title: '{% trans "Edit Location Type" escape %}',
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: '{% jstrans "Delete Location Type" %}',
+ title: '{% trans "Delete Location Type" escape %}',
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: '{% jstrans "New Location Type" %}',
+ title: '{% trans "New Location Type" escape %}',
method: 'POST',
refreshTable: '#location-type-table',
});
@@ -526,18 +526,18 @@ onPanelLoad('stocktake', function() {
columns: [
{
field: 'report',
- title: '{% jstrans "Report" %}',
+ title: '{% trans "Report" escape %}',
formatter: function(value, row) {
return attachmentLink(value);
}
},
{
field: 'part_count',
- title: '{% jstrans "Part Count" %}',
+ title: '{% trans "Part Count" escape %}',
},
{
field: 'date',
- title: '{% jstrans "Date" %}',
+ title: '{% trans "Date" escape %}',
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 7933ad72dd..f164d2aa97 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 = "{% jstrans 'Do you really want to remove the selected email address?' %}";
+var message = '{% trans "Do you really want to remove the selected email address?" escape %}';
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 fb893c96e0..c9bd3dbd1a 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 = '{% jstrans "No Response" %}';
- message = '{% jstrans "No response from the InvenTree server" %}';
+ title = '{% trans "No Response" %}';
+ message = '{% trans "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 = '{% jstrans "Error 400: Bad request" %}';
- message = '{% jstrans "API request returned error code 400" %}';
+ title = '{% trans "Error 400: Bad request" %}';
+ message = '{% trans "API request returned error code 400" %}';
break;
// Not authenticated
case 401:
- title = '{% jstrans "Error 401: Not Authenticated" %}';
- message = '{% jstrans "Authentication credentials not supplied" %}';
+ title = '{% trans "Error 401: Not Authenticated" %}';
+ message = '{% trans "Authentication credentials not supplied" %}';
break;
// Permission denied
case 403:
- title = '{% jstrans "Error 403: Permission Denied" %}';
- message = '{% jstrans "You do not have the required permissions to access this function" %}';
+ title = '{% trans "Error 403: Permission Denied" %}';
+ message = '{% trans "You do not have the required permissions to access this function" %}';
break;
// Resource not found
case 404:
- title = '{% jstrans "Error 404: Resource Not Found" %}';
- message = '{% jstrans "The requested resource could not be located on the server" %}';
+ title = '{% trans "Error 404: Resource Not Found" %}';
+ message = '{% trans "The requested resource could not be located on the server" %}';
break;
// Method not allowed
case 405:
- title = '{% jstrans "Error 405: Method Not Allowed" %}';
- message = '{% jstrans "HTTP method not allowed at URL" %}';
+ title = '{% trans "Error 405: Method Not Allowed" %}';
+ message = '{% trans "HTTP method not allowed at URL" %}';
break;
// Timeout
case 408:
- title = '{% jstrans "Error 408: Timeout" %}';
- message = '{% jstrans "Connection timeout while requesting data from server" %}';
+ title = '{% trans "Error 408: Timeout" %}';
+ message = '{% trans "Connection timeout while requesting data from server" %}';
break;
case 503:
- title = '{% jstrans "Error 503: Service Unavailable" %}';
- message = '{% jstrans "The server is currently unavailable" %}';
+ title = '{% trans "Error 503: Service Unavailable" %}';
+ message = '{% trans "The server is currently unavailable" %}';
break;
default:
- title = '{% jstrans "Unhandled Error Code" %}';
- message = `{% jstrans "Error code" %}: ${xhr.status}`;
+ title = '{% trans "Unhandled Error Code" %}';
+ message = `{% trans "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 f4d551636a..4ec0b4b625 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: '{% jstrans "Add Attachment" %}',
+ title: '{% trans "Add Attachment" %}',
});
});
@@ -67,7 +67,7 @@ function addAttachmentButtonCallbacks(url, fields={}) {
fields: link_fields,
method: 'POST',
refreshTable: '#attachment-table',
- title: '{% jstrans "Add Link" %}',
+ title: '{% trans "Add Link" %}',
});
});
}
@@ -111,13 +111,13 @@ function deleteAttachments(attachments, url, options={}) {
var html = `
- {% jstrans "All selected attachments will be deleted" %}
+ {% trans "All selected attachments will be deleted" %}
|
- {% jstrans "Attachment" %} |
- {% jstrans "Comment" %} |
+ {% trans "Attachment" %} |
+ {% trans "Comment" %} |
${rows}
@@ -126,7 +126,7 @@ function deleteAttachments(attachments, url, options={}) {
constructForm(url, {
method: 'DELETE',
multi_delete: true,
- title: '{% jstrans "Delete Attachments" %}',
+ title: '{% trans "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: '{% jstrans "Delete attachments" %}',
+ title: '{% trans "Delete attachments" %}',
callback: options.callback,
});
}
@@ -250,7 +250,7 @@ function loadAttachmentTable(url, options) {
{
label: 'attachments',
icon: 'fa-tools',
- title: '{% jstrans "Attachment actions" %}',
+ title: '{% trans "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 '{% jstrans "No attachments found" %}';
+ return '{% trans "No attachments found" %}';
},
sortable: true,
search: true,
@@ -312,7 +312,7 @@ function loadAttachmentTable(url, options) {
}
},
refreshTable: '#attachment-table',
- title: '{% jstrans "Edit Attachment" %}',
+ title: '{% trans "Edit Attachment" %}',
});
});
}
@@ -323,7 +323,7 @@ function loadAttachmentTable(url, options) {
},
{
field: 'attachment',
- title: '{% jstrans "Attachment" %}',
+ title: '{% trans "Attachment" %}',
formatter: function(value, row) {
if (row.attachment) {
@@ -338,12 +338,12 @@ function loadAttachmentTable(url, options) {
},
{
field: 'comment',
- title: '{% jstrans "Comment" %}',
+ title: '{% trans "Comment" %}',
},
{
field: 'upload_date',
sortable: true,
- title: '{% jstrans "Upload Date" %}',
+ title: '{% trans "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,
- '{% jstrans "Edit attachment" %}',
+ '{% trans "Edit attachment" %}',
);
}
@@ -371,7 +371,7 @@ function loadAttachmentTable(url, options) {
buttons += makeDeleteButton(
'button-attachment-delete',
row.pk,
- '{% jstrans "Delete attachment" %}',
+ '{% trans "Delete attachment" %}',
);
}
diff --git a/InvenTree/templates/js/translated/barcode.js b/InvenTree/templates/js/translated/barcode.js
index 966adc6a5e..e03d6f3950 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 || '{% jstrans "Scan barcode data here using barcode scanner" %}';
+ placeholderText = placeholderText || '{% trans "Scan barcode data here using barcode scanner" %}';
- hintText = hintText || '{% jstrans "Enter barcode data" %}';
+ hintText = hintText || '{% trans "Enter barcode data" %}';
var html = `