[Django] #24073: Deactivate translations instead of forcing 'en-us' in management commands

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

[Django] #24073: Deactivate translations instead of forcing 'en-us' in management commands

Django
#24073: Deactivate translations instead of forcing 'en-us' in management commands
-------------------------------------+-------------------------------------
               Reporter:  claudep    |          Owner:  claudep
                   Type:             |         Status:  new
  Cleanup/optimization               |
              Component:  Core       |        Version:  master
  (Management commands)              |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 This has been mentioned in #16284, which aims to depart from defaulting to
 'en' for JS i18n.

 This ticket is concentrating on a similar move for management commands.

--
Ticket URL: <https://code.djangoproject.com/ticket/24073>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/050.78f0fb773004fb47af7d486a5be55b57%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #24073: Deactivate translations instead of forcing 'en-us' in management commands

Django
#24073: Deactivate translations instead of forcing 'en-us' in management commands
-------------------------------------+-------------------------------------
     Reporter:  claudep              |                    Owner:  claudep
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Core (Management     |                  Version:  master
  commands)                          |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by claudep):

 * has_patch:  0 => 1


Comment:

 https://github.com/django/django/pull/3838

--
Ticket URL: <https://code.djangoproject.com/ticket/24073#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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.e42ff613c3b8e4a7fac27b853955d846%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #24073: Deactivate translations instead of forcing 'en-us' in management commands

Django
In reply to this post by Django
#24073: Deactivate translations instead of forcing 'en-us' in management commands
-------------------------------------+-------------------------------------
     Reporter:  claudep              |                    Owner:  claudep
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Core (Management     |                  Version:  master
  commands)                          |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Ready for
                                     |  checkin
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by timgraham):

 * stage:  Unreviewed => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/24073#comment:2>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.5e532b77e982cce45054dc315e123af2%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #24073: Deactivate translations instead of forcing 'en-us' in management commands

Django
In reply to this post by Django
#24073: Deactivate translations instead of forcing 'en-us' in management commands
-------------------------------------+-------------------------------------
     Reporter:  claudep              |                    Owner:  claudep
         Type:                       |                   Status:  closed
  Cleanup/optimization               |
    Component:  Core (Management     |                  Version:  master
  commands)                          |
     Severity:  Normal               |               Resolution:  fixed
     Keywords:                       |             Triage Stage:  Ready for
                                     |  checkin
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz <claude@…>):

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


