Opened 7 years ago

Closed 7 years ago

#27040 closed Bug (worksforme)

{%trans 'String' %} does not translate

Reported by: Peter Balazek Owned by: nobody
Component: Uncategorized Version: 1.8
Severity: Normal Keywords: translate
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I am using Django 1.8.13. In the project I developed, I also use translation.

Everything worked fine, until one select box item didn't want to translate. So I focused on it. When I refreshed the website, the translation appeared for a second, then the basic string returned. I tried to rename the translation string, recompiled messages for POEdit, tried everything from scratch. Nothing worked.

I added the same string to others - working - select boxes and it worked. Changing the select box id parameter from "base" to any other worked suddenly.

Code that is causing issues:

                                        <div class="medium-3 columns">
                                            <label for="base">{% trans 'Base' %}</label>
                                            <select id="base" name="base">
                                                <option value="">{% trans 'Any' %}</option>
                                                {% for base_id, name in select_bases %}
                                                    <option value="{{ base_id }}">{{ name }}</option>
                                                {% endfor %}
                                            </select>
                                        </div>

Removing "base" from select suddenly works:

                                        <div class="medium-3 columns">
                                            <label for="test12">{% trans 'Base' %}</label>
                                            <select id="test12" name="test12">
                                                <option value="">{% trans 'Any' %}</option>
                                                {% for base_id, name in select_bases %}
                                                    <option value="{{ base_id }}">{{ name }}</option>
                                                {% endfor %}
                                            </select>
                                        </div>

Change History (2)

comment:1 Changed 7 years ago by Peter Balazek

comment:2 Changed 7 years ago by Claude Paroz

Resolution: worksforme
Status: newclosed

When I refreshed the website, the translation appeared for a second, then the basic string returned

Looks like a client-side JS issue. I doubt that Django is at fault here, unless you can prove us the contrary.

Note: See TracTickets for help on using tickets.
Back to Top