diff options
author | Yann Leboulanger <asterix@lagaule.org> | 2009-09-26 13:55:49 +0400 |
---|---|---|
committer | Yann Leboulanger <asterix@lagaule.org> | 2009-09-26 13:55:49 +0400 |
commit | 16cd926e36a72a4f40d6db0cf3007fa54eab0972 (patch) | |
tree | 0e765bac530b8aa09eb1a0081ce6fb454e08f826 | |
parent | 2e1eeae6f1695e0224f6b7be66402ea922f61844 (diff) | |
parent | 568e1edd1e7c81259a98f8640ca0ead8d9727b02 (diff) |
merge bug4293 branch
-rw-r--r-- | src/common/i18n.py | 14 | ||||
-rw-r--r-- | src/roster_window.py | 4 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/common/i18n.py b/src/common/i18n.py index e6e7d3f9b..94c8fc2ef 100644 --- a/src/common/i18n.py +++ b/src/common/i18n.py @@ -5,6 +5,7 @@ ## Copyright (C) 2004 Vincent Hanquez <tab AT snarc.org> ## Copyright (C) 2004-2007 Yann Leboulanger <asterix AT lagaule.org> ## Copyright (C) 2005-2006 Nikos Kouremenos <kourem AT gmail.com> +## Copyright (C) 2009 Benjamin Richter <br AT waldteufel-online.net> ## ## This file is part of Gajim. ## @@ -25,6 +26,19 @@ import locale import gettext import os import defs +import unicodedata + +def paragraph_direction_mark(text): + """Determine paragraph writing direction according to + http://www.unicode.org/reports/tr9/#The_Paragraph_Level + + Returns either Unicode LTR mark or RTL mark.""" + for c in text: + bidi = unicodedata.bidirectional(c) + if bidi == 'L': return u'\u200E' + elif bidi == 'AL' or bidi == 'R': return u'\u200F' + + return u'\u200E' APP = 'gajim' DIR = defs.localedir diff --git a/src/roster_window.py b/src/roster_window.py index 69e35c250..7bc4c1cf1 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -1113,7 +1113,9 @@ class RosterWindow: if c.show not in ('error', 'offline'): nb_connected_contact += 1 if nb_connected_contact > 1: - name += ' (' + unicode(nb_connected_contact) + ')' + # switch back to default writing direction + name += i18n.paragraph_direction_mark(unicode(name)) + name += u' (%d)' % nb_connected_contact # show (account_name) if there are 2 contact with same jid # in merged mode |