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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:29:39+00:00 2026-06-12T15:29:39+00:00

Django in a browser session translates everything fine from one language to another according

  • 0

Django in a browser session translates everything fine from one language to another according to the users’ browser settings or the language they chose in their profile.
Now when sending a mail to a user (let’s say when another user leaves a comment on some content and Django automatically sends an email to the owner of the content to alert her) I don’t understand how Django knows what language to use since there is no session to look at. What is the correct way to handle that?

  • 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-12T15:29:40+00:00Added an answer on June 12, 2026 at 3:29 pm

    I was given the answer on the Django users Group by Tom Evans:
    the tool is

    from django.utils import translation
    

    then it can be used in this scenario:

    cur_language = translation.get_language()
    translation.activate(get_lang_for_user(user))
    # send email, tweet, etc
    translation.activate(cur_language)
    

    and the docs are here:
    https://docs.djangoproject.com/en/dev/topics/i18n/translation/#using-translations-outside-views-and-templates

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

Sidebar

Related Questions

I am writing forum app on Django using custom session/auth/users/acl system. One of goals
I know django picks up default language for website from browser headers first and
Django Endless Pagination works perfectly fine right until I use template inheritance. views.py: from
I have a couple of projects in Django and alternate between one and another
I have pisa producing .pdfs in django in the browser fine, but what if
When browser firstly request the server, the django will generate a session obj and
Django has a very handy test client /dummy web browser that one can use
According to Django documentation, if SESSION_EXPIRE_AT_BROWSER_CLOSE is set to True, Django will use browser-length
I am developing an Django application using the Django 1.3.1 release : https://code.djangoproject.com/browser/django/tags/releases/1.3.1 I
I'm creating a text-based browser game and need some advice for django model structure.

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.