2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-20 22:06:28 +00:00

Merge pull request from matmair/feature/translations

Feature/translations
This commit is contained in:
Oliver
2021-04-18 20:23:51 +10:00
committed by GitHub
25 changed files with 2825 additions and 2074 deletions

@ -3,6 +3,7 @@
{% load static %} {% load static %}
{% load i18n %} {% load i18n %}
{% load status_codes %} {% load status_codes %}
{% load inventree_extras %}
{% block page_title %} {% block page_title %}
InvenTree | {% trans "Build Order" %} - {{ build }} InvenTree | {% trans "Build Order" %} - {{ build }}
@ -11,12 +12,14 @@ InvenTree | {% trans "Build Order" %} - {{ build }}
{% block pre_content %} {% block pre_content %}
{% if build.sales_order %} {% if build.sales_order %}
<div class='alert alert-block alert-info'> <div class='alert alert-block alert-info'>
{% trans "This Build Order is allocated to Sales Order" %} <b><a href="{% url 'so-detail' build.sales_order.id %}">{{ build.sales_order }}</a></b> {% object_link 'so-detail' build.sales_order.id build.sales_order as link %}
{% blocktrans %}This Build Order is allocated to Sales Order {{link}}{% endblocktrans %}
</div> </div>
{% endif %} {% endif %}
{% if build.parent %} {% if build.parent %}
<div class='alert alert-block alert-info'> <div class='alert alert-block alert-info'>
{% trans "This Build Order is a child of Build Order" %} <b><a href="{% url 'build-detail' build.parent.id %}">{{ build.parent }}</a></b> {% object_link 'build-detail' build.parent.id build.parent as link %}
{% blocktrans %}This Build Order is a child of Build Order {{link}}{% endblocktrans %}
</div> </div>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
@ -105,7 +108,7 @@ src="{% static 'img/blank_image.png' %}"
<td> <td>
{{ build.target_date }} {{ build.target_date }}
{% if build.is_overdue %} {% if build.is_overdue %}
<span title='{% trans "This build was due on" %} {{ build.target_date }}' class='label label-red'>{% trans "Overdue" %}</span> <span title='{% blocktrans with target=build.target_date %}This build was due on {{target}}{% endblocktrans %}' class='label label-red'>{% trans "Overdue" %}</span>
{% endif %} {% endif %}
</td> </td>
</tr> </tr>

@ -8,15 +8,13 @@
</p> </p>
{% if output %} {% if output %}
<p> <p>
{% trans "The allocated stock will be installed into the following build output:" %} {% blocktrans %}The allocated stock will be installed into the following build output:<br><i>{{output}}</i>{% endblocktrans %}
<br>
<i>{{ output }}</i>
</p> </p>
{% endif %} {% endif %}
</div> </div>
{% if no_stock %} {% if no_stock %}
<div class='alert alert-danger alert-block' role='alert'> <div class='alert alert-danger alert-block' role='alert'>
{% trans "No stock available for" %} {{ part }} {% blocktrans %}No stock available for {{part}}{% endblocktrans %}
</div> </div>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

