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

The Archive Base Latest Questions

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

I successfully managed to get trans and blocktrans to translate text. However… I have

  • 0

I successfully managed to get trans and blocktrans to translate text.

However…

I have a function defined in utils.py that returns a dictionary containing strings of which some of them I need converted to the current language.
EDIT: *This is a utils.py that I’ve created in my project directory that are called by views to perform certain auxillary functions on a dict and then return the updated dict

I have done something like this:

    try:
     path = default_storage.save(customercode + '/' + file.name, ContentFile(file.read()))
     results['status'] = 'success'
     results['message'] = _(u'Your file has been successfully uploaded')        
    except Exception as e:
     results['status'] = 'error'
     results['message'] = _(u'There was an error uploading your file: ') + str(e)

return results

I have also added from django.utils.translation import ugettext_lazy as _ to the top of this utils.py file..

And this “results” dictionary is used in one of my views wherein the whole dictionary after some further processing is passed as a context variable to the template.

I have correctly set the translation in the .po file. All other template tags translate perfectly. Only the above mentioned strings do not translate.

Any help would be greatly appreciated.

UPDATE: I tried the same process in a forms filed label and it translated just fine. It’s only the aforementioned areas where it won’t translate!

PS: This is my first question on stackoverflow. I apologize in advance if I’ve made mistakes asking this question.

  • 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-05T13:38:54+00:00Added an answer on June 5, 2026 at 1:38 pm

    Just as I expected,

    I was making a very silly mistake. I accessed the incorrect variable in the template while trying to print the translated value! >_<

    But I guess one thing I’ve learnt is staying away from a problem and then coming back to it after a long time helps. You’ve got to learn the problem again and that sometimes helps you find silly bugs like these!

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

Sidebar

Related Questions

I have successfully managed to get System.Speech.Synthesis to read English text in arbitrary voices
I have been playing with Google C2DM, and managed to successfully get the push
Have anyone successfully managed to setup a combined Java/C++ project for Eclipse? What I
I'm building WP7 application using DropNet. I have successfully managed to log in and
I have managed to successfully deploy my Symfony2 application to a production web server,
I have successfully implemented interop beftween Win32 application and managed .Net dll as described
After much fiddling, I've managed to install the right ODBC driver and have successfully
hoping to get some help here. I have locations on a database that I
I have successfully created an email that sends on creation of a Kase, but
I have successfully managed to bind images stored in Isolated Storage to Image elements

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.