Merge pull request #9369 from surajshetty3416/fix-incorrect-translations

fix(translations): Incorrect syntax
This commit is contained in:
mergify[bot] 2020-01-30 07:23:40 +00:00 committed by GitHub
commit 3f2b8d835a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 38 additions and 38 deletions

View file

@ -544,7 +544,7 @@ def only_for(roles, message=False):
myroles = set(get_roles())
if not roles.intersection(myroles):
if message:
msgprint(_('Only for {}'.format(', '.join(roles))))
msgprint(_('Only for {}').format(', '.join(roles)))
raise PermissionError
def get_domain_data(module):

View file

@ -16,7 +16,7 @@ class AssignmentRule(Document):
assignment_days = self.get_assignment_days()
if not len(set(assignment_days)) == len(assignment_days):
repeated_days = get_repeated(assignment_days)
frappe.throw(_("Assignment Day {0} has been repeated.".format(frappe.bold(repeated_days))))
frappe.throw(_("Assignment Day {0} has been repeated.").format(frappe.bold(repeated_days)))
def on_update(self): # pylint: disable=no-self-use
frappe.cache_manager.clear_doctype_map('Assignment Rule', self.name)

View file

@ -70,7 +70,7 @@ def get_value(doctype, fieldname, filters=None, as_dict=True, debug=False, paren
check_parent_permission(parent, doctype)
if not frappe.has_permission(doctype):
frappe.throw(_("No permission for {0}".format(doctype)), frappe.PermissionError)
frappe.throw(_("No permission for {0}").format(doctype), frappe.PermissionError)
filters = get_safe_filters(filters)

View file

@ -95,7 +95,7 @@ def get_reference_details(reference_doctype, doctype, reference_list, reference_
temp_records.append(d[1:])
if not reference_list:
frappe.throw(_("No records present in {0}".format(reference_doctype)))
frappe.throw(_("No records present in {0}").format(reference_doctype))
reference_details[reference_list[0]][frappe.scrub(doctype)] = temp_records
return reference_details

View file

@ -222,7 +222,7 @@ def upload(rows = None, submit_after_import=None, ignore_encoding_errors=False,
if (autoname not in doc) or (not doc[autoname]):
from frappe.model.base_document import get_controller
if not hasattr(get_controller(doctype), "autoname"):
frappe.throw(_("{0} is a mandatory field".format(autoname)))
frappe.throw(_("{0} is a mandatory field").format(autoname))
return True
users = frappe.db.sql_list("select name from tabUser")

View file

@ -247,7 +247,7 @@ class DocType(Document):
if autoname and autoname.startswith('field:'):
field = autoname.split(":")[1]
if not field or field not in [ df.fieldname for df in self.fields ]:
frappe.throw(_("Invalid fieldname '{0}' in autoname".format(field)))
frappe.throw(_("Invalid fieldname '{0}' in autoname").format(field))
else:
for df in self.fields:
if df.fieldname == field:

View file

@ -262,7 +262,7 @@ class User(Document):
if not subject:
site_name = frappe.db.get_default('site_name') or frappe.get_conf().get("site_name")
if site_name:
subject = _("Welcome to {0}".format(site_name))
subject = _("Welcome to {0}").format(site_name)
else:
subject = _("Complete Registration")

View file

@ -53,7 +53,7 @@ class UserPermission(Document):
}, limit=1)
if overlap_exists:
ref_link = frappe.get_desk_link(self.doctype, overlap_exists[0].name)
frappe.throw(_("{0} has already assigned default value for {1}.".format(ref_link, self.allow)))
frappe.throw(_("{0} has already assigned default value for {1}.").format(ref_link, self.allow))
@frappe.whitelist()
def get_user_permissions(user=None):

View file

@ -80,7 +80,7 @@ class MariaDBTable(DBTable):
frappe.throw(str(e))
elif e.args[0]==1062:
fieldname = str(e).split("'")[-2]
frappe.throw(_("{0} field cannot be set as unique in {1}, as there are non-unique existing values".format(
fieldname, self.table_name)))
frappe.throw(_("{0} field cannot be set as unique in {1}, as there are non-unique existing values").format(
fieldname, self.table_name))
else:
raise e

View file

@ -31,7 +31,7 @@ class ToDo(Document):
# NOTE the previous value is only available in validate method
if self.get_db_value("status") != self.status:
self._assignment = {
"text": frappe._("Assignment closed by {0}".format(get_fullname(frappe.session.user))),
"text": frappe._("Assignment closed by {0}").format(get_fullname(frappe.session.user)),
"comment_type": "Assignment Completed"
}

View file

@ -51,7 +51,7 @@ def add(args=None):
from frappe.utils import nowdate
if not args.get('description'):
args['description'] = _('Assignment for {0} {1}'.format(args['doctype'], args['name']))
args['description'] = _('Assignment for {0} {1}').format(args['doctype'], args['name'])
d = frappe.get_doc({
"doctype":"ToDo",

View file

@ -444,7 +444,7 @@ def save_report(reference_report, report_name, columns):
'report_type': 'Custom Report',
'reference_report': reference_report
}).insert(ignore_permissions = True)
frappe.msgprint(_("{0} saved successfully".format(new_report.name)))
frappe.msgprint(_("{0} saved successfully").format(new_report.name))
return new_report.name

View file

@ -53,8 +53,8 @@ class AutoEmailReport(Document):
""" check if user has select correct report format """
valid_report_formats = ["HTML", "XLSX", "CSV"]
if self.format not in valid_report_formats:
frappe.throw(_("%s is not a valid report format. Report format should \
one of the following %s"%(frappe.bold(self.format), frappe.bold(", ".join(valid_report_formats)))))
frappe.throw(_("{0} is not a valid report format. Report format should one of the following {1}")
.format(frappe.bold(self.format), frappe.bold(", ".join(valid_report_formats))))
def get_report_content(self):
'''Returns file in for the report in given format'''

View file

@ -52,8 +52,8 @@ class EmailAccount(Document):
"name": ("!=", self.name)
})
if duplicate_email_account:
frappe.throw(_("Email ID must be unique, Email Account already exists \
for {0}".format(frappe.bold(self.email_id))))
frappe.throw(_("Email ID must be unique, Email Account already exists for {0}") \
.format(frappe.bold(self.email_id)))
if frappe.local.flags.in_patch or frappe.local.flags.in_test:
return
@ -175,7 +175,7 @@ class EmailAccount(Document):
# if called via self.receive and it leads to authentication error, disable incoming
# and send email to system manager
self.handle_incoming_connect_error(
description=_('Authentication failed while receiving emails from Email Account {0}. Message from server: {1}'.format(self.name, e.message))
description=_('Authentication failed while receiving emails from Email Account {0}. Message from server: {1}').format(self.name, e.message)
)
return None