@ -33,8 +33,7 @@
</table> </table>
{% if part.supplier_parts.all|length > 0 %} {% if part.supplier_parts.all|length > 0 %}
<div class='alert alert-block alert-danger'> <div class='alert alert-block alert-danger'>
<p>There are {{ part.supplier_parts.all|length }} suppliers defined for this manufacturer part. If you delete it, the following supplier parts will also be deleted: <p>{% blocktrans with count=part.supplier_parts.all|length %}There are {{count}} suppliers defined for this manufacturer part. If you delete it, the following supplier parts will also be deleted:{% endblocktrans %}</p>
</p>
<ul class='list-group' style='margin-top:10px'> <ul class='list-group' style='margin-top:10px'>
{% for spart in part.supplier_parts.all %} {% for spart in part.supplier_parts.all %}
<li class='list-group-item'>{{ spart.supplier.name }} - {{ spart.SKU }}</li> <li class='list-group-item'>{{ spart.supplier.name }} - {{ spart.SKU }}</li>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -7,8 +7,8 @@
{% trans 'Mark this order as complete?' %} {% trans 'Mark this order as complete?' %}
{% if not order.is_complete %} {% if not order.is_complete %}
<div class='alert alert-warning alert-block'> <div class='alert alert-warning alert-block'>
{%trans 'This order has line items which have not been marked as received. {% trans 'This order has line items which have not been marked as received.' %}
Marking this order as complete will remove these line items.' %} {% trans 'Marking this order as complete will remove these line items.' %}
</div> </div>
{% endif %} {% endif %}

@ -54,7 +54,7 @@
</select> </select>
</div> </div>
{% if not part.order_supplier %} {% if not part.order_supplier %}
<span class='help-inline'>{% trans "Select a supplier for" %} <i>{{ part.name }}</i></span> <span class='help-inline'>{% blocktrans with name=part.name %}Select a supplier for <i>{{name}}</i>{% endblocktrans %}</span>
{% endif %} {% endif %}
</div> </div>
</td> </td>

@ -42,7 +42,7 @@
<button <button
class='btn btn-default btn-create' class='btn btn-default btn-create'
id='new_po_{{ supplier.id }}' id='new_po_{{ supplier.id }}'
title='{% trans "Create new purchase order for {{ supplier.name }}" %}' title='{% blocktrans with name=supplier.name %}Create new purchase order for {{name}}{% endblocktrans %}'
type='button' type='button'
supplierid='{{ supplier.id }}' supplierid='{{ supplier.id }}'
onclick='newPurchaseOrderFromOrderWizard()'> onclick='newPurchaseOrderFromOrderWizard()'>
@ -65,7 +65,7 @@
</select> </select>
</div> </div>
{% if not supplier.selected_purchase_order %} {% if not supplier.selected_purchase_order %}
<span class='help-inline'>{% trans "Select a purchase order for" %} {{ supplier.name }}</span> <span class='help-inline'>{% blocktrans with name=supplier.name %}Select a purchase order for {{name}}{% endblocktrans %}</span>
{% endif %} {% endif %}
</div> </div>
</td> </td>

@ -5,7 +5,7 @@
{% block form %} {% block form %}
{% trans "Receive outstanding parts for" %} <b>{{ order }}</b> - <i>{{ order.description }}</i> {% blocktrans with desc=order.description %}Receive outstanding parts for <b>{{order}}</b> - <i>{{desc}}</i>{% endblocktrans %}
<form method='post' action='' class='js-modal-form' enctype='multipart/form-data'> <form method='post' action='' class='js-modal-form' enctype='multipart/form-data'>
{% csrf_token %} {% csrf_token %}

@ -5,7 +5,7 @@
{% trans 'Are you sure you want to delete category' %} <strong>{{ category.name }}</strong>? {% trans 'Are you sure you want to delete category' %} <strong>{{ category.name }}</strong>?
{% if category.children.all|length > 0 %} {% if category.children.all|length > 0 %}
<p>{% trans 'This category contains' %} {{ category.children.all|length }} {% trans 'child categories' %}.<br> <p>{% blocktrans with count=category.children.all|length%}This category contains {{count}} child categories{% endblocktrans %}.<br>
{% trans 'If this category is deleted, these child categories will be moved to the' %} {% trans 'If this category is deleted, these child categories will be moved to the' %}
{% if category.parent %} {% if category.parent %}
<strong>{{ category.parent.name }}</strong> {% trans 'category' %}. <strong>{{ category.parent.name }}</strong> {% trans 'category' %}.
@ -22,9 +22,9 @@
{% endif %} {% endif %}
{% if category.parts.all|length > 0 %} {% if category.parts.all|length > 0 %}
<p>{% trans 'This category contains' %} {{ category.parts.all|length }} {% trans 'parts' %}.<br> <p>{% blocktrans with count=category.parts.all|length %}This category contains {{count}} parts{% endblocktrans %}.<br>
{% if category.parent %} {% if category.parent %}
{% trans 'If this category is deleted, these parts will be moved to the parent category' %} {{ category.parent.pathstring }} {% blocktrans with path=category.parent.pathstring %}If this category is deleted, these parts will be moved to the parent category {{path}}{% endblocktrans %}
{% else %} {% else %}
{% trans 'If this category is deleted, these parts will be moved to the top-level category Teile' %} {% trans 'If this category is deleted, these parts will be moved to the top-level category Teile' %}
{% endif %} {% endif %}

@ -7,7 +7,7 @@
<div class='alert alert-info alert-block'> <div class='alert alert-info alert-block'>
<strong>{% trans 'Duplicate Part' %}</strong><br> <strong>{% trans 'Duplicate Part' %}</strong><br>
{% trans 'Make a copy of part' %} '{{ part.full_name }}'. {% blocktrans with full_name=part.full_name %}Make a copy of part '{{full_name}}'.{% endblocktrans %}
</div> </div>
{% if matches %} {% if matches %}

@ -13,7 +13,8 @@
<ul class='list-group'> <ul class='list-group'>
{% for match in matches %} {% for match in matches %}
<li class='list-group-item list-group-item-condensed'> <li class='list-group-item list-group-item-condensed'>
{{ match.part.full_name }} - <i>{{ match.part.description }}</i> ({% decimal match.ratio %}% {% trans "match" %}) {% decimal match.ratio as match_per %}
{% blocktrans with full_name=match.part.full_name desc=match.part.description %}{{full_name}} - <i>{{desc}}</i> ({{match_per}}% match){% endblocktrans %}
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>

@ -14,7 +14,8 @@
{% if part.variant_of %} {% if part.variant_of %}
<div class='alert alert-info alert-block'> <div class='alert alert-info alert-block'>
{% trans "This part is a variant of" %} <strong><a href="{% url 'part-variants' part.variant_of.id %}">{{ part.variant_of.full_name }}</a></strong> {% object_link 'part-variants' part.variant_of.id part.variant_of.full_name as link %}
{% blocktrans %}This part is a variant of {{link}}{% endblocktrans %}
</div> </div>
{% endif %} {% endif %}

@ -5,8 +5,7 @@
{% block pre_form_content %} {% block pre_form_content %}
<div class='alert alert-info alert-block'> <div class='alert alert-info alert-block'>
{% trans 'Pricing information for:' %}<br> {% blocktrans %}Pricing information for:<br>{{part}}.{% endblocktrans %}
{{ part }}.
</div> </div>
<h4>{% trans 'Quantity' %}</h4> <h4>{% trans 'Quantity' %}</h4>

@ -4,12 +4,12 @@
{% block pre_form_content %} {% block pre_form_content %}
<div class='alert alert-block alert-danger'> <div class='alert alert-block alert-danger'>
{% trans "Are you sure you want to delete part" %} '<b>{{ part.full_name }}</b>'? {% blocktrans with full_name=part.full_name %}Are you sure you want to delete part '<b>{{full_name}}</b>'?{% endblocktrans %}
</div> </div>
{% if part.used_in_count %} {% if part.used_in_count %}
<hr> <hr>
<p>{% trans "This part is used in BOMs for" %} {{ part.used_in_count }} {% trans "other parts. If you delete this part, the BOMs for the following parts will be updated" %}: <p>{% blocktrans with count=part.used_in_count %}This part is used in BOMs for {{count}} other parts. If you delete this part, the BOMs for the following parts will be updated{% endblocktrans %}:
<ul class="list-group"> <ul class="list-group">
{% for child in part.used_in.all %} {% for child in part.used_in.all %}
<li class='list-group-item'>{{ child.part.full_name }} - {{ child.part.description }}</li> <li class='list-group-item'>{{ child.part.full_name }} - {{ child.part.description }}</li>
@ -19,7 +19,7 @@
{% if part.stock_items.all|length > 0 %} {% if part.stock_items.all|length > 0 %}
<hr> <hr>
<p>{% trans "There are" %} {{ part.stock_items.all|length }} {% trans "stock entries defined for this part. If you delete this part, the following stock entries will also be deleted" %}: <p>{% blocktrans with count=part.stock_items.all|length %}There are {{count}} stock entries defined for this part. If you delete this part, the following stock entries will also be deleted:{% endblocktrans %}
<ul class='list-group'> <ul class='list-group'>
{% for stock in part.stock_items.all %} {% for stock in part.stock_items.all %}
<li class='list-group-item'>{{ stock }}</li> <li class='list-group-item'>{{ stock }}</li>
@ -30,7 +30,7 @@
{% if part.manufacturer_parts.all|length > 0 %} {% if part.manufacturer_parts.all|length > 0 %}
<hr> <hr>
<p>{% trans "There are" %} {{ part.manufacturer_parts.all|length }} {% trans "manufacturers defined for this part. If you delete this part, the following manufacturer parts will also be deleted" %}: <p>{% blocktrans with count=part.manufacturer_parts.all|length %}There are {{count}} manufacturers defined for this part. If you delete this part, the following manufacturer parts will also be deleted:{% endblocktrans %}
<ul class='list-group'> <ul class='list-group'>
{% for spart in part.manufacturer_parts.all %} {% for spart in part.manufacturer_parts.all %}
<li class='list-group-item'>{{ spart.manufacturer.name }} - {{ spart.MPN }}</li> <li class='list-group-item'>{{ spart.manufacturer.name }} - {{ spart.MPN }}</li>
@ -41,7 +41,7 @@
{% if part.supplier_parts.all|length > 0 %} {% if part.supplier_parts.all|length > 0 %}
<hr> <hr>
<p>{% trans "There are" %} {{ part.supplier_parts.all|length }} {% trans "suppliers defined for this part. If you delete this part, the following supplier parts will also be deleted" %}: <p>{% blocktrans with count=part.supplier_parts.all|length %}There are {{count}} suppliers defined for this part. If you delete this part, the following supplier parts will also be deleted:{% endblocktrans %}
<ul class='list-group'> <ul class='list-group'>
{% for spart in part.supplier_parts.all %} {% for spart in part.supplier_parts.all %}
<li class='list-group-item'>{{ spart.supplier.name }} - {{ spart.SKU }}</li> <li class='list-group-item'>{{ spart.supplier.name }} - {{ spart.SKU }}</li>
@ -52,7 +52,7 @@
{% if part.serials.all|length > 0 %} {% if part.serials.all|length > 0 %}
<hr> <hr>
<p>{% trans "There are" %} {{ part.serials.all|length }} {% trans "unique parts tracked for" %} '{{ part.full_name }}'. {% trans "Deleting this part will permanently remove this tracking information" %}.</p> <p>{% blocktrans with count=part.serials.all|length full_name=part.full_name %}There are {{count}} unique parts tracked for '{{full_name}}'. Deleting this part will permanently remove this tracking information.{% endblocktrans %}</p>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

@ -13,7 +13,7 @@
{% block details %} {% block details %}
{% if part.is_template %} {% if part.is_template %}
<div class='alert alert-info alert-block'> <div class='alert alert-info alert-block'>
{% trans 'Showing stock for all variants of' %} <i>{{ part.full_name }}</i> {% blocktrans with full_name=part.full_name%}Showing stock for all variants of <i>{{full_name}}</i>{% endblocktrans %}
</div> </div>
{% endif %} {% endif %}

@ -7,7 +7,7 @@
<div class='alert alert-info alert-block'> <div class='alert alert-info alert-block'>
<b>{% trans "Create new part variant" %}</b><br> <b>{% trans "Create new part variant" %}</b><br>
{% trans "Create a new variant of template" %} <i>'{{ part.full_name }}'</i>. {% blocktrans with full_name=part.full_name %}Create a new variant of template <i>'{{full_name}}'</i>.{% endblocktrans %}
</div> </div>
{% endblock %} {% endblock %}

@ -4,6 +4,8 @@ over and above the built-in Django tags.
import os import os
from django import template from django import template
from django.urls import reverse
from django.utils.safestring import mark_safe
from InvenTree import version, settings from InvenTree import version, settings
import InvenTree.helpers import InvenTree.helpers
@ -164,3 +166,11 @@ def authorized_owners(group):
pass pass
return owners return owners
@register.simple_tag()
def object_link(url_name, pk, ref):
""" Return highlighted link to object """
ref_url = reverse(url_name, kwargs={'pk': pk})
return mark_safe('<b><a href="{}">{}</a></b>'.format(ref_url, ref))

@ -48,13 +48,17 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
{% for allocation in item.sales_order_allocations.all %} {% for allocation in item.sales_order_allocations.all %}
<div class='alert alert-block alert-info'> <div class='alert alert-block alert-info'>
{% trans "This stock item is allocated to Sales Order" %} <a href="{% url 'so-detail' allocation.line.order.id %}"><b>#{{ allocation.line.order }}</b></a> ({% trans "Quantity" %}: {% decimal allocation.quantity %}) {% object_link 'so-detail' allocation.line.order.id allocation.line.order as link %}
{% decimal allocation.quantity as qty %}
{% blocktrans %}This stock item is allocated to Sales Order {{ link }} (Quantity: {{ qty }}){% endblocktrans %}
</div> </div>
{% endfor %} {% endfor %}
{% for allocation in item.allocations.all %} {% for allocation in item.allocations.all %}
<div class='alert alert-block alert-info'> <div class='alert alert-block alert-info'>
{% trans "This stock item is allocated to Build" %} <a href="{% url 'build-detail' allocation.build.id %}"><b>#{{ allocation.build }}</b></a> ({% trans "Quantity" %}: {% decimal allocation.quantity %}) {% object_link 'build-detail' allocation.build.id allocation.build %}
{% decimal allocation.quantity as qty %}
{% blocktrans %}This stock item is allocated to Build {{ link }} (Quantity: {{ qty }}){% endblocktrans %}
</div> </div>
{% endfor %} {% endfor %}
@ -362,9 +366,9 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
<td> <td>
{{ item.expiry_date }} {{ item.expiry_date }}
{% if item.is_expired %} {% if item.is_expired %}
<span title='{% trans "This StockItem expired on" %} {{ item.expiry_date }}' class='label label-red'>{% trans "Expired" %}</span> <span title='{% blocktrans %}This StockItem expired on {{ item.expiry_date }}{% endblocktrans %}' class='label label-red'>{% trans "Expired" %}</span>
{% elif item.is_stale %} {% elif item.is_stale %}
<span title='{% trans "This StockItem expires on" %} {{ item.expiry_date }}' class='label label-yellow'>{% trans "Stale" %}</span> <span title='{% blocktrans %}This StockItem expires on {{ item.expiry_date }}{% endblocktrans %}' class='label label-yellow'>{% trans "Stale" %}</span>
{% endif %} {% endif %}
</td> </td>
</tr> </tr>

@ -8,7 +8,8 @@
<div class='alert alert-danger alert-block'> <div class='alert alert-danger alert-block'>
{% trans "Are you sure you want to delete this stock item?" %} {% trans "Are you sure you want to delete this stock item?" %}
<br> <br>
This will remove <b>{% decimal item.quantity %}</b> units of <b>{{ item.part.full_name }}</b> from stock. {% decimal item.quantity as qty %}
{% blocktrans with full_name=item.part.full_name %}This will remove <b>{{qty}}</b> units of <b>{{full_name}}</b> from stock.{% endblocktrans %}
</div> </div>
{% endblock %} {% endblock %}

@ -5,7 +5,7 @@
<div class='alert alert-block alert-info'> <div class='alert alert-block alert-info'>
<b>{% trans "Convert Stock Item" %}</b><br> <b>{% trans "Convert Stock Item" %}</b><br>
{% trans "This stock item is current an instance of " %}<i>{{ item.part }}</i><br> {% blocktrans with part=item.part %}This stock item is current an instance of <i>{{part}}</i>{% endblocktrans %}<br>
{% trans "It can be converted to one of the part variants listed below." %} {% trans "It can be converted to one of the part variants listed below." %}
</div> </div>

@ -3,7 +3,7 @@
{% block pre_form_content %} {% block pre_form_content %}
<div class='alert alert-danger alert-block'> <div class='alert alert-danger alert-block'>
Are you sure you want to delete this stock tracking entry? {% trans "Are you sure you want to delete this stock tracking entry?" %}
</div> </div>
{% endblock %} {% endblock %}

@ -268,6 +268,10 @@ function loadBomTable(table, options) {
field: 'optional', field: 'optional',
title: '{% trans "Optional" %}', title: '{% trans "Optional" %}',
searchable: false, searchable: false,
formatter: function(value) {
if (value == '1') return '{% trans "true" %}';
if (value == '0') return '{% trans "false" %}';
}
}); });
cols.push({ cols.push({

@ -1,5 +1,7 @@
{% load i18n %}
{% if value %} {% if value %}
<span class='label label-success'>Yes</span> <span class='label label-success'>{% trans 'Yes' %}</span>
{% else %} {% else %}
<span class='label label-warning'>No</span> <span class='label label-warning'>{% trans 'No' %}</span>
{% endif %} {% endif %}