Re: [pylons-devel] i18n in deformdemo dysfunctional - solved!

2017-02-09 Thread Hans-Peter Jansen
On Mittwoch, 8. Februar 2017 16:33:17 Michael Merickel wrote:
> I got the renderer working via the following diff. Unfortunately the
> translator is still not invoked which leads me to believe that there is
> something wrong with the i18n tags in the chameleon templates, but I don't
> know enough about chameleon to dive in there. Hopefully this was helpful
> though.

Thank you for that. 

I found the culprit! The call to:

deform.renderer.configure_zpt_renderer()

intercepts the translation handling by replacing the carefully constructed 
zpt_renderer with a default one, that omits any translators.

Hrmpf. I'm preparing fixes for deformdemo at the moment, and will report this 
issue to the deform project.

While at it, what is the purpose of these hidden schema nodes:

_LOCALE_ = colander.SchemaNode(
colander.String(),
widget=deform.widget.HiddenWidget(),
default=locale_name)

Cheers,
Pete

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-devel+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/pylons-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [pylons-devel] i18n in deformdemo dysfunctional

2017-02-09 Thread Hans-Peter Jansen
Hi Michael,

I will look into this right now. 

Thanks for your care. Much appreciated.

Cheers,
Pete

On Mittwoch, 8. Februar 2017 16:33:17 Michael Merickel wrote:
> I got the renderer working via the following diff. Unfortunately the
> translator is still not invoked which leads me to believe that there is
> something wrong with the i18n tags in the chameleon templates, but I don't
> know enough about chameleon to dive in there. Hopefully this was helpful
> though.
> 
> diff --git a/deformdemo/__init__.py b/deformdemo/__init__.py
> 
> > index 098046a..6f023f6 100644
> > --- a/deformdemo/__init__.py
> > +++ b/deformdemo/__init__.py
> > 
> > @@ -70,7 +70,7 @@ def translator(term):
> >  deform_template_dir = resource_filename('deform', 'templates/')
> >  zpt_renderer = deform.ZPTRendererFactory(
> > 
> > -[deform_template_dir], translator=translator)
> > +(deform_template_dir,), translator=translator)
> > 
> >  # the zpt_renderer above is referred to within the demo.ini file by
> > 
> > dotted name
> > 
> > @@ -2763,8 +2763,8 @@ def main(global_config, **settings):
> >  config.include('pyramid_chameleon')
> >  renderer = config.maybe_dotted(renderer)
> > 
> > -#deform.Form.set_default_renderer(renderer)
> > -deform.renderer.configure_zpt_renderer(["deformdemo:custom_widgets"])
> > +deform.Form.set_default_renderer(renderer)
> > +   
> > deform.renderer.configure_zpt_renderer(("deformdemo:custom_widgets",))
> > 
> >  config.add_static_view('static_deform', 'deform:static')
> >  config.add_static_view('static_demo', 'deformdemo:static')
> 
> On Wed, Feb 8, 2017 at 4:19 PM, Michael Merickel  wrote:
> > I noticed that the renderer is not being used. The
> > `deform.Form.set_default_renderer(render)` is commented out. Uncommenting
> > it doesn't solve the problem but it's definitely an issue as the
> > zpt_renderer isn't actually being used as a result.
> > 
> > On Wed, Feb 8, 2017 at 4:14 PM, Michael Merickel 
> > 
> > wrote:
> >> The issue is *usually* that the TranslationString instance hasn't been
> >> run through `request.localizer.translate(..)`. Now, why not? I haven't
> >> dug in to try and figure that out yet.
> >> 
> >> On Wed, Feb 8, 2017 at 3:55 PM, Hans-Peter Jansen  wrote:
> >>> Hi,
> >>> 
> >>> I've used a good part of the day for getting i18n fixed in deformdemo,
> >>> but failed so far. :(
> >>> 
> >>> While all debug instrumentation show green lights, the translation
> >>> strings aren't picked up for some reason:
> >>> 
> >>> 2017-02-08 22:49:07,717 DEBUG [deformdemo:63][waitress] locale_name from
> >>> default_locale_negotiator: de
> >>> 2017-02-08 22:49:07,718 DEBUG [deformdemo:2080][waitress] locale_name:
> >>> de, request._LOCALE_: de
> >>> 2017-02-08 22:49:09,795 DEBUG [deformdemo:63][waitress] locale_name from
> >>> default_locale_negotiator: en
> >>> 2017-02-08 22:49:09,795 DEBUG [deformdemo:2080][waitress] locale_name:
> >>> en, request._LOCALE_: en
> >>> 2017-02-08 22:49:10,897 DEBUG [deformdemo:63][waitress] locale_name from
> >>> default_locale_negotiator: de
> >>> 2017-02-08 22:49:10,897 DEBUG [deformdemo:2080][waitress] locale_name:
> >>> de, request._LOCALE_: de
> >>> 2017-02-08 22:49:12,345 DEBUG [deformdemo:63][waitress] locale_name from
> >>> default_locale_negotiator: nl
> >>> 2017-02-08 22:49:12,345 DEBUG [deformdemo:2080][waitress] locale_name:
> >>> nl, request._LOCALE_: nl
> >>> 
> >>> I've uploaded it here: https://github.com/frispete/deformdemo
> >>> 
> >>> Could somebody more familiar with the pyramid translation machinery be
> >>> so kind to have a look into this?
> >>> 
> >>> Thanks in advance,
> >>> Pete
> >>> 
> >>> --
> >>> You received this message because you are subscribed to the Google
> >>> Groups "pylons-devel" group.
> >>> To unsubscribe from this group and stop receiving emails from it, send
> >>> an email to pylons-devel+unsubscr...@googlegroups.com.
> >>> To post to this group, send email to pylons-devel@googlegroups.com.
> >>> Visit this group at https://groups.google.com/group/pylons-devel.
> >>> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-devel+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/pylons-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [pylons-devel] i18n in deformdemo dysfunctional

2017-02-08 Thread Michael Merickel
I got the renderer working via the following diff. Unfortunately the
translator is still not invoked which leads me to believe that there is
something wrong with the i18n tags in the chameleon templates, but I don't
know enough about chameleon to dive in there. Hopefully this was helpful
though.

diff --git a/deformdemo/__init__.py b/deformdemo/__init__.py
> index 098046a..6f023f6 100644
> --- a/deformdemo/__init__.py
> +++ b/deformdemo/__init__.py
> @@ -70,7 +70,7 @@ def translator(term):
>  deform_template_dir = resource_filename('deform', 'templates/')
>  zpt_renderer = deform.ZPTRendererFactory(
> -[deform_template_dir], translator=translator)
> +(deform_template_dir,), translator=translator)
>  # the zpt_renderer above is referred to within the demo.ini file by
> dotted name
> @@ -2763,8 +2763,8 @@ def main(global_config, **settings):
>  config.include('pyramid_chameleon')
>  renderer = config.maybe_dotted(renderer)
> -#deform.Form.set_default_renderer(renderer)
> -deform.renderer.configure_zpt_renderer(["deformdemo:custom_widgets"])
> +deform.Form.set_default_renderer(renderer)
> +deform.renderer.configure_zpt_renderer(("deformdemo:custom_widgets",))
>  config.add_static_view('static_deform', 'deform:static')
>  config.add_static_view('static_demo', 'deformdemo:static')


