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

Add some translatable strings

This commit is contained in:
Oliver Walters
2020-02-12 08:11:59 +11:00
parent 31d6c77143
commit 564635c368
6 changed files with 794 additions and 400 deletions

View File

@ -1,7 +1,9 @@
{% extends "modal_delete_form.html" %}
{% load i18n %}
{% load inventree_extras %}
{% block pre_form_content %}
Are you sure you want to unallocate these parts?
{% trans "Are you sure you want to unallocate these parts?" %}
<br>
This will remove {{ item.quantity }} parts from build '{{ item.build.title }}'.
This will remove {% decimal item.quantity %} parts from build '{{ item.build.title }}'.
{% endblock %}

View File

@ -1,9 +1,10 @@
{% extends "modal_form.html" %}
{% load i18n %}
{% load inventree_extras %}
{% block pre_form_content %}
{{ block.super }}
Are you sure you wish to unallocate all stock for this build?
{% trans "Are you sure you wish to unallocate all stock for this build?" %}
{% endblock %}

View File

@ -53,7 +53,7 @@ class BuildCancel(AjaxUpdateView):
model = Build
ajax_template_name = 'build/cancel.html'
ajax_form_title = 'Cancel Build'
ajax_form_title = _('Cancel Build')
context_object_name = 'build'
form_class = forms.CancelBuildForm
@ -71,12 +71,12 @@ class BuildCancel(AjaxUpdateView):
if confirm:
build.cancelBuild(request.user)
else:
form.errors['confirm_cancel'] = ['Confirm build cancellation']
form.errors['confirm_cancel'] = [_('Confirm build cancellation')]
valid = False
data = {
'form_valid': valid,
'danger': 'Build was cancelled'
'danger': _('Build was cancelled')
}
return self.renderJsonResponse(request, form, data=data)
@ -92,7 +92,7 @@ class BuildAutoAllocate(AjaxUpdateView):
model = Build
form_class = forms.ConfirmBuildForm
context_object_name = 'build'
ajax_form_title = 'Allocate Stock'
ajax_form_title = _('Allocate Stock')
ajax_template_name = 'build/auto_allocate.html'
def get_context_data(self, *args, **kwargs):
@ -105,7 +105,7 @@ class BuildAutoAllocate(AjaxUpdateView):
context['build'] = build
context['allocations'] = build.getAutoAllocations()
except Build.DoesNotExist:
context['error'] = 'No matching build found'
context['error'] = _('No matching build found')
return context
@ -124,8 +124,8 @@ class BuildAutoAllocate(AjaxUpdateView):
valid = False
if confirm is False:
form.errors['confirm'] = ['Confirm stock allocation']
form.non_field_errors = 'Check the confirmation box at the bottom of the list'
form.errors['confirm'] = [_('Confirm stock allocation')]
form.non_field_errors = _('Check the confirmation box at the bottom of the list')
else:
build.autoAllocate()
valid = True
@ -145,7 +145,7 @@ class BuildUnallocate(AjaxUpdateView):
model = Build
form_class = forms.ConfirmBuildForm
ajax_form_title = "Unallocate Stock"
ajax_form_title = _("Unallocate Stock")
ajax_template_name = "build/unallocate.html"
def post(self, request, *args, **kwargs):
@ -158,8 +158,8 @@ class BuildUnallocate(AjaxUpdateView):
valid = False
if confirm is False:
form.errors['confirm'] = ['Confirm unallocation of build stock']
form.non_field_errors = 'Check the confirmation box'
form.errors['confirm'] = [_('Confirm unallocation of build stock')]
form.non_field_errors = _('Check the confirmation box')
else:
build.unallocateStock()
valid = True
@ -182,7 +182,7 @@ class BuildComplete(AjaxUpdateView):
model = Build
form_class = forms.CompleteBuildForm
context_object_name = "build"
ajax_form_title = "Complete Build"
ajax_form_title = _("Complete Build")
ajax_template_name = "build/complete.html"
def get_form(self):
@ -255,14 +255,14 @@ class BuildComplete(AjaxUpdateView):
if confirm is False:
form.errors['confirm'] = [
'Confirm completion of build',
_('Confirm completion of build'),
]
else:
try:
location = StockLocation.objects.get(id=loc_id)
valid = True
except StockLocation.DoesNotExist:
form.errors['location'] = ['Invalid location selected']
form.errors['location'] = [_('Invalid location selected')]
serials = []
@ -306,7 +306,7 @@ class BuildComplete(AjaxUpdateView):
def get_data(self):
""" Provide feedback data back to the form """
return {
'info': 'Build marked as COMPLETE'
'info': _('Build marked as COMPLETE')
}
@ -382,7 +382,7 @@ class BuildCreate(AjaxCreateView):
model = Build
context_object_name = 'build'
form_class = forms.EditBuildForm
ajax_form_title = 'Start new Build'
ajax_form_title = _('Start new Build')
ajax_template_name = 'modal_form.html'
def get_initial(self):
@ -405,7 +405,7 @@ class BuildCreate(AjaxCreateView):
def get_data(self):
return {
'success': 'Created new build',
'success': _('Created new build'),
}
@ -415,12 +415,12 @@ class BuildUpdate(AjaxUpdateView):
model = Build
form_class = forms.EditBuildForm
context_object_name = 'build'
ajax_form_title = 'Edit Build Details'
ajax_form_title = _('Edit Build Details')
ajax_template_name = 'modal_form.html'
def get_data(self):
return {
'info': 'Edited build',
'info': _('Edited build'),
}
@ -429,7 +429,7 @@ class BuildDelete(AjaxDeleteView):
model = Build
ajax_template_name = 'build/delete_build.html'
ajax_form_title = 'Delete Build'
ajax_form_title = _('Delete Build')
class BuildItemDelete(AjaxDeleteView):
@ -439,12 +439,12 @@ class BuildItemDelete(AjaxDeleteView):
model = BuildItem
ajax_template_name = 'build/delete_build_item.html'
ajax_form_title = 'Unallocate Stock'
ajax_form_title = _('Unallocate Stock')
context_object_name = 'item'
def get_data(self):
return {
'danger': 'Removed parts from build allocation'
'danger': _('Removed parts from build allocation')
}
@ -454,7 +454,7 @@ class BuildItemCreate(AjaxCreateView):
model = BuildItem
form_class = forms.EditBuildItemForm
ajax_template_name = 'build/create_build_item.html'
ajax_form_title = 'Allocate new Part'
ajax_form_title = _('Allocate new Part')
part = None
available_stock = None
@ -570,11 +570,11 @@ class BuildItemEdit(AjaxUpdateView):
model = BuildItem
ajax_template_name = 'modal_form.html'
form_class = forms.EditBuildItemForm
ajax_form_title = 'Edit Stock Allocation'
ajax_form_title = _('Edit Stock Allocation')
def get_data(self):
return {
'info': 'Updated Build Item',
'info': _('Updated Build Item'),
}
def get_form(self):