Alvaro and I made some changes to the latest T in trunk. Now you can
do
>>> a=T('hello')
>>> T.force('it')
>>> print a
hello
[offline go and edit the the language it.py you will find
'hello':'hello', translate it to 'hello':'ciao']
>>> T.force('it') # reload the file
>>> print a
ciao
Mind that a is a lazyT object for backward compatibility and other
technical advantages.
You can also do T.lazy=False and now a is a string everywhere.
You can also do
>>> from gluon.storage import Messages
>>> m=Messages(T)
>>> m.hello="hello"
>>> T.force('it')
>>> print m.hello
ciao
where it T now? Messages calls T automatically when objects are
serialized. All Auth and Crud messages are now Messages hence you no
longer need to subclass Auth/Crud to customize the messages, you just
need the translation strings.
If your tests go well this will be in stable later this week.
Enjoy.
Massimo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---