Comment:

 In [changeset:"f7c287fca9c9e6370cc88d1457d3ed9466703687"]:
 {{{
 #!CommitTicketReference repository=""
 revision="f7c287fca9c9e6370cc88d1457d3ed9466703687"
 Fixed #24073 -- Deactivated translations when leave_locale_alone is False

 Thanks Tim Graham and Markus Holtermann for the reviews.
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24073#comment:3>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.384ecc5ff7fcd0f6c79aded42da5ceee%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #24073: Deactivate translations instead of forcing 'en-us' in management commands

Django
In reply to this post by Django
#24073: Deactivate translations instead of forcing 'en-us' in management commands
-------------------------------------+-------------------------------------
     Reporter:  claudep              |                    Owner:  claudep
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Core (Management     |                  Version:  master
  commands)                          |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Ready for
                                     |  checkin
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by MarkusH):

 * status:  closed => new
 * has_patch:  1 => 0
 * resolution:  fixed =>


Comment:

 This causes a regression with lazy strings marked for lazy translation.

 If you check out https://github.com/MarkusH/django-ticket-
 triage/commit/54fddd35795f71fea34cf4a166a271f9277e3d19 and run migrate
 twice, the second time Django will complain that there are changes not
 reflected by the migrations.

 Some of
 [https://github.com/django/django/blob/master/django/core/management/commands/migrate.py#L201
 those changes] are `AlterField` operations:

 {{{#!python
 ipdb> changes['conference'][0].operations
 [<AlterField  field=<django.db.models.fields.CharField: name>,
 preserve_default=True, model_name='audiencelevel', name='name'>,
 <AlterField  field=<django.db.models.fields.CharField: name>,
 preserve_default=True, model_name='location', name='name'>, <AlterField
 field=<django.db.models.fields.CharField: name>, preserve_default=True,
 model_name='section', name='name'>, <AlterField
 field=<django.db.models.fields.CharField: name>, preserve_default=True,
 model_name='sessionkind', name='name'>, <AlterField
 field=<django.db.models.fields.CharField: name>, preserve_default=True,
 model_name='track', name='name'>]
 }}}

 Inspecting `generate_altered_fields()` in the migration autodetector yield

 {{{#!python
 >
 /home/markus/Coding/django/django/db/migrations/autodetector.py(853)generate_altered_fields()
     852                 import ipdb; ipdb.set_trace()  # TODO: debugger
 --> 853                 if (not isinstance(old_field,
 models.ManyToManyField) and
     854                         not isinstance(new_field,
 models.ManyToManyField)):

 ipdb> old_field_dec
 ('django.db.models.PositiveSmallIntegerField', [], {'verbose_name':
 'action flag'})
 ipdb> new_field_dec
 ('django.db.models.PositiveSmallIntegerField', [], {'verbose_name':
 <django.utils.functional.lazy.<locals>.__proxy__ object at
 0x7f044e1e58d0>})
 }}}

 `git bisect` pin-points the change to
 f7c287fca9c9e6370cc88d1457d3ed9466703687

--
Ticket URL: <https://code.djangoproject.com/ticket/24073#comment:4>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.80ac78aba20068d283c08d6a57976306%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #24073: Deactivate translations instead of forcing 'en-us' in management commands

Django
In reply to this post by Django
#24073: Deactivate translations instead of forcing 'en-us' in management commands
-------------------------------------+-------------------------------------
     Reporter:  claudep              |                    Owner:  claudep
         Type:                       |                   Status:  assigned
  Cleanup/optimization               |
    Component:  Core (Management     |                  Version:  master
  commands)                          |
     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):

 * status:  new => assigned
 * stage:  Ready for checkin => Accepted


Comment:

 At least I've understood what's happening. As `migrate` is calling another
 management command (`loaddata`), that last command is restoring the
 default language code at exit, hence canceling the `deactivate_all` call
 from the base command. And then of course, the autodetector is fooled by
 the translated `verbose_name`.

 Semantically, I think that the root cause is `get_language` returning
 `settings.LANGUAGE_CODE` when translations are deactivated. I'll see if we
 can safely fix that.

--
Ticket URL: <https://code.djangoproject.com/ticket/24073#comment:5>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.0ac69795cf593e747c5f897628db69b3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #24073: Deactivate translations instead of forcing 'en-us' in management commands

Django
In reply to this post by Django
#24073: Deactivate translations instead of forcing 'en-us' in management commands
-------------------------------------+-------------------------------------
     Reporter:  claudep              |                    Owner:  claudep
         Type:                       |                   Status:  assigned
  Cleanup/optimization               |
    Component:  Core (Management     |                  Version:  master
  commands)                          |
     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):

 PR: https://github.com/django/django/pull/3856

--
Ticket URL: <https://code.djangoproject.com/ticket/24073#comment:6>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.1b1ac4e4ef5cd1db5827a98912bf1f33%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #24073: Deactivate translations instead of forcing 'en-us' in management commands

Django
In reply to this post by Django
#24073: Deactivate translations instead of forcing 'en-us' in management commands
-------------------------------------+-------------------------------------
     Reporter:  claudep              |                    Owner:  claudep
         Type:                       |                   Status:  assigned
  Cleanup/optimization               |
    Component:  Core (Management     |                  Version:  master
  commands)                          |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Ready for
                                     |  checkin
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by MarkusH):

 * has_patch:  0 => 1
 * stage:  Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/24073#comment:7>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.b0791877ddb75f9d300db9dffa16607f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #24073: Deactivate translations instead of forcing 'en-us' in management commands

