Re: [tg-trunk] extract_messages for *.jinja does not work at all.

2016-10-19 Thread Mingcai SHEN
No, the default silent is True:

silent = getbool(options, 'silent', True)

--


在 2016年10月19日星期三 UTC+8下午6:11:50,Christoph Zwerschke写道:
>
> Am 19.10.2016 um 07:57 schrieb Mingcai SHEN: 
> > I finally find the problem after I changed silent to false: 
>
> Glad you found it. I thought that silent=false was the default in 2.8, 
> but in fact the default didn't change, you need to set it explicitly. 
>
> -- Chris 
>

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


Re: [tg-trunk] extract_messages for *.jinja does not work at all.

2016-10-19 Thread Christoph Zwerschke

Am 19.10.2016 um 07:57 schrieb Mingcai SHEN:

I finally find the problem after I changed silent to false:


Glad you found it. I thought that silent=false was the default in 2.8, 
but in fact the default didn't change, you need to set it explicitly.


-- Chris

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


Re: [tg-trunk] extract_messages for *.jinja does not work at all.

2016-10-19 Thread Mingcai SHEN
It finally works:

message_extractors={'fortress': [
('**.py', 'python', None),
('templates/**.jinja', 'jinja2', {'silent': 'false', *'extensions': 
'jinja2.ext.autoescape,jinja2.ext.with_'*}),
('public/**', 'ignore', None)
]},


Thanks.
--

