Merge pull request #16079 from surajshetty3416/fix-translation-for-included-files

This commit is contained in:
Suraj Shetty 2022-02-22 19:05:01 +05:30 committed by GitHub
commit 4c2f14f824
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -576,13 +576,15 @@ def get_server_messages(app):
def get_messages_from_include_files(app_name=None):
"""Returns messages from js files included at time of boot like desk.min.js for desk and web"""
from frappe.utils.jinja_globals import bundled_asset
messages = []
app_include_js = frappe.get_hooks("app_include_js", app_name=app_name) or []
web_include_js = frappe.get_hooks("web_include_js", app_name=app_name) or []
include_js = app_include_js + web_include_js
for js_path in include_js:
relative_path = os.path.join(frappe.local.sites_path, js_path.lstrip('/'))
file_path = bundled_asset(js_path)
relative_path = os.path.join(frappe.local.sites_path, file_path.lstrip('/'))
messages_from_file = get_messages_from_file(relative_path)
messages.extend(messages_from_file)