Code

Opened 4 years ago

Closed 4 years ago

#14637 closed (invalid)

There may an Internationalization bug in Forms

Reported by: theFm.cn@… Owned by: nobody
Component: Translations Version: 1.2
Severity: Keywords: Internationalization
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

set

LANGUAGE_CODE = 'zh-CN'

and

create a form

class RegisterForm(forms.Form):
    userName = forms.EmailField(max_length=80, label=u'电子邮箱');
    userPass1 = forms.CharField(widget=forms.PasswordInput, min_length=6, max_length=30, label=u'用户密码');
    userPass2 = forms.CharField(widget=forms.PasswordInput, min_length=6, max_length=30, label=u'确认密码');

when I type 3 word in userPass1

according to django.po in site-packages/django/conf/locale/zh_Cn/LC_MESSAGE/django.po

it should be

#: forms/fields.py:139
#, python-format
msgid "Ensure this value has at least %(min)d characters (it has %(length)d)."
msgstr "确保该值最少为 %(min)d  个字符(其长度为 %(length)d)。"

but I just got a English error msg instead of a Chinese one

Attachments (0)

Change History (3)

comment:1 follow-up: Changed 4 years ago by theFm.cn@…

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

I check the code

there is no

"Ensure this value has at least %(min)d characters (it has %(length)d)."

in forms/fields.py

may be in 1.2 we use in core/validators.py

class MinLengthValidator(BaseValidator):
    compare = lambda self, a, b: a < b
    clean   = lambda self, x: len(x)
    message = _(u'Ensure this value has at least %(limit_value)d characters (it has %(show_value)d).')
    code = 'min_length'

so maybe po file should be update?

comment:2 in reply to: ↑ 1 Changed 4 years ago by ramiro

  • Component changed from Forms to Translations

Replying to theFm.cn@gmail.com:

so maybe po file should be update?

So it seems:

django $ $ PYTHONPATH=.. bin/django-admin.py makemessages -l zh_CN
processing language zh_CN


django $ cd conf/locale/zh_CN/LC_MESSAGES/

$ msgfmt --check --statistics -o /dev/null django.po 
django.po:4: nplurals = 1...
django.po:842: ...but some messages have 2 plural forms
msgfmt: found 1 fatal error
945 translated messages, 75 fuzzy translations, 140 untranslated messages.

and it has other problems too.

Status of translation in trunk is similarly depressing:

$ msgfmt --check --statistics -o /dev/null django.po 
django.po:4: nplurals = 1...
django.po:838: ...but some messages have 2 plural forms
msgfmt: found 1 fatal error
941 translated messages, 87 fuzzy translations, 153 untranslated messages.

comment:3 Changed 4 years ago by claudep

  • Resolution set to invalid
  • Status changed from new to closed

I confirm this is due to the Chinese translation not being up-to-date. This is not a bug per se.

I encourage you to work on improving Chinese translation for Django (see also http://docs.djangoproject.com/en/1.2/topics/i18n/localization/).

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.