Hello,
The following codes changes dynamically the title of the button on the top left of the form in English.
But when I switch to another language (exemple FR), I get the French translation of 'Add record to database', and not the translation of what I have placed in the title of this button.
Example:
form = SQLFOR.smartgrid(db[my_table]..., showbuttontext=False, ...)
if not 'view' in request.args and not 'edit' in request.args and not 'new' in request.args:
addbutton = form.element(_title='Add record to database')
my_table = 'my application table'
addbutton['_title'] = '%s %s' % ( T('Add'), db[my_table]._singular
return dict(form = form)
=> in English, the title of the + button is 'Add' + the value of db[my_table]._singular : This is perfect!
=> in French, I always get 'Ajout d'un enregistrement', which is the translation of 'Add record to database'. : this is not what I want...
I have tried the following, but, same result:
if not 'view' in request.args and not 'edit' in request.args and not 'new' in request.args:
my_title = T('Add record to database)'
addbutton = form.element(_title= my_title)
my_table = 'my application table'
addbutton['_title'] = '%s %s' % ( T('Add'), db[my_table]._singular
return dict(form = form)
Thanks for any advise for translating the title of the top left '+' button when I change if in the controller.