diff --git a/frappe/__init__.py b/frappe/__init__.py index 1f1fd5e7a9..a3f7d4042f 100644 --- a/frappe/__init__.py +++ b/frappe/__init__.py @@ -1250,7 +1250,7 @@ def get_print(doctype=None, name=None, print_format=None, style=None, html=None, else: return html -def attach_print(doctype, name, file_name=None, print_format=None, style=None, html=None, doc=None): +def attach_print(doctype, name, file_name=None, print_format=None, style=None, html=None, doc=None, lang=None): from frappe.utils import scrub_urls if not file_name: file_name = name @@ -1258,6 +1258,10 @@ def attach_print(doctype, name, file_name=None, print_format=None, style=None, h print_settings = db.get_singles_dict("Print Settings") + _lang = local.lang + + #set lang as specified in print format attachment + if lang: local.lang = lang local.flags.ignore_print_permissions = True if int(print_settings.send_print_as_pdf or 0): @@ -1272,6 +1276,8 @@ def attach_print(doctype, name, file_name=None, print_format=None, style=None, h } local.flags.ignore_print_permissions = False + #reset lang to original local lang + local.lang = _lang return out diff --git a/frappe/email/queue.py b/frappe/email/queue.py index 085dfb0c18..d6bcce6c8f 100755 --- a/frappe/email/queue.py +++ b/frappe/email/queue.py @@ -168,6 +168,7 @@ def get_email_queue(recipients, sender, subject, **kwargs): if att.get('fid'): _attachments.append(att) elif att.get("print_format_attachment") == 1: + att['lang'] = frappe.local.lang _attachments.append(att) e.attachments = json.dumps(_attachments) diff --git a/frappe/public/js/frappe/views/communication.js b/frappe/public/js/frappe/views/communication.js index 19fd967897..59808efa98 100755 --- a/frappe/public/js/frappe/views/communication.js +++ b/frappe/public/js/frappe/views/communication.js @@ -273,7 +273,7 @@ frappe.views.CommunicationComposer = Class.extend({ this.lang_code = doc.language //On selection of language retrieve language code - $(fields.language_sel.input).click(function(){ + $(fields.language_sel.input).change(function(){ me.lang_code = this.value })