I am changing the language runtime and updating it in the session variable.
I needed to call a function which will run before each method call as the language must be activated for each request. For this, I've written a middleware where in the "process_request" and the "process_response" functions, I am reading the language from session and activating it.
It is working properly in the html files (i.e. inside templates) but the text coming from the *.py files are not getting updated immediately. Not even after restarting the server or even after deleting the *.pyc files.
If I don't perform any activity in the site for 20-30 seconds then after reloading the language got updated for *.py file's text also.