View file

@ -323,8 +323,8 @@ def evaluate_alert(doc, alert, event):
frappe.throw(_("Error while evaluating Notification {0}. Please fix your template.").format(alert))
except Exception as e:
error_log = frappe.log_error(message=frappe.get_traceback(), title=str(e))
frappe.throw(_("Error in Notification: {}".format(
frappe.utils.get_link_to_form('Error Log', error_log.name))))
frappe.throw(_("Error in Notification: {}").format(
frappe.utils.get_link_to_form('Error Log', error_log.name)))
def get_context(doc):
return {"doc": doc, "nowdate": nowdate, "frappe.utils": frappe.utils}

View file

@ -16,4 +16,4 @@ class OAuthClient(Document):
def validate_grant_and_response(self):
if self.grant_type == "Authorization Code" and self.response_type != "Code" or \
self.grant_type == "Implicit" and self.response_type != "Token":
frappe.throw(_("Combination of Grant Type (<code>{0}</code>) and Response Type (<code>{1}</code>) not allowed".format(self.grant_type, self.response_type)))
frappe.throw(_("Combination of Grant Type (<code>{0}</code>) and Response Type (<code>{1}</code>) not allowed").format(self.grant_type, self.response_type))

View file

@ -77,12 +77,12 @@ def get_payment_gateway_controller(payment_gateway):
try:
return frappe.get_doc("{0} Settings".format(payment_gateway))
except Exception:
frappe.throw(_("{0} Settings not found".format(payment_gateway)))
frappe.throw(_("{0} Settings not found").format(payment_gateway))
else:
try:
return frappe.get_doc(gateway.gateway_settings, gateway.gateway_controller)
except Exception:
frappe.throw(_("{0} Settings not found".format(payment_gateway)))
frappe.throw(_("{0} Settings not found").format(payment_gateway))
@frappe.whitelist(allow_guest=True, xss_safe=True)

View file

@ -392,7 +392,7 @@ class BaseDocument(object):
if df:
label = df.label
frappe.msgprint(_("{0} must be unique".format(label or fieldname)))
frappe.msgprint(_("{0} must be unique").format(label or fieldname))
# this is used to preserve traceback
raise frappe.UniqueValidationError(self.doctype, self.name, e)

View file

@ -1115,9 +1115,9 @@ class Document(BaseDocument):
label = doc.meta.get_label(fieldname)
condition_str = error_condition_map.get(condition, condition)
if doc.parentfield:
msg = _("Incorrect value in row {0}: {1} must be {2} {3}".format(doc.idx, label, condition_str, val2))
msg = _("Incorrect value in row {0}: {1} must be {2} {3}").format(doc.idx, label, condition_str, val2)
else:
msg = _("Incorrect value: {0} must be {1} {2}".format(label, condition_str, val2))
msg = _("Incorrect value: {0} must be {1} {2}").format(label, condition_str, val2)
# raise passed exception or True
msgprint(msg, raise_exception=raise_exception or True)

