def add_lang_dict(code):
 messages = extract_messages_from_code(code)
 messages = [message for (pos, message) in messages]
 code += (u'\n\n$.extend(frappe._messages, %s)' % json.dumps(make_dict_from_messages(messages)))
 return code

def add_lang_dict ( code ) : messages = extract_messages_from_code ( code ) messages = [ message for ( pos , message ) in messages ] code += ( u'\n\n$.extend(frappe._messages, %s)' % json . dumps ( make_dict_from_messages ( messages ) ) ) return code
extracts messages and returns javascript code snippet to be appened at the end of the given script .