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.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to