Opened 14 years ago

Closed 14 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: no UI/UX: no

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

Change History (3)

comment:1 by theFm.cn@…, 14 years ago

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?

in reply to:  1 comment:2 by Ramiro Morales, 14 years ago

Component: FormsTranslations

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 by Claude Paroz, 14 years ago

Resolution: invalid
Status: newclosed

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/).

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