From 6c3dc2a25d6503fd2255e18977a24c0747caa5c8 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 2 May 2020 22:01:40 +1000 Subject: [PATCH] Translation layer for company.js --- InvenTree/InvenTree/urls.py | 1 + InvenTree/templates/base.html | 4 +-- .../inventree => templates/js}/company.js | 35 ++++++++++--------- 3 files changed, 21 insertions(+), 19 deletions(-) rename InvenTree/{InvenTree/static/script/inventree => templates/js}/company.js (80%) diff --git a/InvenTree/InvenTree/urls.py b/InvenTree/InvenTree/urls.py index 2da9f140a0..2fcfa941c4 100644 --- a/InvenTree/InvenTree/urls.py +++ b/InvenTree/InvenTree/urls.py @@ -79,6 +79,7 @@ dynamic_javascript_urls = [ url(r'^stock.js', DynamicJsView.as_view(template_name='js/stock.js'), name='stock.js'), url(r'^build.js', DynamicJsView.as_view(template_name='js/build.js'), name='build.js'), url(r'^order.js', DynamicJsView.as_view(template_name='js/order.js'), name='order.js'), + url(r'^company.js', DynamicJsView.as_view(template_name='js/company.js'), name='company.js'), ] urlpatterns = [ diff --git a/InvenTree/templates/base.html b/InvenTree/templates/base.html index 13937eb3ed..cba64ac176 100644 --- a/InvenTree/templates/base.html +++ b/InvenTree/templates/base.html @@ -102,14 +102,14 @@ InvenTree - - + + diff --git a/InvenTree/InvenTree/static/script/inventree/company.js b/InvenTree/templates/js/company.js similarity index 80% rename from InvenTree/InvenTree/static/script/inventree/company.js rename to InvenTree/templates/js/company.js index d5c37ce363..8b278e2a21 100644 --- a/InvenTree/InvenTree/static/script/inventree/company.js +++ b/InvenTree/templates/js/company.js @@ -1,3 +1,4 @@ +{% load i18n %} function loadCompanyTable(table, url, options={}) { /* @@ -25,7 +26,7 @@ function loadCompanyTable(table, url, options={}) { method: 'get', queryParams: filters, groupBy: false, - formatNoMatches: function() { return "No company information found"; }, + formatNoMatches: function() { return "{% trans "No company information found" %}"; }, columns: [ { field: 'pk', @@ -34,21 +35,21 @@ function loadCompanyTable(table, url, options={}) { }, { field: 'name', - title: 'Company', + title: '{% trans "Company" %}', sortable: true, formatter: function(value, row, index, field) { var html = imageHoverIcon(row.image) + renderLink(value, row.url); if (row.is_customer) { - html += ``; + html += ``; } if (row.is_manufacturer) { - html += ``; + html += ``; } if (row.is_supplier) { - html += ``; + html += ``; } return html; @@ -56,12 +57,12 @@ function loadCompanyTable(table, url, options={}) { }, { field: 'description', - title: 'Description', + title: '{% trans "Description" %}', sortable: true, }, { field: 'website', - title: 'Website', + title: '{% trans "Website" %}', formatter: function(value, row, index, field) { if (value) { return renderLink(value, value); @@ -97,7 +98,7 @@ function loadSupplierPartTable(table, url, options) { method: 'get', queryParams: filters, groupBy: false, - formatNoMatches: function() { return "No supplier parts found"; }, + formatNoMatches: function() { return "{% trans "No supplier parts found" %}"; }, columns: [ { checkbox: true, @@ -105,7 +106,7 @@ function loadSupplierPartTable(table, url, options) { { sortable: true, field: 'part_detail.full_name', - title: 'Part', + title: '{% trans "Part" %}', formatter: function(value, row, index, field) { var url = `/part/${row.part}/`; @@ -113,15 +114,15 @@ function loadSupplierPartTable(table, url, options) { var html = imageHoverIcon(row.part_detail.thumbnail) + renderLink(value, url); if (row.part_detail.is_template) { - html += ``; + html += ``; } if (row.part_detail.assembly) { - html += ``; + html += ``; } if (!row.part_detail.active) { - html += `INACTIVE`; + html += `{% trans "Inactive" %}`; } return html; @@ -130,7 +131,7 @@ function loadSupplierPartTable(table, url, options) { { sortable: true, field: 'supplier', - title: "Supplier", + title: "{% trans "Supplier" %}", formatter: function(value, row, index, field) { if (value) { var name = row.supplier_detail.name; @@ -146,7 +147,7 @@ function loadSupplierPartTable(table, url, options) { { sortable: true, field: 'SKU', - title: "Supplier Part", + title: "{% trans "Supplier Part" %}", formatter: function(value, row, index, field) { return renderLink(value, `/supplier-part/${row.pk}/`); } @@ -154,7 +155,7 @@ function loadSupplierPartTable(table, url, options) { { sortable: true, field: 'manufacturer', - title: 'Manufacturer', + title: '{% trans "Manufacturer" %}', formatter: function(value, row, index, field) { if (value) { var name = row.manufacturer_detail.name; @@ -170,11 +171,11 @@ function loadSupplierPartTable(table, url, options) { { sortable: true, field: 'MPN', - title: 'MPN', + title: '{% trans "MPN" %}', }, { field: 'link', - title: 'Link', + title: '{% trans "Link" %}', formatter: function(value, row, index, field) { if (value) { return renderLink(value, value);