I can not get my translation working. Structure:
* minicms - CMS project
* userproject - project using minicms
- minicms
|-plugins
||-contactform
|||-locale
|||-templatetags
|||-forms.py
* forms.py:
# -*- coding: utf-8 -*-
from django import forms
from django.utils.translation import ugettext_lazy as _
class ContactForm(forms.Form):
name = forms.CharField(
label=_("Your name"),
help_text=_("Your name will be displayed"),
max_length=100
)
...
* locale/sk/LC_MESSAGES/django.po:
...
#: forms.py:7
msgid "Your name"
msgstr "Vaše meno"
...
* compiled into django.mo
* userproject/settings.py:
LANGUAGE_CODE = 'sk'
LANGUAGES = (
('en', 'English'),
('sk', 'Slovensky'),
)
USE_I18N = True
USE_L10N = True
Displayed form is in english. I tried to copy locale directory to all
possible places (minicms, minicms/plugins, userproject, ...) but
everything is only in english :(
Thanks,
Martin
* locale/sk/LC_MESSAGES/django.po:
...
#: forms.py:7
msgid "Your name"
msgstr "Vaše meno"
...
* compiled into django.mo
* userproject/settings.py:
LANGUAGE_CODE = 'sk'
LANGUAGES = (
('en', 'English'),
('sk', 'Slovensky'),
)
USE_I18N = True
USE_L10N = True
Displayed form is in english. I tried to copy locale directory to all possible places (minicms, minicms/plugins, userproject, ...) but everything is only in english :(
Lachlan Simpson
Technology Manager
Translation and Interpreting Studies
Monash University, Clayton
Victoria 3800
* userproject/settings.py:
LANGUAGE_CODE = 'sk'
LANGUAGES = (
('en', 'English'),
('sk', 'Slovensky'),
)
USE_I18N = True
USE_L10N = True
MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.middleware.common.CommonMiddleware', )
Lachlan Simpson
Technology Manager
Translation and Interpreting Studies
Monash University, Clayton
Victoria 3800
> On Mon, Jul 26, 2010 at 11:16, Martin Tiršel <dja...@blackpage.eu> wrote:
>
>
> Gah, my eyes were closed.
>
> Have you also added the appropriate Middleware product?
>
> As you see here:
> http://docs.djangoproject.com/en/dev/topics/i18n/deployment/#topics-i18n-deployment
> you
> need to have soemthing like the following:
>
> MIDDLEWARE_CLASSES = (
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.locale.LocaleMiddleware',
> 'django.middleware.common.CommonMiddleware',)
>
>
> remember that order is important - that doc page has more info
Hi,
yes, I have correct middlewares installed.
I printed some debug informations into template and LANGUAGE_CODE was set
to 'sk' (at this point I sure had somewhere a bug, possibly not compiled
translation I accidentaly deleted), but when I checked it now, there was
'en'. LocaleMiddleware takes the language code first from session, then
cookie, THEN Accept-Language from HTTP and if it all fails, then from
settings. But my browsers are set to 'en' and that was the "problem".
So, if I want to specify only single language in settings.py, I have to
REMOVE 'django.middleware.locale.LocaleMiddleware' from middlewares, else
settings.LANGUAGE_CODE is ignored (AFAIK today every browser sends
Accept-Language).
Martin