Re: [Django] #21650: Usage example in i18n docs is bad advice for plurals

2013-12-27 Thread Django
#21650: Usage example in i18n docs is bad advice for plurals
--+
 Reporter:  nedbatchelder |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  closed
Component:  Documentation |  Version:  1.6
 Severity:  Normal|   Resolution:  fixed
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Tim Graham ):

 In [changeset:"3b79fbabcdfefa6c5734a9645be4ffee02e4a270"]:
 {{{
 #!CommitTicketReference repository=""
 revision="3b79fbabcdfefa6c5734a9645be4ffee02e4a270"
 [1.6.x] Fixed #21650 -- Corrected bad advice for plural translation.

 Thanks nedbatchelder and claudep.

 Backport of 85270ef3f5 from master
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.87d57c2f6226d944ac0283b7bbd10884%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21650: Usage example in i18n docs is bad advice for plurals

2013-12-27 Thread Django
#21650: Usage example in i18n docs is bad advice for plurals
--+
 Reporter:  nedbatchelder |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  closed
Component:  Documentation |  Version:  1.6
 Severity:  Normal|   Resolution:  fixed
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by Tim Graham ):

 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"85270ef3f5bf96b556e697bc5a46bf925ec4be21"]:
 {{{
 #!CommitTicketReference repository=""
 revision="85270ef3f5bf96b556e697bc5a46bf925ec4be21"
 Fixed #21650 -- Corrected bad advice for plural translation.

 Thanks nedbatchelder and claudep.
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.3d797df6fc997c2c8dfd60acc5964687%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21650: Usage example in i18n docs is bad advice for plurals

2013-12-27 Thread Django
#21650: Usage example in i18n docs is bad advice for plurals
--+
 Reporter:  nedbatchelder |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Documentation |  Version:  1.6
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by nedbatchelder):

 Looks great, thanks!

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.55a3f1bf0a26cbd1e5e9467a5d92ee37%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21650: Usage example in i18n docs is bad advice for plurals

2013-12-27 Thread Django
#21650: Usage example in i18n docs is bad advice for plurals
--+
 Reporter:  nedbatchelder |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Documentation |  Version:  1.6
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by claudep):

 Fine for me. Ned?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.1f485821627f8761c774525b32f2da53%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21650: Usage example in i18n docs is bad advice for plurals

2013-12-26 Thread Django
#21650: Usage example in i18n docs is bad advice for plurals
--+
 Reporter:  nedbatchelder |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Documentation |  Version:  1.6
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by claudep):

 Thanks, that looks good. However, I'd like to see somewhere the `%(name)s
 object`/`%(name)s objects` trick that Ned suggested. Even if it might
 produce suboptimal strings in English, it's often the only proper way to
 handle i18n in a right manner.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.c08e25b4eb80f1884b3d2bb34b842eee%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21650: Usage example in i18n docs is bad advice for plurals

2013-12-26 Thread Django
#21650: Usage example in i18n docs is bad advice for plurals
--+
 Reporter:  nedbatchelder |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Documentation |  Version:  1.6
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by timo):

 * has_patch:  0 => 1


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.5b82b3b1fb5181914fa1fcf7ac11605d%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21650: Usage example in i18n docs is bad advice for plurals

2013-12-26 Thread Django
#21650: Usage example in i18n docs is bad advice for plurals
--+
 Reporter:  nedbatchelder |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Documentation |  Version:  1.6
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by claudep):

 Sure, but you know I'm not the most skilled writer for English
 documentation. Feel free to go ahead.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.0ff4ca01e076a25b4112680b231974b9%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21650: Usage example in i18n docs is bad advice for plurals

2013-12-26 Thread Django
#21650: Usage example in i18n docs is bad advice for plurals
--+
 Reporter:  nedbatchelder |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Documentation |  Version:  1.6
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Old description:

> This example in the i18n docs:
>
> {{{
> Lets see a slightly more complex usage example::
>
> from django.utils.translation import ungettext
> from myapp.models import Report
>
> count = Report.objects.count()
> if count == 1:
> name = Report._meta.verbose_name
> else:
> name = Report._meta.verbose_name_plural
>
> text = ungettext(
> 'There is %(count)d %(name)s available.',
> 'There are %(count)d %(name)s available.',
> count
> ) % {
> 'count': count,
> 'name': name
> }
> }}}
>
> Here we choose between two forms of name (singular and plural) based on
> whether the count is 1 or not.  That is the rule in English, but not in
> other languages.  The whole point of ungettext is to defer the logic that
> performs the mapping from number to text, since it depends on the
> language.
>
> Unfortunately, I think the only solution is to use more stilted language:
>
> {{{
> text = ungettext(
> 'There is %(count)d %(name)s object available.',
> 'There are %(count)d %(name)s objects available.',
> count
> ) % {
> 'count': count,
> 'name': Report._meta.verbose_name,
> }
> }}}
>
> and ignore the verbose_name_plural altogether.

New description:

 [https://docs.djangoproject.com/en/dev/topics/i18n/translation/#pluralization
 This example in the i18n docs]:

 {{{
 Lets see a slightly more complex usage example::

 from django.utils.translation import ungettext
 from myapp.models import Report

 count = Report.objects.count()
 if count == 1:
 name = Report._meta.verbose_name
 else:
 name = Report._meta.verbose_name_plural

 text = ungettext(
 'There is %(count)d %(name)s available.',
 'There are %(count)d %(name)s available.',
 count
 ) % {
 'count': count,
 'name': name
 }
 }}}

 Here we choose between two forms of name (singular and plural) based on
 whether the count is 1 or not.  That is the rule in English, but not in
 other languages.  The whole point of ungettext is to defer the logic that
 performs the mapping from number to text, since it depends on the
 language.

 Unfortunately, I think the only solution is to use more stilted language:

 {{{
 text = ungettext(
 'There is %(count)d %(name)s object available.',
 'There are %(count)d %(name)s objects available.',
 count
 ) % {
 'count': count,
 'name': Report._meta.verbose_name,
 }
 }}}

 and ignore the verbose_name_plural altogether.

--

Comment (by timo):

 I don't use i18n, but Ned's suggest seems reasonable to me. Claude, what
 do you think? My only question would be what modifications to make to the
 note that follows. Currently it says, "When using this technique", and my
 understanding is that we'd be changing things to say not to use this
 technique. I think the note still has value though as it's linked to from
 elsewhere.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.55c395e8f0279d6eb61da19a392fb35b%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21650: Usage example in i18n docs is bad advice for plurals

2013-12-23 Thread Django
#21650: Usage example in i18n docs is bad advice for plurals
--+
 Reporter:  nedbatchelder |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Documentation |  Version:  1.6
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by nedbatchelder):

 My one counter to that might be:  Change this example to an explanation of
 why it isn't a good idea:

 {{{
 Note that pluralization is complicated, and works differently in other
 languages.
 Comparing count to 1 isn't always the correct rule.  This code looks
 sophisticated,
 but will produce the wrong results for other languages:

 

 Don't try to implement your own singular-or-plural logic, it won't be
 correct.
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.fb3a22d44dd0d8a954ec2b62a52a7faf%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21650: Usage example in i18n docs is bad advice for plurals

2013-12-23 Thread Django
#21650: Usage example in i18n docs is bad advice for plurals
--+
 Reporter:  nedbatchelder |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Documentation |  Version:  1.6
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by claudep):

 I suggest to simply remove that example in the docs, because if we remove
 the verbose_name/plural stuff in it, it doesn't bring anything new to the
 discussion compared to the previous example. Opinion?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.1e87996bfd5376fe5c49f6047a809153%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21650: Usage example in i18n docs is bad advice for plurals

2013-12-22 Thread Django
#21650: Usage example in i18n docs is bad advice for plurals
--+
 Reporter:  nedbatchelder |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Documentation |  Version:  1.6
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by nedbatchelder):

 Just to clarify: this ticket is merely about the example in the docs.
 While the issue in #11688 is true (models' support for singular and plural
 is English-centric and simplistic), all I'm pointing out here is that the
 i18n docs could at least not fall into the same trap and suggest a
 comparison to 1 as the correct way to support plurals.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.428cce737baa31ce77dc2899ae04f19b%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #21650: Usage example in i18n docs is bad advice for plurals

2013-12-22 Thread Django
#21650: Usage example in i18n docs is bad advice for plurals
--+
 Reporter:  nedbatchelder |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Documentation |  Version:  1.6
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by claudep):

 * needs_better_patch:   => 0
 * needs_docs:   => 0
 * type:  Uncategorized => Cleanup/optimization
 * needs_tests:   => 0
 * stage:  Unreviewed => Accepted


Comment:

 +1, the `count == 1` (and more generally the `verbose_name_plural`
 concept, see also #11688) is totally English-centered.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.ddd9622ae3c70eaaae7a2cb7361a49b2%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.