Syntax of code Frappe Framework

frm.add_custom_button(__(“Load Attachments”), function(foo)
why this underscore are there?
it’s my first time that i work with framework, m sorry

hi @Leonardo_Augusto watch this series. it will answer your questions.

I watch this, but i don’t understand very well… I’ll watch again

1 Like

That is a function to return the translated version of the input.
Say the user is a spanish, so whatever you give parameter, like “Hello”, it will fetch from the translation .csv files (located in each app under app_name/translations/, check in erpnext app for a start).

It is _('Hello') in python, and __('Hello') in javascript.
You will have to import in python though. ( from frappe import _ )

Hope it helps :slight_smile:

1 Like