The django.catalogue does not have any translated strings, but the djangojs.mo file does

After successfully translating a javascript file named djangojs.po within my django project, I executed the following command:

./manage.py compilemessages -l fr #this correctly generates my djangojs.mo file

Next, I made edits to my urls.py file:

js_info_dict = {
    'domain': 'djangojs',
    'packages': ('my_app',),
}
#added to urlpatterns = patterns('',
...
url(r'^jsi18n/', 'django.views.i18n.javascript_catalog', js_info_dict),

Upon visiting http://localhost:8000/jsi18n/ in my browser, I received a javascript file, but the django.catalogue appeared empty.

django.catalog = django.catalog || {};

This left me wondering, where did my translated strings disappear to?

For your information, translation functions properly on my template code with the presence of a django.mo file located in the same directory as djangojs.mo. The Django version being used is 1.9.6.

Answer №1

This answer is a testament to my lack of knowledge. Perhaps it can benefit someone else.

It turns out that not being logged into the system with session authentication enabled caused issues. Surprisingly, the /jsi18n/ URL did not have a @login_required restriction, but it only fetched data from the django.mo file after logging in.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

When a link is clicked, submit a form and send it to several email addresses simultaneously

My form has been styled using the uniform jQuery plugin. Instead of using an input type submit for submitting the form, I have utilized a link and added some effects to it to prevent it from being formatted with uniform. <form> <ul> ...

Organize a JavaScript object into a hierarchical child-parent structure

Currently, I'm dealing with a challenging problem that is really testing my brain: I need to manipulate a JSON file containing a one-depth array of data objects. The structure looks something like this: [ {"id":1, "name":"Sport", "parent_id":0, "chil ...

Retrieving data from an array using an AJAX request function

I've been attempting to utilize an AJAX call to update a series of image elements on a webpage. The array containing the elements to update is populated with URLs fetched from a PHP page via AJAX. The issue I'm encountering with the code provide ...

The Django CMS placeholder is not showing up in the structure view

After my colleague developed a Django plugin for our project, I noticed that the placeholder I added to the HTML template was not showing up in the structure view. Only static placeholders were visible and editable. I followed the Django tutorial on placeh ...

What is the best way to retrieve data from a database, display it in an editable table, and then export

After searching diligently, I have been unable to find a table or data grid that is editable and capable of retrieving data from a MySQL database. My attempts with Slickgrid proved challenging due to the lack of documentation and complexity in making it op ...

Does the browser secretly increase the field in the response in REST/JSON?

I'm developing a JavaScript application utilizing REST resources from a server built with Spring Boot/REST/JPA. The application is mostly fetching lists of entities or single entities, like so: .../rest/tasks?page=0 .../rest/tasks/1234567 The struc ...

The requested URL /api/users/register does not exist. Error 404

While creating a money manager application utilizing the MERN Stack, I encountered an issue with posting data to the database. Whenever I click on the register button, an error is thrown stating that it Cannot POST /api/users/register. Despite setting up a ...

JavaScript function to display the anchor tag's title attribute in a modal when clicked

I am curious if you can assist me in finding the right path here. I have a PHP code that I would like to use onclick on dynamically created links to show the link's title in a modal window with a close option, similar to a tooltip. I prefer not to use ...

There appears to be some lingering content in the JQuery Mobile slide-out dialog box

My jQuery mobile slide out dialog box is experiencing an issue. The first time the slide out occurs, a comment box appears where users can enter comments and then submit them, followed by a "THANK YOU" message. However, when the user closes the dialog box ...

How to Implement Recursive Function Calls in JavaScript?

My goal is to create an interactive function using HTML and jQuery. I am utilizing jQuery to update and change attributes and text for a more seamless experience without page reloads, especially since it's not image-heavy. I have structured "scenes" ...

Issue encountered: Unable to properly increment the value in Ajax/PHP more than once

I am currently in the process of creating a basic voting system, and as a test run I have set up a div with a PHP variable that should increase by 1 each time a button is clicked. The current setup works fine for one click, but fails to continue incrementi ...

What is the best technique for creating a preloader that can seamlessly fill the background of a vector image?

I am looking for guidance on creating a CSS3 preloader using a vector image. My goal is to have the logo start off transparent with only the border visible, and as the loading occurs, fill in from bottom to top with the background color. Thank you to ever ...

Issue with JavaScript functionality after relocation to an external .js file

Initially, I had a JavaScript code in my HTML page. However, I decided to move the script to an external JavaScript file named jful.js. <script type="text/javascript> $(function() { // Determine the initial top offset of the navigation bar ...

Utilize jQuery to hide and then show elements based on text input

Recently, I came across a useful jQuery filter example that sparked my interest. To test it out, I created my live example and shared the code on CodePen (or you can check out the Fiddle if you prefer). One issue I encountered was that after entering text ...

Contrasting outcomes when conducting various nested searches within .filter and .exclude

What sets apart having multiple nested lookups within queryset.filter compared to queryset.exclude? Consider car ratings. Users can assign ratings of various types to any car. class Car(Model): ... class Rating(Model): type = ForeignKey('Rat ...

Passport.js `isAuthenticated()` function displaying erratic behavior: returning false instead of true in some cases

Utilizing Passport for enabling user logins via Google with session storage in Postgres. Everything seems configured correctly, but isAuthenticated() is returning inconsistent values. The inconsistency arises in the success callback after authentication. ...

Expanding Headers with JavaScript

Looking to add a Stretchy Header Functionality similar to the one shown in this GIF: Currently, on iPhones WebView, my approach involves calling a Scope Function On Scroll (especially focusing on Rubberband Scrolling) and adjusting the Image Height with C ...

Transmit the value of radio button data to PHP using Ajax

I'm facing an issue in sending radio button data to PHP using JavaScript. For example, when the radio button "Mother" is selected, the value "Mother" should be sent via AJAX. However, I'm struggling to achieve this functionality and haven't ...

Javascript downloadable content available for download

<div class="center"data-role="content" id="content" > <a href="#flappy" data-transition="slide" >Avoid Becoming a Terrorist</a> </div> <div id="flappy" > <center> <div id="page"> ...

Angular state correctly maps to the controller but is not reflected in the HTML

I'm currently in the process of setting up a basic Angular application, something I've done many times before. I have defined a home state and another state for a note-taking app, but I am facing an issue where neither state is displaying or inje ...