在 2016年10月18日星期二 UTC+8下午7:03:47,Christoph Zwerschke写道:
>
> Am 18.10.2016 um 06:29 schrieb Mingcai SHEN: 
> > I tried both on linux and windows, and they are the same, not text 
> > inside the tags was extracted into pot file. very strange 
> > Problem with virtualenv ? 
>
> It should work with virtualenv as well. 
> Here are the steps you should try: 
>
> Create and activate a virtual env, then: 
>
> pip install tg.devtools 
> gearbox quickstart -jnx example 
> cd example 
> pip install . 
>
> In example/templates/about.jinja, 
> under {% block contents %} add these lines: 
>
> {{ gettext('Hello gettext!') }} 
> {% trans %}Hello trans!{% endtrans %} 
>
> Then run: 
>
> python setup.py extract_messages 
>
> The output should now contain the line: 
> "extracting messages from example/templates/about.jinja" 
>
> The file example/i18n/example.pot should be created 
> and should contain these lines taken from about.jinja: 
>
> msgid "Hello gettext!" 
> msgid "Hello trans!" 
>
> -- Chris 
>
> > 在 2016年10月17日星期一 UTC+8下午9:39:07,Christoph Zwerschke写道: 
> > 
> > Am 17.10.2016 um 14:56 schrieb Mingcai SHEN: 
> > > But it just can extract {% trans %} {% endtrans %} or {{ 
> > gettext('') }} 
> > > from the template files into the pot file. 
> > 
> > You meant *can't* extract, not *can* extract, right? 
> > 
> > I just tried it with a newly created project, and this simple 
> template: 
> > 
> >  
> > {{ gettext('Hello gettext!') }} 
> > {% trans %}Hello trans!{% endtrans %} 
> >  
> > 
> > Both texts were copied to the i18n/*.pot file. 
> > 
> > I have used Python 2.7, TG 2.3.9, Babel 2.3.4 and Jinja2 2.8. 
> > 
> > Are you using any different versions? Also, does it work for you 
> with a 
> > newly created project and the above simple template? 
> > 
> > -- Chris 
>

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


Re: [tg-trunk] extract_messages for *.jinja does not work at all.

2016-10-18 Thread Mingcai SHEN
Hi Chris,

Thank you for your help.
I finally find the problem after I changed silent to false:  
   
jinja2.exceptions.TemplateSyntaxError: Encountered unknown tag 'with'.



在 2016年10月18日星期二 UTC+8下午7:03:47,Christoph Zwerschke写道:
>
> Am 18.10.2016 um 06:29 schrieb Mingcai SHEN: 
> > I tried both on linux and windows, and they are the same, not text 
> > inside the tags was extracted into pot file. very strange 
> > Problem with virtualenv ? 
>
> It should work with virtualenv as well. 
> Here are the steps you should try: 
>
> Create and activate a virtual env, then: 
>
> pip install tg.devtools 
> gearbox quickstart -jnx example 
> cd example 
> pip install . 
>
> In example/templates/about.jinja, 
> under {% block contents %} add these lines: 
>
> {{ gettext('Hello gettext!') }} 
> {% trans %}Hello trans!{% endtrans %} 
>
> Then run: 
>
> python setup.py extract_messages 
>
> The output should now contain the line: 
> "extracting messages from example/templates/about.jinja" 
>
> The file example/i18n/example.pot should be created 
> and should contain these lines taken from about.jinja: 
>
> msgid "Hello gettext!" 
> msgid "Hello trans!" 
>
> -- Chris 
>
> > 在 2016年10月17日星期一 UTC+8下午9:39:07,Christoph Zwerschke写道: 
> > 
> > Am 17.10.2016 um 14:56 schrieb Mingcai SHEN: 
> > > But it just can extract {% trans %} {% endtrans %} or {{ 
> > gettext('') }} 
> > > from the template files into the pot file. 
> > 
> > You meant *can't* extract, not *can* extract, right? 
> > 
> > I just tried it with a newly created project, and this simple 
> template: 
> > 
> >  
> > {{ gettext('Hello gettext!') }} 
> > {% trans %}Hello trans!{% endtrans %} 
> >  
> > 
> > Both texts were copied to the i18n/*.pot file. 
> > 
> > I have used Python 2.7, TG 2.3.9, Babel 2.3.4 and Jinja2 2.8. 
> > 
> > Are you using any different versions? Also, does it work for you 
> with a 
> > newly created project and the above simple template? 
> > 
> > -- Chris 
>

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


Re: [tg-trunk] extract_messages for *.jinja does not work at all.

2016-10-18 Thread Christoph Zwerschke

Am 18.10.2016 um 06:29 schrieb Mingcai SHEN:

I tried both on linux and windows, and they are the same, not text
inside the tags was extracted into pot file. very strange
Problem with virtualenv ?


It should work with virtualenv as well.
Here are the steps you should try:

Create and activate a virtual env, then:

pip install tg.devtools
gearbox quickstart -jnx example
cd example
pip install .

In example/templates/about.jinja,
under {% block contents %} add these lines:

{{ gettext('Hello gettext!') }}
{% trans %}Hello trans!{% endtrans %}

Then run:

python setup.py extract_messages

The output should now contain the line:
"extracting messages from example/templates/about.jinja"

The file example/i18n/example.pot should be created
and should contain these lines taken from about.jinja:

msgid "Hello gettext!"
msgid "Hello trans!"

-- Chris


在 2016年10月17日星期一 UTC+8下午9:39:07,Christoph Zwerschke写道:

Am 17.10.2016 um 14:56 schrieb Mingcai SHEN:
> But it just can extract {% trans %} {% endtrans %} or {{
gettext('') }}
> from the template files into the pot file.

You meant *can't* extract, not *can* extract, right?

I just tried it with a newly created project, and this simple template:


{{ gettext('Hello gettext!') }}
{% trans %}Hello trans!{% endtrans %}


Both texts were copied to the i18n/*.pot file.

I have used Python 2.7, TG 2.3.9, Babel 2.3.4 and Jinja2 2.8.

Are you using any different versions? Also, does it work for you with a
newly created project and the above simple template?

-- Chris


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


Re: [tg-trunk] extract_messages for *.jinja does not work at all.

2016-10-17 Thread Mingcai SHEN
Hi Chris

I have the same version in my vertualenv with python version 2.7.8 and 
2.7.12,
I tried both on linux and windows, and they are the same, not text inside 
the tags was extracted into pot file. very strange
Problem with virtualenv ?

--

在 2016年10月17日星期一 UTC+8下午9:39:07,Christoph Zwerschke写道:
>
> Am 17.10.2016 um 14:56 schrieb Mingcai SHEN: 
> > But it just can extract {% trans %} {% endtrans %} or {{ gettext('') }} 
> > from the template files into the pot file. 
>
> You meant *can't* extract, not *can* extract, right? 
>
> I just tried it with a newly created project, and this simple template: 
>
>  
> {{ gettext('Hello gettext!') }} 
> {% trans %}Hello trans!{% endtrans %} 
>  
>
> Both texts were copied to the i18n/*.pot file. 
>
> I have used Python 2.7, TG 2.3.9, Babel 2.3.4 and Jinja2 2.8. 
>
> Are you using any different versions? Also, does it work for you with a 
> newly created project and the above simple template? 
>
> -- Chris 
>

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


Re: [tg-trunk] extract_messages for *.jinja does not work at all.

2016-10-17 Thread Christoph Zwerschke

Am 17.10.2016 um 14:56 schrieb Mingcai SHEN:

But it just can extract {% trans %} {% endtrans %} or {{ gettext('') }}
from the template files into the pot file.


You meant *can't* extract, not *can* extract, right?

I just tried it with a newly created project, and this simple template:


{{ gettext('Hello gettext!') }}
{% trans %}Hello trans!{% endtrans %}


Both texts were copied to the i18n/*.pot file.

I have used Python 2.7, TG 2.3.9, Babel 2.3.4 and Jinja2 2.8.

Are you using any different versions? Also, does it work for you with a 
newly created project and the above simple template?


-- Chris

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


Re: [tg-trunk] extract_messages for *.jinja does not work at all.

2016-10-17 Thread Mingcai SHEN
Hi, Chris

Thank you for replying.
1. yes, the extension is "jinja" and they are inside templaes folder;
2. jinja2 version is 2.8
3. I can see the "extract messages from jinja" output when running 
"python setup.py extract_messages"
But it just can extract {% trans %} {% endtrans %} or {{ gettext('') }} 
from the template files into the pot file.

在 2016年10月13日星期四 UTC+8下午11:37:27,Christoph Zwerschke写道:
>
> Am 13.10.2016 um 15:14 schrieb Mingcai SHEN: 
> > I'm using TG2.3.9 with Jinja2 templates, and when I run "setup.py 
> > extract_messages", it does not extract any strings from jinja files 
> > inside {% trans %} block or {{ gettext('') }} etc... 
>
> This should work. Are you sure your templates have the extension 
> ".jinja" (and not ".jinja2" or ".html") and are living in the templates 
> directory (as specified in setup.py)? Are you sure there is no syntax 
> error in the jinja template? In Jinja 2.7 errors are silently ignored by 
> default, so it's recommended to set silent=false or use Jinja 2.8. 
>
> -- Chris 
>

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


Re: [tg-trunk] extract_messages for *.jinja does not work at all.

2016-10-13 Thread Christoph Zwerschke

Am 13.10.2016 um 15:14 schrieb Mingcai SHEN:

I'm using TG2.3.9 with Jinja2 templates, and when I run "setup.py
extract_messages", it does not extract any strings from jinja files
inside {% trans %} block or {{ gettext('') }} etc...


This should work. Are you sure your templates have the extension 
".jinja" (and not ".jinja2" or ".html") and are living in the templates 
directory (as specified in setup.py)? Are you sure there is no syntax 
error in the jinja template? In Jinja 2.7 errors are silently ignored by 
default, so it's recommended to set silent=false or use Jinja 2.8.


-- Chris

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


[tg-trunk] extract_messages for *.jinja does not work at all.

2016-10-13 Thread Mingcai SHEN
I'm using TG2.3.9 with Jinja2 templates, and when I run "setup.py 
extract_messages", it does not extract any strings from jinja files inside 
{% trans %} block or {{ gettext('') }} etc...

the setup.py was configure as :

message_extractors={'fortress': [
('**.py', 'python', None),
('templates/**.xhtml', 'kajiki', None),
('templates/**.jinja', 'jinja2', None),
('public/**', 'ignore', None)
]},


Does anyone has any idea?

Thanks.

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