Edgewall Software

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#11250 closed defect (fixed)

malformed langauge tag in timeline rss if locale with no territory — at Version 4

Reported by: Jun Omae Owned by: Jun Omae
Priority: normal Milestone: 0.12.6
Component: timeline Version: 0.12-stable
Severity: minor Keywords: rss
Cc: Ryan J Ollos Branch:
Release Notes:

Fix malformed language tag in timeline rss if locale with no territory, e.g. de, ja.

API Changes:
Internal Changes:

Description

If locale with no territory, timeline rss has malformed langauge tag like this.

<?xml version="1.0"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>0.12-stable ††</title>
    <link>http://localhost/timeline</link>
    <description>Trac Timeline</description>
    <language>ja-None</language>
    <generator>Trac 0.12.5</generator>
    <image>
      <title>0.12-stable ††</title>
      <url>http://qova.net:3000/chrome/common/trac_banner.png</url>
      <link>http://qova.net:3000/timeline</link>
    </image>
    <item>
...
  • trac/timeline/templates/timeline.rss

    index 2836ac7..50897ca 100644
    a b  
    66    <title>${project.name}</title>
    77    <link>${abs_href.timeline()}</link>
    88    <description>Trac Timeline</description>
    9     <language>${req.locale and \
    10                 '%s-%s' % (req.locale.language, req.locale.territory) or \
    11                 'en-US'}</language>
     9    <language>${locale and str(locale).replace('_', '-') or 'en-US'}</language>
    1210    <generator>Trac ${trac.version}</generator>
    1311    <image py:if="chrome.logo.src_abs">
    1412      <title>${project.name}</title>

Change History (4)

comment:1 by Jun Omae, 11 years ago

Owner: set to Jun Omae
Status: newassigned

comment:2 by Ryan J Ollos, 11 years ago

Cc: Ryan J Ollos added

I tried out the change and it works well with Babel 0.9.6 and Python 2.4/0.12-stable, Python 2.5/1.0-stable.

I don't know that this matters, but I noticed that the territories in the standard-language codes linked from the w3 site are lowercase, whereas Babel outputs them in uppercase.

comment:3 by Jun Omae, 11 years ago

Severity: normalminor

Thanks for the feedback.

The language tag in rss 2.0 have one of ISO 639 language codes, e.g. en, or a pair of ISO 639 language code and ISO 3166 country code, .e.g. en-US. Normally, a rss application treats as case-insensitive, or does not use it ;-)

Also, I think that Babel for the identifiers follows "2.1.1. Formatting of Language Tags" in RFC 5646 - Tags for Identifying Languages.

comment:4 by Jun Omae, 11 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Applied in [11856] and merged in [11857-11858].

Note: See TracTickets for help on using tickets.