View file

@ -139,7 +139,7 @@ def validate_workflow(doc):
state_row = [d for d in workflow.states if d.state == current_state]
if not state_row:
frappe.throw(_('{0} is not a valid Workflow State. Please update your Workflow and try again.'.format(frappe.bold(current_state))))
frappe.throw(_('{0} is not a valid Workflow State. Please update your Workflow and try again.').format(frappe.bold(current_state)))
state_row = state_row[0]
# if transitioning, check if user is allowed to transition

View file

@ -176,7 +176,7 @@ frappe.Application = Class.extend({
email_password_prompt: function(email_account,user,i) {
var me = this;
var d = new frappe.ui.Dialog({
title: __('Email Account setup please enter your password for: '+email_account[i]["email_id"]),
title: __('Email Account setup please enter your password for: {0}', [email_account[i]["email_id"]]),
fields: [
{ 'fieldname': 'password',
'fieldtype': 'Password',

View file

@ -145,7 +145,7 @@ def get_share_name(doctype, name, user, everyone):
def check_share_permission(doctype, name):
"""Check if the user can share with other users"""
if not frappe.has_permission(doctype, ptype="share", doc=name):
frappe.throw(_("No permission to {0} {1} {2}".format("share", doctype, name)), frappe.PermissionError)
frappe.throw(_("No permission to {0} {1} {2}").format("share", doctype, name), frappe.PermissionError)
def notify_assignment(shared_by, doctype, doc_name, everyone, notify=0):

View file

@ -54,7 +54,7 @@
<tr>
<td>
<p>
{{ _("This report was generated on {0}".format(date_time)) }}
{{ _("This report was generated on {0}").format(date_time) }}
</p>
<p>
{{ _("View report in your browser") }}:

View file

@ -240,7 +240,7 @@ def show_update_popup():
title = app.title
)
if release_links:
update_message += _("New {} releases for the following apps are available".format(update_type)) + ":<br><br>{}".format(release_links)
update_message += _("New {} releases for the following apps are available").format(update_type) + ":<br><br>{}".format(release_links)
if update_message:
frappe.msgprint(update_message, title=_("New updates are available"), indicator='green')

View file

@ -99,11 +99,11 @@ def confirm_action(doctype, docname, user, action):
def return_success_page(doc):
frappe.respond_as_web_page(_("Success"),
_("{0}: {1} is set to state {2}".format(
_("{0}: {1} is set to state {2}").format(
doc.get('doctype'),
frappe.bold(doc.get('name')),
frappe.bold(get_doc_workflow_state(doc))
)), indicator_color='green')
), indicator_color='green')
def return_action_confirmation_page(doc, action, action_link, alert_doc_change=False):
template_params = {
@ -125,12 +125,12 @@ def return_action_confirmation_page(doc, action, action_link, alert_doc_change=F
def return_link_expired_page(doc, doc_workflow_state):
frappe.respond_as_web_page(_("Link Expired"),
_("Document {0} has been set to state {1} by {2}"
_("Document {0} has been set to state {1} by {2}")
.format(
frappe.bold(doc.get('name')),
frappe.bold(doc_workflow_state),
frappe.bold(frappe.get_value('User', doc.get("modified_by"), 'full_name'))
)), indicator_color='blue')
), indicator_color='blue')
def clear_old_workflow_actions(doc, user=None):
user = user if user else frappe.session.user
@ -276,7 +276,7 @@ def get_common_email_args(doc):
response = frappe.render_template(email_template.response, vars(doc))
else:
subject = _('Workflow Action')
response = _('{0}: {1}'.format(doctype, docname))
response = _('{0}: {1}').format(doctype, docname)
common_args = {
'template': 'workflow_action',

View file

@ -1,7 +1,7 @@
{% extends "frappe/www/message.html" %}
{% block message_body %}
<p>
{{ _("Please confirm your action to {0} this document.".format(action)) }}
{{ _("Please confirm your action to {0} this document.").format(action) }}
</p>
{% if alert_doc_change %}
<p>

View file

@ -24,7 +24,7 @@
<div class="row">
<div class="col-xs-12">
<div class="well">
<div class="text-muted">{{ _("This will log out {0} from all other devices".format(app.app_name)) }}</div>
<div class="text-muted">{{ _("This will log out {0} from all other devices").format(app.app_name) }}</div>
<div class="padding"></div>
<div class="text-right">
<button class="btn btn-default" onclick="location.href = '/third_party_apps';">Cancel</button>