Merge pull request #7935 from scmmishra/web-form-translation

feat (web-form): enabled translations for web_forms
This commit is contained in:
mergify[bot] 2019-07-18 16:08:24 +00:00 committed by GitHub
commit 9e77bfb876
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -79,7 +79,7 @@ frappe.boot = {
};
// for backward compatibility of some libs
frappe.sys_defaults = frappe.boot.sysdefaults;
frappe._messages = {{ translated_messages }};
$(".file-size").each(function() {
$(this).text(frappe.form.formatters.FileSize($(this).text()));
});

View file

@ -173,6 +173,11 @@ def get_context(context):
context.max_attachment_size = get_max_file_size() / 1024 / 1024
context.show_in_grid = self.show_in_grid
self.load_translations(context)
def load_translations(self, context):
translated_messages = frappe.translate.get_dict('doctype', self.doc_type)
context.translated_messages = frappe.as_json(translated_messages)
def load_document(self, context):
'''Load document `doc` and `layout` properties for template'''