Edgewall Software

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#11921 closed defect (fixed)

"Default language" is selected on Localization preferences panel even when language has been set

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.1.4
Component: general Version:
Severity: normal Keywords: preferences
Cc: Branch:
Release Notes:

Fixed regression in [13323]: Default language was always selected even when a language had been set.

API Changes:
Internal Changes:

Description (last modified by Ryan J Ollos)

This is a regression from #11813 / [13323]. The Default language is always selected on the Localization preferences panel even when a language has been set. The following will fix the issue:

  • trac/prefs/templates/prefs_localization.html

    diff --git a/trac/prefs/templates/prefs_localization.html b/trac/prefs/templates/prefs_localization.html
    index 6d54749..43b0c8a 100644
    a b  
    2727      <tr class="field">
    2828        <th><label for="language">Language:</label></th>
    2929        <td>
    30           <select id="language" name="language" disabled="${'disabled' if not languages else None}"
     30          <select py:with="session_language = settings.session.get('language', '').replace('-', '_')"
     31                  id="language" name="language" disabled="${'disabled' if not languages else None}"
    3132                  title="${_('Translations are currently unavailable') if not languages else None}">
    3233            <option value="">Default language</option>
    3334            <option py:for="locale, language in languages"

Attachments (0)

Change History (4)

comment:1 by Ryan J Ollos, 8 years ago

Description: modified (diff)
Status: newassigned

comment:2 by Ryan J Ollos, 8 years ago

Resolution: fixed
Status: assignedclosed

Fixed in [13667].

comment:3 by Ryan J Ollos, 8 years ago

Test failure is:


FAIL: Test for regression of http://trac.edgewall.org/ticket/11515


Traceback (most recent call last):

File "/home/travis/build/edgewall/trac/trac/prefs/tests/functional.py", line 202, in runTest

% (second_locale_id, second_locale))

File "/home/travis/build/edgewall/trac/trac/tests/functional/better_twill.py", line 229, in better_find

(to_unicode(e), filename))

TwillAssertionError: no match to '<option selected="selected" value="zh_TW">\u4e2d\u6587 (\u7e41\u9ad4\u4e2d\u6587, \u53f0\u7063)</option>' at file:///home/travis/build/edgewall/trac/testenv/trac/log/RegressionTestTicket11515.html

I'm unsure how to interpolate the string to get

'<option selected="selected" value="zh_TW">中文 (台湾)</option>'

rather than

'<option selected="selected" value="zh_TW">\u4e2d\u6587 (\u7e41\u9ad4\u4e2d\u6587,\u53f0\u7063)</option>'

Calling print outputs characters rather than escape sequences:

>>> Locale.parse('zh_TW').display_name
u'\u4e2d\u6587 (\u53f0\u6e7e)'
>>> print Locale.parse('zh_TW').display_name
中文 (台湾)

comment:4 by Ryan J Ollos, 8 years ago

Fixed failing test in [13668] by removing test for the unicode characters.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.