Hello,
I'm building a multilingual site with django. Everything seemed to go
really slight: in the admin all the translation nicely include my
locale .po files, same goes for {% trans %} tags in templates. Only
one thing fails - manual language switch - I've followed really
carefully the docs about translation. The provided snippet for
accessing django.conf.urls.i18n seems to crash django, here is the
debug:
==========================================================
Environment:
Request Method: POST
Request URL: http://lingo.example.net/i18n/setlang/
Django Version: 1.1 pre-alpha
Python Version: 2.5.2
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.admin',
'django.contrib.sites',
'lingos.blog']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware')
Traceback:
File "//usr/lib/python2.5/site-packages/django/core/handlers/base.py"
in get_response
86. response = callback(request, *callback_args,
**callback_kwargs)
File "//usr/lib/python2.5/site-packages/django/views/i18n.py" in
set_language
27. if lang_code and check_for_language(lang_code):
File "//usr/lib/python2.5/site-packages/django/utils/translation/
__init__.py" in check_for_language
91. return real_check_for_language(lang_code)
File "//usr/lib/python2.5/site-packages/django/utils/translation/
trans_real.py" in check_for_language
335. if gettext_module.find('django', globalpath, [to_locale
(lang_code)]) is not None:
File "/usr/lib/python2.5/gettext.py" in find
437. for nelang in _expand_lang(lang):
File "/usr/lib/python2.5/gettext.py" in _expand_lang
132. locale = normalize(locale)
File "/usr/lib/python2.5/locale.py" in normalize
307. fullname = localename.translate(_ascii_lower_map)
Exception Type: TypeError at /i18n/setlang/
Exception Value: character mapping must return integer, None or
unicode
=======================================================
The debug information comes from a sample project that I made to test
if it will work with plain django. Unfortunately it crashes django :(
Django runs a lighttpd server and svn core of django (it crashed same
way when I ran it on v.1.0.
Here is the full archive with sample project code: (don't mind
the .vbk's - just hidden folders to gather vim related data):
http://post-kultura.nazwa.pl/dj.tgz
Maybe I'm doing something wrong or lack some kind of python package?
Is there an alternate approach to switching the language?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---