Re: [web2py] Re: Long text internationalization

2019-02-13 Thread Jon Subscripted
Thanks Dave,
For now I do not expect to go for pages long texts.
But still I'll take a look at how web2py-book is implemented.
Regards, Jon.

On Wed, Feb 13, 2019 at 12:39 AM Dave S  wrote:

>
>
> On Tuesday, February 12, 2019 at 3:57:36 AM UTC-8, Jonsubs wrote:
>>
>> Hi everyone,
>> Which is the common practice when facing long text internationalization?
>>
>> For instance, What should be done when you want to render a web page,
>> sharing a common layout, that has several paragraphs that must be
>> completelly translated?
>>
>> Based on the manual (
>> http://www.web2py.com/books/default/chapter/29/04/the-core#Internationalization-and-Pluralization-with-T
>> ) only string constants should be used with T. My guess is that large texts
>> should be treated differently.
>>
>> Thanks & Regards, Jon.
>>
>
>
> It looks like you're set for paragraphs of [previously] translated text.
> For really large pieces (pages long), you can take a look at how the web2py
> book does it:
> https://github.com/web2py/web2py-book>
> (just another web2py app, but the book content is in the sources
> sub-directory)
>
> Does Google Translate have an API?  If it does, that would probably be
> like using jQuery divs.
>
> FWIW, there's an interesting article (one of 3, it seems) about using a
> VPN to block app's from accessing Google resources;
>  https://gizmodo.com/i-cut-google-out-of-my-life-it-screwed-up-everything-1839565500
> >
> [It would certainly be hard to use this group for support if you blocked
> access to Google servers.]
> [[ Google controls 8,699,648 IP addresses, per the article]]
>
> /dps
>
> --
> 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.


Re: [web2py] Re: Long text internationalization

2019-02-12 Thread Jon Subscripted
Thanks Leonel!!
I'll use your plugin then.
Regards, Jon.

On Tue, Feb 12, 2019 at 1:37 PM Leonel Câmara 
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.