Hmm.. I had this idea a long time ago. Never got around to implementing it, 
though. Here's an email that was sitting in my drafts box for over a year. 
It's got some additional suggestions, too:

The T object and simple internationalization is one of the reasons I chose 
the Web2Py framework. After toying with it for a bit, I have some 
suggestions to make it even better:

Even the simple Welcome app already has pages of translation strings! How 
about some tools to organize them?

   - Optionally hide strings that have already been translated.
   - Add an optional hint parameter to T(). This string is displayed next 
   to the original string in the admin interface. It simply gives more 
   clues/context for the translation. Example: T("Enter ", hint="Noun: also 
   called Return key (not the verb!)")
   - Add optional translation contexts. These would be useful for grouping 
   strings that belong together, for example those that appear in the same 
   form or page. These could be defined like the authorization decorations 
   over a block of code, or explicitly opened and closed with calls to 
   TCONTEXT().
   - Common strings (like "yes" and "no") may end up with multiple 
   contexts--I imagine contexts more like tags. Although the same translation 
   is applied to every context by default, certain contexts could be 
   over-ridden when they don't fit. (For example, 
contronyms<http://www.rinkworks.com/words/contronyms.shtml> may 
   need context-based translation to other languages.)
   

If I end up developing an app that needs heavy-duty localization, I will 
probably end up implementing some of the ideas from above.

John-Kim

On Thursday, March 22, 2012 10:18:16 PM UTC+9, Kalpa Welivitigoda wrote:
>
> Hi,
>
> I am working on a translation enhancement project on sahana-eden[1]. 
> sahana-eden uses the translation feature of web2py. Is it possible to have 
> a modified T() function so that the developer can leave a comment for the 
> translator, for example T("This is a SAMPLE", "keep SAMPLE as it is") where 
> the second argument is the comment. Or is there any other mechanism in 
> web2py to accomplish this task. Further the language file in 
> /applications/<application name>/languages/.py should be in the format
>
> "source string": "target string": "comment"
>
> I may be able to modify my local web2py so that this is accomplished. 
> Rather I would like to see this upstream as for 
> 1) sahana-eden is deployed with web2py framework so it needs it's core 
> functions build into it (patching is not so nice)
> 2) there will be many other projects existing or about to deploy on web2py 
> which will be benefited with this method.
>
> The whole idea is that the translator has more information that will 
> ultimately help to end in a better translation.
>
> I'm willing to contribute in code if the developers want me to.
>
> [1] eden.sahanafoundation.org
>
> Thank you
>

Reply via email to