Re: How to fix "plural forms expression could be dangerous"

2017-05-21 Thread Martin Brochhaus
Thanks for the reply, Tom.

Inserting those values does indeed make the error go away, but I am still 
left with the issue that on each deployment, when I run `./manage.py 
makemessages`, it overwrites that line with the faulty one and my site is 
left in a broken state.

Anyone knows how to prevent this line from being overwritten all the time?

On Thursday, May 18, 2017 at 7:22:04 PM UTC+8, Tom Evans wrote:
>
> You need to change INTEGER and EXPRESSION for the correct values. I 
> believe for zh you want "nplurals=1; plural=0;" 
>
> Cheers 
>
> Tom 
>
> On Thu, May 18, 2017 at 7:41 AM, Martin Brochhaus 
>  wrote: 
> > Hi everyone, 
> > 
> > in my project, I am generating my .po files like this: 
> > 
> > python manage.py makemessages --ignore=node_modules/* 
> --ignore=*migrations/* 
> > --ignore=*tests/* --ignore=__init__.py --ignore=submodules/* 
> > --ignore=fabfile* -l zh_CN 
> > 
> > Usually this results in the following line being added to my `django.po` 
> > file: 
> > 
> > "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" 
> > 
> > When this line is in the file and when I switch the language to Chinese, 
> I 
> > will get this error: 
> > 
> > ValueError at /zh-cn/ 
> > plural forms expression could be dangerous 
> > 
> > When I delete that line and run `./manage.py compilemessages`, 
> everything 
> > seems to work fine, but this is obviously can't be a good solution and 
> would 
> > mess up my deployment workflow quite a bit. 
> > 
> > So my question is: Why does this line pop up in my .po file? What if I 
> > change that expression to something valid, would it be overwritten with 
> that 
> > same faulty expression again when I run makemessages? What would a 
> correct 
> > expression look like for Chinese? 
> > 
> > Best regards, 
> > Martin 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Django users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to django-users...@googlegroups.com . 
> > To post to this group, send email to django...@googlegroups.com 
> . 
> > Visit this group at https://groups.google.com/group/django-users. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/django-users/5db9fbc1-9f59-4947-a214-0af82c8c4458%40googlegroups.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/da9576dd-88d4-42be-af30-b52c6eee181c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to fix "plural forms expression could be dangerous"

2017-05-18 Thread 'Tom Evans' via Django users
You need to change INTEGER and EXPRESSION for the correct values. I
believe for zh you want "nplurals=1; plural=0;"

Cheers

Tom

On Thu, May 18, 2017 at 7:41 AM, Martin Brochhaus
 wrote:
> Hi everyone,
>
> in my project, I am generating my .po files like this:
>
> python manage.py makemessages --ignore=node_modules/* --ignore=*migrations/*
> --ignore=*tests/* --ignore=__init__.py --ignore=submodules/*
> --ignore=fabfile* -l zh_CN
>
> Usually this results in the following line being added to my `django.po`
> file:
>
> "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
>
> When this line is in the file and when I switch the language to Chinese, I
> will get this error:
>
> ValueError at /zh-cn/
> plural forms expression could be dangerous
>
> When I delete that line and run `./manage.py compilemessages`, everything
> seems to work fine, but this is obviously can't be a good solution and would
> mess up my deployment workflow quite a bit.
>
> So my question is: Why does this line pop up in my .po file? What if I
> change that expression to something valid, would it be overwritten with that
> same faulty expression again when I run makemessages? What would a correct
> expression look like for Chinese?
>
> Best regards,
> Martin
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5db9fbc1-9f59-4947-a214-0af82c8c4458%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1K1tFqLUozgn%3DjZxdFF18WDJGYB2-rxra_-m2%2BvxKj3gw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


How to fix "plural forms expression could be dangerous"

2017-05-18 Thread Martin Brochhaus
Hi everyone,

in my project, I am generating my .po files like this:

python manage.py makemessages --ignore=node_modules/* 
--ignore=*migrations/* --ignore=*tests/* --ignore=__init__.py 
--ignore=submodules/* --ignore=fabfile* -l zh_CN

Usually this results in the following line being added to my `django.po` 
file:

"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"

When this line is in the file and when I switch the language to Chinese, I 
will get this error:

ValueError at /zh-cn/
plural forms expression could be dangerous

When I delete that line and run `./manage.py compilemessages`, everything 
seems to work fine, but this is obviously can't be a good solution and 
would mess up my deployment workflow quite a bit.

So my question is: Why does this line pop up in my .po file? What if I 
change that expression to something valid, would it be overwritten with 
that same faulty expression again when I run makemessages? What would a 
correct expression look like for Chinese?

Best regards,
Martin

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5db9fbc1-9f59-4947-a214-0af82c8c4458%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.