On Wed, Feb 8, 2017 at 4:19 PM, Michael Merickel  wrote:

> I noticed that the renderer is not being used. The
> `deform.Form.set_default_renderer(render)` is commented out. Uncommenting
> it doesn't solve the problem but it's definitely an issue as the
> zpt_renderer isn't actually being used as a result.
>
> On Wed, Feb 8, 2017 at 4:14 PM, Michael Merickel 
> wrote:
>
>> The issue is *usually* that the TranslationString instance hasn't been
>> run through `request.localizer.translate(..)`. Now, why not? I haven't
>> dug in to try and figure that out yet.
>>
>> On Wed, Feb 8, 2017 at 3:55 PM, Hans-Peter Jansen  wrote:
>>
>>> Hi,
>>>
>>> I've used a good part of the day for getting i18n fixed in deformdemo,
>>> but failed so far. :(
>>>
>>> While all debug instrumentation show green lights, the translation
>>> strings aren't picked up for some reason:
>>>
>>> 2017-02-08 22:49:07,717 DEBUG [deformdemo:63][waitress] locale_name from
>>> default_locale_negotiator: de
>>> 2017-02-08 22:49:07,718 DEBUG [deformdemo:2080][waitress] locale_name:
>>> de, request._LOCALE_: de
>>> 2017-02-08 22:49:09,795 DEBUG [deformdemo:63][waitress] locale_name from
>>> default_locale_negotiator: en
>>> 2017-02-08 22:49:09,795 DEBUG [deformdemo:2080][waitress] locale_name:
>>> en, request._LOCALE_: en
>>> 2017-02-08 22:49:10,897 DEBUG [deformdemo:63][waitress] locale_name from
>>> default_locale_negotiator: de
>>> 2017-02-08 22:49:10,897 DEBUG [deformdemo:2080][waitress] locale_name:
>>> de, request._LOCALE_: de
>>> 2017-02-08 22:49:12,345 DEBUG [deformdemo:63][waitress] locale_name from
>>> default_locale_negotiator: nl
>>> 2017-02-08 22:49:12,345 DEBUG [deformdemo:2080][waitress] locale_name:
>>> nl, request._LOCALE_: nl
>>>
>>> I've uploaded it here: https://github.com/frispete/deformdemo
>>>
>>> Could somebody more familiar with the pyramid translation machinery be
>>> so kind to have a look into this?
>>>
>>> Thanks in advance,
>>> Pete
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "pylons-devel" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to pylons-devel+unsubscr...@googlegroups.com.
>>> To post to this group, send email to pylons-devel@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/pylons-devel.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-devel+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/pylons-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [pylons-devel] i18n in deformdemo dysfunctional

2017-02-08 Thread Michael Merickel
I noticed that the renderer is not being used. The
`deform.Form.set_default_renderer(render)` is commented out. Uncommenting
it doesn't solve the problem but it's definitely an issue as the
zpt_renderer isn't actually being used as a result.

On Wed, Feb 8, 2017 at 4:14 PM, Michael Merickel  wrote:

> The issue is *usually* that the TranslationString instance hasn't been run
> through `request.localizer.translate(..)`. Now, why not? I haven't dug in
> to try and figure that out yet.
>
> On Wed, Feb 8, 2017 at 3:55 PM, Hans-Peter Jansen  wrote:
>
>> Hi,
>>
>> I've used a good part of the day for getting i18n fixed in deformdemo,
>> but failed so far. :(
>>
>> While all debug instrumentation show green lights, the translation
>> strings aren't picked up for some reason:
>>
>> 2017-02-08 22:49:07,717 DEBUG [deformdemo:63][waitress] locale_name from
>> default_locale_negotiator: de
>> 2017-02-08 22:49:07,718 DEBUG [deformdemo:2080][waitress] locale_name:
>> de, request._LOCALE_: de
>> 2017-02-08 22:49:09,795 DEBUG [deformdemo:63][waitress] locale_name from
>> default_locale_negotiator: en
>> 2017-02-08 22:49:09,795 DEBUG [deformdemo:2080][waitress] locale_name:
>> en, request._LOCALE_: en
>> 2017-02-08 22:49:10,897 DEBUG [deformdemo:63][waitress] locale_name from
>> default_locale_negotiator: de
>> 2017-02-08 22:49:10,897 DEBUG [deformdemo:2080][waitress] locale_name:
>> de, request._LOCALE_: de
>> 2017-02-08 22:49:12,345 DEBUG [deformdemo:63][waitress] locale_name from
>> default_locale_negotiator: nl
>> 2017-02-08 22:49:12,345 DEBUG [deformdemo:2080][waitress] locale_name:
>> nl, request._LOCALE_: nl
>>
>> I've uploaded it here: https://github.com/frispete/deformdemo
>>
>> Could somebody more familiar with the pyramid translation machinery be
>> so kind to have a look into this?
>>
>> Thanks in advance,
>> Pete
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "pylons-devel" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to pylons-devel+unsubscr...@googlegroups.com.
>> To post to this group, send email to pylons-devel@googlegroups.com.
>> Visit this group at https://groups.google.com/group/pylons-devel.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-devel+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/pylons-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [pylons-devel] i18n in deformdemo dysfunctional

2017-02-08 Thread Michael Merickel
The issue is *usually* that the TranslationString instance hasn't been run
through `request.localizer.translate(..)`. Now, why not? I haven't dug in
to try and figure that out yet.

On Wed, Feb 8, 2017 at 3:55 PM, Hans-Peter Jansen  wrote:

> Hi,
>
> I've used a good part of the day for getting i18n fixed in deformdemo,
> but failed so far. :(
>
> While all debug instrumentation show green lights, the translation
> strings aren't picked up for some reason:
>
> 2017-02-08 22:49:07,717 DEBUG [deformdemo:63][waitress] locale_name from
> default_locale_negotiator: de
> 2017-02-08 22:49:07,718 DEBUG [deformdemo:2080][waitress] locale_name: de,
> request._LOCALE_: de
> 2017-02-08 22:49:09,795 DEBUG [deformdemo:63][waitress] locale_name from
> default_locale_negotiator: en
> 2017-02-08 22:49:09,795 DEBUG [deformdemo:2080][waitress] locale_name: en,
> request._LOCALE_: en
> 2017-02-08 22:49:10,897 DEBUG [deformdemo:63][waitress] locale_name from
> default_locale_negotiator: de
> 2017-02-08 22:49:10,897 DEBUG [deformdemo:2080][waitress] locale_name: de,
> request._LOCALE_: de
> 2017-02-08 22:49:12,345 DEBUG [deformdemo:63][waitress] locale_name from
> default_locale_negotiator: nl
> 2017-02-08 22:49:12,345 DEBUG [deformdemo:2080][waitress] locale_name: nl,
> request._LOCALE_: nl
>
> I've uploaded it here: https://github.com/frispete/deformdemo
>
> Could somebody more familiar with the pyramid translation machinery be
> so kind to have a look into this?
>
> Thanks in advance,
> Pete
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pylons-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to pylons-devel@googlegroups.com.
> Visit this group at https://groups.google.com/group/pylons-devel.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-devel+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/pylons-devel.
For more options, visit https://groups.google.com/d/optout.


[pylons-devel] i18n in deformdemo dysfunctional

2017-02-08 Thread Hans-Peter Jansen
Hi,

I've used a good part of the day for getting i18n fixed in deformdemo, 
but failed so far. :(

While all debug instrumentation show green lights, the translation 
strings aren't picked up for some reason:

2017-02-08 22:49:07,717 DEBUG [deformdemo:63][waitress] locale_name from 
default_locale_negotiator: de
2017-02-08 22:49:07,718 DEBUG [deformdemo:2080][waitress] locale_name: de, 
request._LOCALE_: de
2017-02-08 22:49:09,795 DEBUG [deformdemo:63][waitress] locale_name from 
default_locale_negotiator: en
2017-02-08 22:49:09,795 DEBUG [deformdemo:2080][waitress] locale_name: en, 
request._LOCALE_: en
2017-02-08 22:49:10,897 DEBUG [deformdemo:63][waitress] locale_name from 
default_locale_negotiator: de
2017-02-08 22:49:10,897 DEBUG [deformdemo:2080][waitress] locale_name: de, 
request._LOCALE_: de
2017-02-08 22:49:12,345 DEBUG [deformdemo:63][waitress] locale_name from 
default_locale_negotiator: nl
2017-02-08 22:49:12,345 DEBUG [deformdemo:2080][waitress] locale_name: nl, 
request._LOCALE_: nl

I've uploaded it here: https://github.com/frispete/deformdemo

Could somebody more familiar with the pyramid translation machinery be
so kind to have a look into this?

Thanks in advance,
Pete

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-devel+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/pylons-devel.
For more options, visit https://groups.google.com/d/optout.