Thanks Leonel!!
I'll use your plugin then.
Regards, Jon.

On Tue, Feb 12, 2019 at 1:37 PM Leonel Câmara <leonelcam...@gmail.com>
wrote:

> Large texts are actually fine as long as they're kind of static.
>
> For dynamic long texts I store them in a JSON field where I have a dict
> with a key for each language I want to support, I actually made a plugin
> which gives you a nice widget for this field json field which you can put
> in your modules folder and import it. I'll annex it.
>
> Example usage:
>
> from plugin_json_translation import TranslateWidget
>
> def represent_lang(v, row):
>     if v is None:
>         return v
>     if T.accepted_language[:2] in v:
>         return v[LANG]
>     else:
>         return v['en']
>
> db.define_table('my_test',
>     Field('body', 'json', widget=TranslateWidget().widget, requires=
> IS_EMPTY_OR(IS_JSON()), represent=represent_lang),
> )
>
>
> Then you just need to call render when you get my_test rows and you will
> get a translated version.
>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to