Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#24413 closed Bug (fixed)

Translations for language "en" missing

Reported by: Tomasz Kontusz Owned by: nobody
Component: Internationalization Version: 1.8alpha1
Severity: Release blocker Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

It seems translations for "en" are missing, which gives wrong results for LANGUAGE_CODE != 'en'.

I have LANGUAGE_CODE = 'pl', use the i18n/setlang/ view to set my current language to 'en', and visit a login page based on django.contrib.auth.forms.AuthenticationForm. Field labels are still in polish, but the strings the I've explicitly translated are in english. I expected the labels to use english versions, but looking here https://github.com/django/django/blob/master/django/contrib/auth/locale/en/LC_MESSAGES/django.po it looks like none of those are actually provided (so Django falls back to LANGUAGE_CODE).

Change History (7)

comment:1 by Baptiste Mispelon, 9 years ago

Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

Hi,

I think I can reproduce this locally but I haven't managed to build a failing test case yet.

Doing some manual bisecting, it seems that a5f6cbce07b5f3ab48d931e3fd1883c757fb9b45 introduced the regression.

I'm bumping to "Release blocker" since it's a regression from 1.7.

Thanks!

comment:2 by Baptiste Mispelon, 9 years ago

For reference, here's what I did to reproduce the issue:

1) Start a new project with djangoadmin startproject myproject
2) Change LANGUAGE_CODE = 'pl' in myproject/settings.py
3) Edit myproject/urls.py to contain the following:

from django.conf.urls import url
from django.http import HttpResponse
from django.utils import translation

def index(request):
    translation.activate('en')
    return HttpResponse(translation.ugettext('username'))

urlpatterns = [
    url(r'^$', index),
]

4) Start runserver and navigate to the root URL

When doing that, you'll see that the string 'username' remains translated to Polish (I believe that's the issue being reported here)

You'll note that using translation.activate('en-us') in the view makes the correct translation appear again.

comment:3 by Claude Paroz, 9 years ago

Has patch: set

comment:4 by Claude Paroz, 9 years ago

Component: UncategorizedInternationalization

comment:5 by Tim Graham, 9 years ago

Triage Stage: AcceptedReady for checkin

comment:6 by Claude Paroz <claude@…>, 9 years ago

Resolution: fixed
Status: newclosed

In 3cf1c02695481900cf6140f54beb48f0e7d88e19:

Fixed #24413 -- Prevented translation fallback for English

Thanks Tomasz Kontusz for the report, Baptiste Mispelon for
analysis and Tim Graham for the review.

comment:7 by Claude Paroz <claude@…>, 9 years ago

In c0df8d1be9890a7914c7942defbce636573a434e:

[1.8.x] Fixed #24413 -- Prevented translation fallback for English

Thanks Tomasz Kontusz for the report, Baptiste Mispelon for
analysis and Tim Graham for the review.
Backport of 3cf1c02695 from master.

Note: See TracTickets for help on using tickets.
Back to Top