Django
In reply to this post by Django
#24073: Deactivate translations instead of forcing 'en-us' in management commands
-------------------------------------+-------------------------------------
     Reporter:  claudep              |                    Owner:  claudep
         Type:                       |                   Status:  closed
  Cleanup/optimization               |
    Component:  Core (Management     |                  Version:  master
  commands)                          |
     Severity:  Normal               |               Resolution:  fixed
     Keywords:                       |             Triage Stage:  Ready for
                                     |  checkin
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz <claude@…>):

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


Comment:

 In [changeset:"543df07720181fe23737ba14f1a261ff6f37f49c"]:
 {{{
 #!CommitTicketReference repository=""
 revision="543df07720181fe23737ba14f1a261ff6f37f49c"
 Fixed #24073 -- Returned None for get_language when translations are
 deactivated

 This fixes a regression caused by f7c287fca9. Thanks Markus Holtermann
 for identifying the regression.
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24073#comment:8>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.fb352dedc971d46e31f7ade3a03cd903%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #24073: Deactivate translations instead of forcing 'en-us' in management commands

Django
In reply to this post by Django
#24073: Deactivate translations instead of forcing 'en-us' in management commands
-------------------------------------+-------------------------------------
     Reporter:  Claude Paroz         |                    Owner:  Claude
         Type:                       |  Paroz
  Cleanup/optimization               |                   Status:  closed
    Component:  Core (Management     |                  Version:  master
  commands)                          |
     Severity:  Normal               |               Resolution:  fixed
     Keywords:                       |             Triage Stage:  Ready for
                                     |  checkin
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

 In [changeset:"b9cec9fa1fc50207ab68a59853c851a945c5db5e" b9cec9fa]:
 {{{
 #!CommitTicketReference repository=""
 revision="b9cec9fa1fc50207ab68a59853c851a945c5db5e"
 Fixed #29017 -- Updated BaseCommand.leave_locale_alone doc per refs
 #24073.
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24073#comment:9>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.235e9fdc9fe5ef2e0a5a879a224731d5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #24073: Deactivate translations instead of forcing 'en-us' in management commands

Django
In reply to this post by Django
#24073: Deactivate translations instead of forcing 'en-us' in management commands
-------------------------------------+-------------------------------------
     Reporter:  Claude Paroz         |                    Owner:  Claude
         Type:                       |  Paroz
  Cleanup/optimization               |                   Status:  closed
    Component:  Core (Management     |                  Version:  master
  commands)                          |
     Severity:  Normal               |               Resolution:  fixed
     Keywords:                       |             Triage Stage:  Ready for
                                     |  checkin
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

 In [changeset:"3f951b1f94e50115824af404710a4b7c177cb03e" 3f951b1]:
 {{{
 #!CommitTicketReference repository=""
 revision="3f951b1f94e50115824af404710a4b7c177cb03e"
 [2.0.x] Fixed #29017 -- Updated BaseCommand.leave_locale_alone doc per
 refs #24073.

 Backport of b9cec9fa1fc50207ab68a59853c851a945c5db5e from master
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24073#comment:10>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.43e414ac3270420507db5a2449a835d5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #24073: Deactivate translations instead of forcing 'en-us' in management commands

Django
In reply to this post by Django
#24073: Deactivate translations instead of forcing 'en-us' in management commands
-------------------------------------+-------------------------------------
     Reporter:  Claude Paroz         |                    Owner:  Claude
         Type:                       |  Paroz
  Cleanup/optimization               |                   Status:  closed
    Component:  Core (Management     |                  Version:  master
  commands)                          |
     Severity:  Normal               |               Resolution:  fixed
     Keywords:                       |             Triage Stage:  Ready for
                                     |  checkin
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

 In [changeset:"ced0b1edef6743012c8e17d447b701006758c52e" ced0b1e]:
 {{{
 #!CommitTicketReference repository=""
 revision="ced0b1edef6743012c8e17d447b701006758c52e"
 [1.11.x] Fixed #29017 -- Updated BaseCommand.leave_locale_alone doc per
 refs #24073.

 Backport of b9cec9fa1fc50207ab68a59853c851a945c5db5e from master
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24073#comment:11>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.6ad7f027a64a8e2a42c46857c1417604%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.