Merge pull request #7817 from Anurag810/translating_errors

refactor: added missing translation functions
This commit is contained in:
mergify[bot] 2019-07-03 10:08:02 +00:00 committed by GitHub
commit b346b75b46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 15 additions and 12 deletions

View file

@ -384,7 +384,7 @@ class DocType(Document):
os.path.join(new_path, fname.replace(frappe.scrub(old), frappe.scrub(new)))])
self.rename_inside_controller(new, old, new_path)
frappe.msgprint('Renamed files and replaced code in controllers, please check!')
frappe.msgprint(_('Renamed files and replaced code in controllers, please check!'))
def rename_inside_controller(self, new, old, new_path):
for fname in ('{}.js', '{}.py', '{}_list.js', '{}_calendar.js', 'test_{}.py', 'test_{}.js'):

View file

@ -2,6 +2,7 @@
# MIT License. See license.txt
from __future__ import unicode_literals
from frappe import _
"""
record of files
@ -446,7 +447,7 @@ class File(NestedSet):
def validate_url(self, df=None):
if self.file_url:
if not self.file_url.startswith(("http://", "https://", "/files/", "/private/files/")):
frappe.throw("URL must start with 'http://' or 'https://'")
frappe.throw(_("URL must start with 'http://' or 'https://'"))
return
self.file_url = unquote(self.file_url)

View file

@ -15,7 +15,7 @@ frappe.ui.form.on('Success Action', {
validate: (frm) => {
const checked_actions = frm.action_multicheck.get_checked_options();
if (checked_actions.length < 2) {
frappe.msgprint('Select atleast 2 actions');
frappe.msgprint(__('Select atleast 2 actions'));
} else {
return true;
}

View file

@ -166,7 +166,7 @@ frappe.listview_settings['User Permission'] = {
return data;
}
if(data.apply_to_all_doctypes == 0 && !("applicable_doctypes" in data)) {
frappe.throw("Please select applicable Doctypes");
frappe.throw(__("Please select applicable Doctypes"));
}
return data;
},

View file

@ -924,7 +924,7 @@ class Database(object):
conditions=conditions
), values)
else:
frappe.throw('No conditions provided')
frappe.throw(_('No conditions provided'))
def log_touched_tables(self, query, values=None):
if values:

View file

@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe, json
from frappe import _
from frappe.core.page.dashboard.dashboard import cache_source, get_from_date_from_timespan
from frappe.utils import nowdate, add_to_date, getdate, get_last_day, formatdate
from frappe.model.document import Document
@ -199,6 +200,6 @@ class DashboardChart(Document):
def check_required_field(self):
if not self.based_on:
frappe.throw("Time series based on is required to create a dashboard chart")
frappe.throw(_("Time series based on is required to create a dashboard chart"))
if not self.document_type:
frappe.throw("Document type is required to create a dashboard chart")
frappe.throw(_("Document type is required to create a dashboard chart"))

View file

@ -4,6 +4,7 @@
from __future__ import unicode_literals, print_function
from six.moves import range
import frappe
from frappe import _
from frappe.utils import cstr
from frappe.build import html_to_js_template
import re
@ -62,7 +63,7 @@ def render_include(content):
if "{% include" in content:
paths = re.findall(r'''{% include\s['"](.*)['"]\s%}''', content)
if not paths:
frappe.throw('Invalid include path', InvalidIncludePath)
frappe.throw(_('Invalid include path'), InvalidIncludePath)
for path in paths:
app, app_path = path.split('/', 1)

View file

@ -19,7 +19,7 @@ class PrintSettings(Document):
try:
import cups
except ImportError:
frappe.throw("You need to install pycups to use this feature!")
frappe.throw(_("You need to install pycups to use this feature!"))
return
try:
cups.setServer(self.server_ip)

View file

@ -37,7 +37,7 @@ frappe.ui.form.ControlTable = frappe.ui.form.Control.extend({
if (data.length === 1 & data[0].length === 1) return;
if (data.length > 100){
data = data.slice(0, 100);
frappe.msgprint('for performance, only the first 100 rows processed!');
frappe.msgprint(__('For performance, only the first 100 rows were processed.'));
}
var fieldnames = [];
var get_field = function(name_or_label){

View file

@ -106,7 +106,7 @@ export default class WebFormList {
this.web_list_start += this.page_length
this.fetch_data().then((res) => {
if (res.message.length === 0) {
frappe.msgprint("No more items to display")
frappe.msgprint(__("No more items to display"))
}
this.append_rows(res.message)
})

View file

@ -103,7 +103,7 @@ def print_by_server(doctype, name, print_format=None, doc=None, no_letterhead=0)
try:
import cups
except ImportError:
frappe.throw("You need to install pycups to use this feature!")
frappe.throw(_("You need to install pycups to use this feature!"))
return
try:
cups.setServer(print_settings.server_ip)