Fix #813924 ('zh-TW' come up in language list of News Schedule dialog)

This commit is contained in:
Kovid Goyal 2011-07-21 08:48:31 -06:00
parent ca1367048d
commit 576e8aaebf
3 changed files with 4 additions and 2 deletions

View File

@ -64,7 +64,7 @@ class UnitedDaily(BasicNewsRecipe):
__author__ = 'Eddie Lau'
__version__ = '1.1'
language = 'zh-TW'
language = 'zh_TW'
publisher = 'United Daily News Group'
description = 'United Daily (Taiwan)'
category = 'News, Chinese, Taiwan'

View File

@ -72,7 +72,7 @@ def set_translators():
if lang:
buf = iso639 = None
mpath = get_lc_messages_path(lang)
if os.access(mpath+'.po', os.R_OK):
if mpath and os.access(mpath+'.po', os.R_OK):
from calibre.translations.msgfmt import make
buf = cStringIO.StringIO()
make(mpath+'.po', buf)

View File

@ -217,6 +217,8 @@ class RecipeModel(QAbstractItemModel, SearchQueryParser):
self.all_urns.add(urn)
if ok(urn):
lang = x.get('language', 'und')
if lang:
lang = lang.replace('-', '_')
if lang not in lang_map:
lang_map[lang] = factory(NewsCategory, new_root, lang)
factory(NewsItem, lang_map[lang], urn, x.get('title'))