Re: [Django] #34221: Plural-Forms in .po files break Django's translation precedence.

2023-02-10 Thread Django
#34221: Plural-Forms in .po files break Django's translation precedence.
-+-
 Reporter:  Stefano Parmesan |Owner:
 |  rajdesai24
 Type:  Bug  |   Status:  assigned
Component:   |  Version:  4.1
  Internationalization   |
 Severity:  Normal   |   Resolution:
 Keywords:  i18n | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by rajdesai24):

 will figure out what can we add to the current patch

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701863ce1e8b8-2da3452d-894b-490b-af75-1a8e54236103-00%40eu-central-1.amazonses.com.


Re: [Django] #34221: Plural-Forms in .po files break Django's translation precedence.

2023-02-10 Thread Django
#34221: Plural-Forms in .po files break Django's translation precedence.
-+-
 Reporter:  Stefano Parmesan |Owner:
 |  rajdesai24
 Type:  Bug  |   Status:  assigned
Component:   |  Version:  4.1
  Internationalization   |
 Severity:  Normal   |   Resolution:
 Keywords:  i18n | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by rajdesai24):

 hey Claude, I tested the patch with the test project that Stefano has
 provided but it did not work.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701863cdb2623-a8a33cf0-caba-4a5c-8ffa-d8a2051512a2-00%40eu-central-1.amazonses.com.


Re: [Django] #34221: Plural-Forms in .po files break Django's translation precedence.

2023-01-28 Thread Django
#34221: Plural-Forms in .po files break Django's translation precedence.
-+-
 Reporter:  Stefano Parmesan |Owner:
 |  rajdesai24
 Type:  Bug  |   Status:  assigned
Component:   |  Version:  4.1
  Internationalization   |
 Severity:  Normal   |   Resolution:
 Keywords:  i18n | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by rajdesai24):

 * owner:  nobody => rajdesai24
 * status:  new => assigned


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070185f99d1055-75ba848f-b03b-4f90-9d99-013cc12dc4c8-00%40eu-central-1.amazonses.com.


Re: [Django] #34221: Plural-Forms in .po files break Django's translation precedence.

2022-12-27 Thread Django
#34221: Plural-Forms in .po files break Django's translation precedence.
--+
 Reporter:  Stefano Parmesan  |Owner:  nobody
 Type:  Bug   |   Status:  new
Component:  Internationalization  |  Version:  4.1
 Severity:  Normal|   Resolution:
 Keywords:  i18n  | Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Bhuvnesh):

 Hi, I'm stuck at writing test for this one, how do i include dependency in
 the test?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070185535e8681-85135f0d-6d48-4e2c-a25c-e1f613cc62e3-00%40eu-central-1.amazonses.com.


Re: [Django] #34221: Plural-Forms in .po files break Django's translation precedence.

2022-12-21 Thread Django
#34221: Plural-Forms in .po files break Django's translation precedence.
--+
 Reporter:  Stefano Parmesan  |Owner:  nobody
 Type:  Bug   |   Status:  new
Component:  Internationalization  |  Version:  4.1
 Severity:  Normal|   Resolution:
 Keywords:  i18n  | Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by Claude Paroz):

 * stage:  Unreviewed => Accepted


Comment:

 Thanks for the detailed report and test project!

 To solve #30439 and allow for different plural forms for a same language,
 we had to refrain from merging all translations in a unique catalog, as
 was done before. However, your setup demonstrates that the algorithm to
 decide between merge or separating catalogs is flawed (the third catalog
 from LOCALE_PATH having the same plural forms as the Django one, it is
 merge with it, hence loosing it's priority over the intermediary django-
 extension catalog).

 The following patch should fix the issue:
 {{{
 diff --git a/django/utils/translation/trans_real.py
 b/django/utils/translation/trans_real.py
 index c1e64d4ebd..f4d05b8f76 100644
 --- a/django/utils/translation/trans_real.py
 +++ b/django/utils/translation/trans_real.py
 @@ -96,11 +96,9 @@ class TranslationCatalog:
  yield from cat.keys()

  def update(self, trans):
 -# Merge if plural function is the same, else prepend.
 -for cat, plural in zip(self._catalogs, self._plurals):
 -if trans.plural.__code__ == plural.__code__:
 -cat.update(trans._catalog)
 -break
 +# Merge if plural function is the same as the top catalog, else
 prepend.
 +if trans.plural.__code__ == self._plurals[0]:
 +self._catalogs[0].update(trans._catalog)
  else:
  self._catalogs.insert(0, trans._catalog.copy())
  self._plurals.insert(0, trans.plural)
 }}}

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070185363fabc7-2312c96f-b0a6-4726-b325-42819db5af9b-00%40eu-central-1.amazonses.com.


Re: [Django] #34221: Plural-Forms in .po files break Django's translation precedence.

2022-12-21 Thread Django
#34221: Plural-Forms in .po files break Django's translation precedence.
-+-
 Reporter:  Stefano Parmesan |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:   |  Version:  4.1
  Internationalization   |
 Severity:  Normal   |   Resolution:
 Keywords:  i18n | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * cc: Claude Paroz (added)


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018533d5e580-8c7ed340-e353-42fc-b598-be9502889267-00%40eu-central-1.amazonses.com.


[Django] #34221: Plural-Forms in .po files break Django's translation precedence.

2022-12-21 Thread Django
#34221: Plural-Forms in .po files break Django's translation precedence.
+
   Reporter:  Stefano Parmesan  |  Owner:  nobody
   Type:  Bug   | Status:  new
  Component:  Internationalization  |Version:  4.1
   Severity:  Normal|   Keywords:  i18n
   Triage Stage:  Unreviewed|  Has patch:  0
Needs documentation:  0 |Needs tests:  0
Patch needs improvement:  0 |  Easy pickings:  0
  UI/UX:  0 |
+
 According to the
 [https://docs.djangoproject.com/en/4.1/topics/i18n/translation/#how-
 django-discovers-translations| documentation], Django reads translations
 from `LOCALE_PATHS` first, then from apps in `INSTALLED_APPS`, and then
 from its own folders.

 This behaviour breaks if the files in `LOCALE_PATHS` contain `Plural-
 Forms` while those found in `INSTALLED_APPS` don't.

 To test this behaviour I created a test project on github here:

 https://github.com/armisael/test-django-i18n-preference

 The project contains a .po file with `Plural-Forms` and a single
 translation that is also included in one of the dependencies. A single
 test checks which translation is picked.

 With the current configuration, the test fails by using the dependency
 translation. It passes if:
 1) the dependency is removed from `INSTALLED_APPS`; or if
 2) `Plural-Forms` is removed from the .po file.

 1) proves that i18n is correctly configured, and that the dependency
 translation is picked over the project one; 2) proves that `Plural-Forms`
 is involved in the bug.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018533cafaed-9a3640f5-8781-46f0-8c78-ad6232a94561-00%40eu-central-1.amazonses.com.