On Mon, Apr 27, 2009 at 11:28 PM, mdipierro <[email protected]> wrote:
> 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.
I think deleting lazyT won't break compability. If a user have lazyT,
to use it he will transform it in a string (does anyone use lazyT for
anything else?) - so, if we return string, user will convert a string
to string, wich has the same effect.
One thing that will change is lazyT.xml() - anyone uses it?
Well, I think lazyT is not necessary. :-P
> 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.
In future web2py will have a language file to 'internal' strings. Now
it is made changing strings in each app.
--
Álvaro Justen
Peta5 - Telecomunicações e Software Livre
21 3021-6001 / 9898-0141
http://www.peta5.com.br/
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---