-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Alessandro,

Thanks for your reply, but what about my second question on tgext.admin
translation?

For the first question, I actually already use customized templates like
this:

class AlarmesAdminLayout(BootstrapAdminLayout):
    crud_templates = {
        'get_all': ['mako:alarmes.templates.admin_get_all'],
        'edit': ['mako:alarmes.templates.admin_edit'],
        'new': ['mako:alarmes.templates.admin_new']}
    template_index = 'alarmes.templates.admin_index'

So I already changed to ${_(model)} ;) I thought I might have missed a
more generic solution.

I think it would be great if we could add attributes to the sqlalchemy
model that would be reused by tgext.admin pages:

class User(DeclarativeBase):
    __tablename__ = 'tg_user'
    __label__ = l_(u'user')
    __help_text__ = l_(u'user name for logging in')
...

So if model has a __label__ it is reused in the admin pages, else
__name__ is used. What do you think?


Best regards,
- -- 
Jean-Denis Girard

SysNux                  Systèmes Linux en Polynésie française
http://www.sysnux.pf/   Tél: +689 40.50.10.40 / GSM: +689 87.79.75.27

Le 05/12/2015 22:56, Alessandro Molina a écrit :
> The good news is that you can do it,
> the bad news is that it's not easy :)
> 
> As "User" is actually the name of your Model Class  there is no easy w
ay
> to translate it.
> 
> The easiest way I can think of is to use the template patches feature
> ( https://github.com/TurboGears/tgext.pluggable#patching-templates ) a
nd
> replace content of .crud_edit > h2 (for /edit, each template will
> probably require a different selector) with a template that has
> ${_(model)} then you can add "User" in your .po file and translate it.
> 
> On Sun, Dec 6, 2015 at 2:47 AM, Jean-Denis Girard <[email protected]
> <mailto:[email protected]>> wrote:
> 
> Hi list,
> 
> I'm trying to use tgext.admin for the fist time. I was able to achieve
> more or less what I wanted by reading the docs or code, and I like thi
s
> facility.
> 
> One thing I could not do is to change the text of the tables, on the
> admin_* pages. For example, the "User" class is displayed as User in t
he
> index or list new / edit forms. I would like to display French
> "Utilisateur", or even better customize text on links and page titles.
> Is it doable?
> 
> Also I have seen that the widget generated by tgext.admin are i18n rea
dy
> (eg delete confirmation is l_('Are you sure?')): what is the proper wa
y
> to translate these strings, as they are not included with "python
> setup.py extract_messages"?
> 
> 
> Thanks,
> 
>     --
>     You received this message because you are subscribed to the Google
>     Groups "TurboGears" group.
>     To unsubscribe from this group and stop receiving emails from it,
>     send an email to [email protected]
>     <mailto:turbogears%[email protected]>.
>     To post to this group, send email to [email protected]
>     <mailto:[email protected]>.
>     Visit this group at http://groups.google.com/group/turbogears.
>     For more options, visit https://groups.google.com/d/optout.
> 
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "TurboGears" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected]
> <mailto:[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> Visit this group at http://groups.google.com/group/turbogears.
> For more options, visit https://groups.google.com/d/optout.

-----BEGIN PGP SIGNATURE-----

iEYEARECAAYFAlZkfS0ACgkQuu7Rv+oOo/gmxQCgnapnGrYasxktupgkVj5+vVfg
AT8AoIxldjNLojNZC7nDOE70gn0iblJQ
=zlEQ
-----END PGP SIGNATURE-----

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.

Reply via email to