Translation fixes (#4621)

* Remove HTML tags from translateable string

* Improve another string

* Improve strings for plugin version check

* Cleanup duplicate serials msg

* JS translations

* fmt
This commit is contained in:
Oliver 2023-04-18 00:12:14 +10:00 committed by GitHub
parent 593a716c29
commit f6b9b12745
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 11 deletions

View File

@ -59,7 +59,8 @@ class FileManager:
# Reset stream position to beginning of file
file.seek(0)
else:
raise ValidationError(_(f'Unsupported file format: {ext.upper()}'))
fmt = ext.upper()
raise ValidationError(_(f'Unsupported file format: {fmt}'))
except UnicodeEncodeError:
raise ValidationError(_('Error reading file (invalid encoding)'))

View File

@ -12,7 +12,7 @@
<div class='alert alert-block alert-info'>
{% else %}
<div class='alert alert-block alert-danger'>
{% blocktrans with part=part.full_name %}The BOM for <em>{{ part }}</em> has changed, and must be validated.<br>{% endblocktrans %}
{% trans "The BOM this part has been changed, and must be validated" %}
{% endif %}
{% blocktrans with part=part.full_name checker=part.bom_checked_by check_date=part.bom_checked_date %}The BOM for <em>{{ part }}</em> was last checked by {{ checker }} on {{ check_date }}{% endblocktrans %}
</div>

View File

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

View File

@ -447,11 +447,13 @@ class PluginsRegistry:
# Disable plugin
safe_reference(plugin=plg_i, key=plg_key, active=False)
_msg = _(f'Plugin `{plg_name}` is not compatible with the current InvenTree version {version.inventreeVersion()}!')
if plg_i.MIN_VERSION:
_msg += _(f'Plugin requires at least version {plg_i.MIN_VERSION}')
if plg_i.MAX_VERSION:
_msg += _(f'Plugin requires at most version {plg_i.MAX_VERSION}')
p = plg_name
v = version.inventreeVersion()
_msg = _(f"Plugin '{p}' is not compatible with the current InvenTree version {v}")
if v := plg_i.MIN_VERSION:
_msg += _(f'Plugin requires at least version {v}')
if v := plg_i.MAX_VERSION:
_msg += _(f'Plugin requires at most version {v}')
# Log to error stack
log_error(_msg, reference='init')
else:

View File

@ -1383,7 +1383,8 @@ class StockItem(InvenTreeBarcodeMixin, MetadataMixin, common.models.MetaMixin, M
if len(existing) > 0:
exists = ','.join([str(x) for x in existing])
raise ValidationError({"serial_numbers": _("Serial numbers already exist: {exists}").format(exists=exists)})
msg = _("Serial numbers already exist") + f": {exists}"
raise ValidationError({"serial_numbers": msg})
# Create a new stock item for each unique serial number
for serial in serials:

View File

@ -607,8 +607,8 @@ function loadPriceBreakTable(table, options={}) {
let buttons = '';
buttons += makeEditButton(`button-${name}-edit`, row.pk, `{% trans "Edit ${human_name}" %}`);
buttons += makeDeleteButton(`button-${name}-delete`, row.pk, `{% trans "Delete ${human_name}" %}`);
buttons += makeEditButton(`button-${name}-edit`, row.pk, `{% trans "Edit" %} ${human_name}`);
buttons += makeDeleteButton(`button-${name}-delete`, row.pk, `{% trans "Delete" %} ${human_name}"`);
html += wrapButtons(buttons);