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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:17:46+00:00 2026-05-26T12:17:46+00:00

When localising Django application the makemessages command simply parses all the TXT, HTML and

  • 0

When localising Django application the makemessages command simply parses all the TXT, HTML and PY files and generates PO files for them but when localising JS files, you need to run the djangojs command. I haven’t delved into the Django source to figure out why this done differently. Could someone explain?

I’ve read that in production environments, Apache is used to serve the application files while a simple proxy like Nginx is used to serve static files as this greatly reduces the load on the application server. With this scenario, I guess it works like this: when rendering a template, Django checks the requested locale, loads the appropriate localisation file and serves the template but JS on the other hand being served as static media doesn’t get parsed by Django. Is this it?

(Its my first foray in to the world of localisation with Django and I’m packed full of question, many of who’s answers I can’t seem to find and therefore this post.)

Thanks

  • 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-05-26T12:17:46+00:00Added an answer on May 26, 2026 at 12:17 pm

    The reason why it’s handled differently is in the docs.

    Adding translations to JavaScript poses some problems:

    • JavaScript code doesn’t have access to a gettext implementation.
    • JavaScript code doesn’t have access to .po or .mo files; they need to be delivered by the server.
    • The translation catalogs for JavaScript should be kept as small as possible.

    So essentially, the internal Python translation is done on the server. But for JS, there’s another file served by the server, which contains all the required translations for user’s language. And the translation is done on the user’s side. So as you can see, it’s a completely different strategy. Django helps by adding similar interface for JS files, even though they’re handled in a completely different way.

    I guess it works like this: when rendering a template, Django checks
    the requested locale, loads the appropriate localisation file and
    serves the template but JS on the other hand being served as static
    media doesn’t get parsed by Django. Is this it?

    You are right in the first part, about handling templates. Handling JS works as I’ve explained above.

    Note that Django JS translation mechanism, doesn’t treat JS translations as static files. It uses a Django view to generate the JS file everytime (javascript_catalog mentioned in the docs linked in the first line).
    That is one of the problems I’ve encountered. Such files don’t need to be generated on every request. There are some projects that actually let you pack those JS translations as static files and enable you to cache them properly (like django-mediagenerator).

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

Sidebar

Related Questions

We are localising the user-interface text for a web application that runs on Java
I want to use HttpContext.GetGlobalResourceObject for localizing strings in my application, but I am
I'm localising out current site and therefore aplying the JSF convertDatetime tag to all
I have an MVC 4 application that I'm localizing. All the built-in resourcing and
I'm currently localizing my Django app. All other translations work fine except percent-sign inside
I am localizing an app into German using Localizable.string. All well until I need
I have a number resx files as follows, Resources-es-ES.resx Resources-es.resx Resources.resx (english defaults) They
I have a small WPF application that I am working on localizing. I have
I am trying to put all of my strings into the resource file, something
Hey, i am currently working on a django app for my studies, and came

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.