Just a simpler idea : as the language file is a python dictionary, why
not put the comment in a python comment?

"source string": "target string", #comment

Cedric

On 22 mar, 15:53, Anthony <abasta...@gmail.com> wrote:
> > 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"
>
> Right now, the language files are simply treated as Python dictionaries, so
> this structure would require a major change. Instead, maybe you can just
> write a special helper that takes a string and a comment, adds the comment
> to the string, passes the combined string/comment to T(), and then removes
> the comment from the value returned by T() upon serialization. So, in your
> language file, before translation you'd end up with something like:
>
> "source string [[comment: my comment]]": "source string [[comment: my
> comment]]"
>
> When retrieving a translation, your helper would then look for " [[comment:
> .*]]$" at the end of the retrieved value and remove it if it is there.
>
> Anthony

Reply via email to