#11250 closed defect (fixed)
malformed langauge tag in timeline rss if locale with no territory
| 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.   | 
      ||
| API Changes: | |||
| Internal Changes: | |||
Description (last modified by )
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://localhost/chrome/common/trac_banner.png</url> <link>http://localhost/timeline</link> </image> <item> ...
- 
      
trac/timeline/templates/timeline.rss
index 2836ac7..50897ca 100644
a b 6 6 <title>${project.name}</title> 7 7 <link>${abs_href.timeline()}</link> 8 8 <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> 12 10 <generator>Trac ${trac.version}</generator> 13 11 <image py:if="chrome.logo.src_abs"> 14 12 <title>${project.name}</title>  
Attachments (0)
Change History (5)
comment:1 by , 12 years ago
| Owner: | set to | 
|---|---|
| Status: | new → assigned | 
comment:2 by , 12 years ago
| Cc: | added | 
|---|
comment:3 by , 12 years ago
| Severity: | normal → minor | 
|---|
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 , 12 years ago
| Release Notes: | modified (diff) | 
|---|---|
| Resolution: | → fixed | 
| Status: | assigned → closed | 
Applied in [11856] and merged in [11857-11858].
comment:5 by , 12 years ago
| Description: | modified (diff) | 
|---|



  
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.