#31570: Translations of one language in different territories can override each
other
-------------------------------------+-------------------------------------
     Reporter:  Shai Berger          |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:                       |                  Version:  2.2
  Internationalization               |
     Severity:  Release blocker      |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson):

 Hey Shai. Thanks for the report. 🤔


 > In the case we've run into, users in New Zealand (en-NZ) received
 translations for South Africa (en-ZA).
 > ...
 > I will try to come up with a test later.

 Yes, please. I'm struggling to see where the issue is.

 I'm wondering if
 
[https://github.com/claudep/django/blob/6b840e55a29791529cb08faa8836fa4f6168642b/django/utils/translation/trans_real.py#L92-L97
 the test for the equivalence of the plural forms] is robust enough:

 {{{
     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
        else:
            ...
 }}}

 Q: What guarantees that the `__code__` object of the
 
[https://github.com/python/cpython/blob/a63c61168588937c482435d0432c753de4844c46/Lib/gettext.py#L176
 generated plural functions] evaluates equal or not? (Current status: no
 idea: it's not as simple as pointer address, but I can't yet find the
 implementation so... )

 There are a number of cases in the existing tests where we enter the
 different plural forms `else`-block, beyond the test added for #30439, so
 maybe there is a subtle behaviour change here. I'd be very grateful for
 that test to be able to pin it down.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31570#comment:1>
Django <https://code.djangoproject.com/>
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.30be24d225f88276a421a41e9701637b%40djangoproject.com.

Reply via email to