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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:40:50+00:00 2026-05-22T23:40:50+00:00

I am having troubles using the translation great functionnality of Django when using ChoicesField

  • 0

I am having troubles using the translation great functionnality of Django when using ChoicesField in a form.

I use a form such as this one :

from django.utils.translation import ugettext as _

class MyForm(forms.Form):
COUNTRIES = (
    ('france', _('France')),
    ('italy', _('Italy')),
    ('sweden', _('Sweden')),
)

country = forms.ChoiceField(choices=COUNTRIES)

Rendered through a view in a template such a this
…

{% trans “Country” %}: {{ form.country }}

…

And my issues are related to accent such as in this example when translated in France :

<label>Contrée </label>
<select name="country" id="id_country">
<option value="france">France</option>
<option value="italy">Italie</option>
<option value="sweden">Su&egrave;de</option>
</select>

The accent in Sweden (“Suè”) is incorrectly displayed (with no interpretation of the HTML code) whereas the one in Country (“Contrée”) is displayed as expected in the browser.

To complete this, my django.po file for French is as such

...
#: templates/1.html:106
msgid "Country"
msgstr "Contr&eacute;e"

#: templates/1.html:106 myApps/forms.py:19
msgid "Sweden"
msgstr "Su&egrave;de"
...

It is as if the HTML code for accent was not interpreted when included in the {{ form.country }} tag.

Any ideas on what i am doing wrong ?
Thanks in advance.

  • 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-22T23:40:50+00:00Added an answer on May 22, 2026 at 11:40 pm

    I finally solved the issue. I was not using correctly my django.po translation file.

    Instead of using HTML code for each accented character, they had to be left normale (ie : é, è, à…) and django would depending on the destination, translate those accents accordingly.

    Here is my header for french translation:

    msgid ""
    msgstr ""
    "Project-Id-Version: PACKAGE VERSION\n"
    "Report-Msgid-Bugs-To: \n"
    "POT-Creation-Date: 2011-06-06 17:17+0200\n"
    "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    "Last-Translator: ****** <****@*****.com>\n"
    "Language-Team: FR <***@*********.com>\n"
    "MIME-Version: 1.0\n"
    "Content-Type: text/plain; charset=UTF-8\n"
    "Content-Transfer-Encoding: 8bit\n"
    "Language: Français\n"
    "Plural-Forms: nplurals=2; plural=n>1;\n"
    

    Hope this can help some of you.
    Regards,

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

Sidebar

Related Questions

I'm having troubles on an ASPX form using two ASP default components; The default
I am having troubles generating a simple database form model. I am using: Doctrine
I'm having troubles using Blend with my visual studio solution. In Runtime, and compile
I'm having some troubles using Session Variables as they are being used as Reference
I am having trouble using EnumSet on the client side. I get this runtime
I'm having troubles using WinMenuSelectItem to select a menu option when I have to
im having troubles with parsing a feed and getting the time. i am using
I'm using jQuery Tools Scrollable with this setup . I'm having trouble changing the
I'm having troubles opening a Unicode file in C++ using fstreams instead of the
I'm having troubles centering my HTML form submit buttons in CSS. Right now I'm

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.