* unicode fix

This commit is contained in:
Eray Özkural
2005-11-03 18:01:47 +00:00
parent 138a8a6688
commit 3eaa8337cd
2 changed files with 14 additions and 6 deletions
+1 -1
View File
@@ -773,7 +773,7 @@ Gives a brief list of PiSi components published in the repository.
pstr = p pstr = p
if p in installed_list: if p in installed_list:
pstr = colorize(p, "cyan") pstr = colorize(p, "cyan")
ctx.ui.info('%15s - %s ' % (pstr, package.summary)) ctx.ui.info('%15s - %s ' % (pstr, unicode(package.summary)))
class ListUpgrades(Command): class ListUpgrades(Command):
+13 -5
View File
@@ -116,6 +116,7 @@ class LocalText(dict):
langs = [ locale.getlocale()[0][0:2], 'tr', 'en' ] langs = [ locale.getlocale()[0][0:2], 'tr', 'en' ]
if not util.any(lambda x : self.has_key(x), langs): if not util.any(lambda x : self.has_key(x), langs):
errs.append( where + _("Tag should have at least an English or Turkish version")) errs.append( where + _("Tag should have at least an English or Turkish version"))
#FIXME: check if all entries are unicode
return errs return errs
def format(self, f, errs): def format(self, f, errs):
@@ -142,11 +143,18 @@ class LocalText(dict):
ctx.ui.warning(x) ctx.ui.warning(x)
def __str__(self): def __str__(self):
strfile = StringIO() L = locale.getlocale()[0][0:2] # try to read language, pathetic isn't it?
self.print_text(strfile) if self.has_key(L):
str = strfile.getvalue() return unicode(self[L])
strfile.close() elif self.has_key('en'):
return str # fallback to English, blah
return unicode(self['en'])
elif self.has_key('tr'):
# fallback to Turkish
return unicode(self['tr'])
else:
return ''
#ctx.ui.warning(_("Tag should have at least an English or Turkish version"))
class Writer(formatter.DumbWriter): class Writer(formatter.DumbWriter):
"""adds unicode support""" """adds unicode support"""