I feel bad for asking this as it was asked so many times:
django - how to make translation work?
django internationalization and translations issue
How to setup up Django translation in the correct way?
http://askbot.org/en/question/8948/weve-edited-djangopo-files-but-translations-do-not-work-why/
I want to have English (default) and Slovenian languages. My settings are like this:
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
)
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'Europe/Belgrade'
USE_I18N = True
USE_L10N = True
USE_TZ = True
from django.utils.translation import ugettext_lazy as _
LANGUAGES = (
('si', _('Slovenian')),
('en-us', _('English')),
)
LOCALE_PATHS = (
os.path.join(BASE_DIR, 'locale'),
)
Urls.py:
urlpatterns = i18n_patterns('',
url(r'^', include('analytics.urls')),
url(r'^login', RedirectView.as_view(url='/admin/login', permanent=False)),
url(r'^admin/', include(admin.site.urls)),
)
Templates:
<div class="time_range">{% trans "Time range:" %}</div>
I compiled messages to .po file and now according to the documentation one would expect this to start working. But no luck for me. If I visit the url with /si/ prefix I still see the english strings.