On Wed, May 13, 2009 at 11:30 PM, Jason Brower <[email protected]> wrote:
>
> If I remember, everyone was talking about some new way to translate all
> strings in an html document that was created.  Making it so you didn't
> have to find all your strings and T() them all.  Is that correct?  If
> so, could someone point me to the correct documentation about that?
> Also, when we have no features, I think it would be important to tweet
> about them and make reference to the documentation of that new feature.
> Regards,
> Jason

Hi Jason,
I'm working in this feature and it is not complete.
Actually we have in trunk two new features:

1- What I called "dynamic translation system": you can call
T(something) and something would be a 'static' string (like "word") or
some 'dynamic' data: data retrieved from DB, from user input etc. If
there is no translation to that parameter (something) so T adds it to
T.language_file with 'no' translation (key = value in dict
translation).
So you can translate strings 'on demand': when it "happen", first user
will se text untranslated but after you can translate.
Note that link 'update languages' in admin only adds to language files
STATIC strings.

2- We have a new class: Messages. I called it StorageT but Massimo renamed. :-P
When web2py starts (and loads gluon/*.py) the name T is not avaible,
so is not possible to use something like: self.messages.invalid_login
= T('Invalid login') to translate CRUD strings, for example. But this
string ('invalid login') is used when some user requests a page. So
what we do is:
    #in some class, like Crud, Auth, ...
    self.messages = Messages(environment)
    self.messages.invalid_login = 'Invalid login'
    #other strings...

Class Messages will store strings without using T(). But when we want
to retrieve data from this T is just defined so we can translate that
string (we will only use these strings when user request a page, so T
is avaible). Resuming: Messages store strings/data as they are, but
when we request an attribute of Messages (like in
"{{=auth.messages.invalid_login}}"), Messages calls T() to translated
that string/data and retrieve translated string/data (if translated
string/data does not exist, it is added as I stated in "1" above).

--

I'm working to create a "global" translation system and will write
documentation of all of this when I end this code. This email will
help me. ;-)
The goal is to have web2py's language files (now we only have
applications' language files). So we can translate all the framework
(I'm talking about gluon/tools.py, gluon/sqlhtml.py etc.).

-- 
 Á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
-~----------~----~----~----~------~----~------~--~---

Reply via email to