Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8683293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:00:10+00:00 2026-06-12T22:00:10+00:00

Ok I have been searching like crazy for this I think simple problem. I

  • 0

Ok I have been searching like crazy for this I think simple problem.

I use Django 1.4

The problem is that django won’t translate a simple {% trans “work” %} in my template.

This is what I have done:

Settings.py:

LANGUAGE_CODE = 'en-us'
USE_I18N = True
MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.locale.LocaleMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    # Uncomment the next line for simple clickjacking protection:
    # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
TEMPLATE_CONTEXT_PROCESSORS = (
    "django.contrib.auth.context_processors.auth",
    "django.core.context_processors.debug",
    "django.core.context_processors.i18n",
    "django.core.context_processors.media",
    "django.core.context_processors.static",
    "django.core.context_processors.request",
)

LOCALE_PATHS = (
    '/home/m00p/PycharmProjects/astrid/locale'
)

this is my map structure:

/
myproject/
apps/
locale/
template/

So I runned

django-admin.py makemessages -l nl -i settings.py

and it did succesfully created in the locale folder nl/LC_MESSAGES/django.po, I then edit the translation It found in the django.po

#: templates/base.html:22
msgid "work"
msgstr "ddddddddddddd"

I then run the compile command

django-admin.py compilemessages

and it also succesfully created a django.mo file in the correct folder

I added this also in the myproject/urls.py

urlpatterns = patterns('',
    url(r'^i18n/', include('django.conf.urls.i18n')),
)

urlpatterns += i18n_patterns('',
    url(r'^$', 'front.views.home', name='home'),
)

I added this in the base.html file to be able to change the language

<form action="/i18n/setlang/" method="post">
    {% csrf_token %}
    <input name="next" type="hidden" value="/" />
    <select name="language">
        {% get_language_info_list for LANGUAGES as languages %}
        {% for language in languages %}
            <option value="{{ language.code }}">{{ language.name_local }} ({{ language.code }})</option>
        {% endfor %}
    </select>
    <input type="submit" value="Go" />
</form>

So when I go to the website I get 127.0.0.1:8000/en/ in the url, this is correct because englisch is the default language, when I then change it with the form to NL, It redirects to 127.0.0.1:8000/nl/ but the text I translated didn’t change. I’m also sure that the language is NL because when I display {{ LANGUAGE_CODE }} it says NL.

Anybody know why it doesn’t change?

Thanks m00p

PROBLEM SOLVED

During the process when I was adding things I forgot for it to work, I restarted my deployment server, but I didn’t cleared the cache of my browser it was still using the old pages, so when I cleared my browser data in Chrome and revisited the page and changed the language it translated it correctly. Thanks for the suggestions anyway!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T22:00:12+00:00Added an answer on June 12, 2026 at 10:00 pm

    In Django 1.4 the locale directory at project root is not longer supported. You should add it to LOCALE_PATHS setting, which is empty by default. Django Settings.

    However the management commands involved in locale generation, seems to work, so I don’t know if you already did it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been searching and this problem seems simple but cannot find answer. I
I have been searching since a week for that is there any library like
I have been searching around and it looks like this question has been asked
I’ve been searching Google and Stack Overflow like crazy for days and have yet
hello i have been searching for some php code that is something like element.innerHTML
I have been searching for this all over the internet, this site claims that
I have been searching for the solution to this problem for a while and
I have been searching for a command that will return files from the current
I have been searching for a solution to this and so far found nothing
Any help on existing tab control like Chrome tabs? I have been searching all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.