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 8098457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:05:06+00:00 2026-06-05T22:05:06+00:00

I want to do localization in Django based on the country code / locale

  • 0

I want to do localization in Django based on the country code / locale set in users UserProfile instead of using whatever the browser/session/webserver thinks is the locale.

Is there a way to do this in django templates?

e.g how to change the behaviour of

{% load l10n %}
{{ value|time|localize }}

so that it formats the date based on what’s stored in the profile, not based on some request context?

  • 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-05T22:05:08+00:00Added an answer on June 5, 2026 at 10:05 pm

    Django provides LocaleMiddleware that does most of what you are after:

    Enables language selection based on data from the request. It
    customizes content for each user. See the internationalization
    documentation.

    The method it uses to guess the language is the same that is used by the translation machinery; that is it looks for a django_language variable in the session, if that exists and is a valid language, it will set that language for the request. See how django discovers language preference.

    Once you enable LocaleMiddleware and set django_language from the user’s profile at your login view everything should work.

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

Sidebar

Related Questions

I have no idea how to handle localization with JQuery. I want to set
I want to change the currency symbols in iPhone app based on user's localization.
I have lot of code in our solution like this: Localization.Current.GetString(abc.def.gih.klm); I want to
I have created the DateTimePicker control. Now i want to add localization Support with
In my winform app in VB.NET I want to use the localization option. But
want to know why String behaves like value type while using ==. String s1
I'm planning to release an international app so I want to provide localization for
Localization/Globalization is pretty easy in Visual Studio using RESX files. I just add a
I'm using Django to create a site that provides a separate web UI for
i use struts 1.3 and want to make localization. that's what I'm doing: in

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.