diff --git a/frappe/core/doctype/doctype/doctype.py b/frappe/core/doctype/doctype/doctype.py index 07da5a8fe3..bd528bb4d7 100644 --- a/frappe/core/doctype/doctype/doctype.py +++ b/frappe/core/doctype/doctype/doctype.py @@ -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'): diff --git a/frappe/core/doctype/file/file.py b/frappe/core/doctype/file/file.py index fff4a5e344..3d8babae6a 100755 --- a/frappe/core/doctype/file/file.py +++ b/frappe/core/doctype/file/file.py @@ -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) diff --git a/frappe/core/doctype/success_action/success_action.js b/frappe/core/doctype/success_action/success_action.js index b8d56d3c8a..d73d3db326 100644 --- a/frappe/core/doctype/success_action/success_action.js +++ b/frappe/core/doctype/success_action/success_action.js @@ -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; } diff --git a/frappe/core/doctype/user_permission/user_permission_list.js b/frappe/core/doctype/user_permission/user_permission_list.js index a0b553c43a..3e822f0007 100644 --- a/frappe/core/doctype/user_permission/user_permission_list.js +++ b/frappe/core/doctype/user_permission/user_permission_list.js @@ -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; }, diff --git a/frappe/database/database.py b/frappe/database/database.py index 3aab284de0..7650af43f9 100644 --- a/frappe/database/database.py +++ b/frappe/database/database.py @@ -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: diff --git a/frappe/desk/doctype/dashboard_chart/dashboard_chart.py b/frappe/desk/doctype/dashboard_chart/dashboard_chart.py index ff54f95031..53d1110e83 100644 --- a/frappe/desk/doctype/dashboard_chart/dashboard_chart.py +++ b/frappe/desk/doctype/dashboard_chart/dashboard_chart.py @@ -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") \ No newline at end of file + frappe.throw(_("Document type is required to create a dashboard chart")) \ No newline at end of file diff --git a/frappe/model/utils/__init__.py b/frappe/model/utils/__init__.py index e5d329cd79..efbe46a4ab 100644 --- a/frappe/model/utils/__init__.py +++ b/frappe/model/utils/__init__.py @@ -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) diff --git a/frappe/printing/doctype/print_settings/print_settings.py b/frappe/printing/doctype/print_settings/print_settings.py index 2758f0aa9c..9bb87ab311 100644 --- a/frappe/printing/doctype/print_settings/print_settings.py +++ b/frappe/printing/doctype/print_settings/print_settings.py @@ -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) diff --git a/frappe/public/js/frappe/form/controls/table.js b/frappe/public/js/frappe/form/controls/table.js index 5fad73364d..85af73823a 100644 --- a/frappe/public/js/frappe/form/controls/table.js +++ b/frappe/public/js/frappe/form/controls/table.js @@ -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){ diff --git a/frappe/public/js/frappe/web_form/web_form_list.js b/frappe/public/js/frappe/web_form/web_form_list.js index e28497b493..709ee66e06 100644 --- a/frappe/public/js/frappe/web_form/web_form_list.js +++ b/frappe/public/js/frappe/web_form/web_form_list.js @@ -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) }) diff --git a/frappe/utils/print_format.py b/frappe/utils/print_format.py index e325f17fc6..45f8926985 100644 --- a/frappe/utils/print_format.py +++ b/frappe/utils/print_format.py @@ -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)