diff --git a/src/chat_control.py b/src/chat_control.py
index cc7f0a9ad..d18c145f8 100644
--- a/src/chat_control.py
+++ b/src/chat_control.py
@@ -44,6 +44,7 @@ from common import gajim
from common import helpers
from common import exceptions
from common import ged
+from common import i18n
from message_control import MessageControl
from conversation_textview import ConversationTextview
from message_textview import MessageTextView
@@ -2117,9 +2118,10 @@ class ChatControl(ChatControlBase):
if self.resource:
name += '/' + self.resource
if self.TYPE_ID == message_control.TYPE_PM:
- name = _('%(nickname)s from group chat %(room_name)s') %\
- {'nickname': name, 'room_name': self.room_name}
- name = gobject.markup_escape_text(name)
+ name = i18n.direction_mark + _(
+ '%(nickname)s from group chat %(room_name)s') % \
+ {'nickname': name, 'room_name': self.room_name}
+ name = i18n.direction_mark + gobject.markup_escape_text(name)
# We know our contacts nick, but if another contact has the same nick
# in another account we need to also display the account.
@@ -2134,7 +2136,7 @@ class ChatControl(ChatControlBase):
other_contact_ = \
gajim.contacts.get_first_contact_from_jid(account, jid)
if other_contact_.get_shown_name() == self.contact.get_shown_name():
- acct_info = ' (%s)' % \
+ acct_info = i18n.direction_mark + ' (%s)' % \
gobject.markup_escape_text(self.account)
break
@@ -2159,16 +2161,16 @@ class ChatControl(ChatControlBase):
chatstate = ''
label_text = '%s%s %s' \
- % (font_attrs, name, font_attrs_small, acct_info, chatstate)
+ % (font_attrs, name, font_attrs_small, acct_info, chatstate)
if acct_info:
- acct_info = ' ' + acct_info
+ acct_info = i18n.direction_mark + ' ' + acct_info
label_tooltip = '%s%s %s' % (name, acct_info, chatstate)
else:
# weight="heavy" size="x-large"
label_text = '%s%s' % \
(font_attrs, name, font_attrs_small, acct_info)
if acct_info:
- acct_info = ' ' + acct_info
+ acct_info = i18n.direction_mark + ' ' + acct_info
label_tooltip = '%s%s' % (name, acct_info)
if status_escaped:
diff --git a/src/common/connection_handlers_events.py b/src/common/connection_handlers_events.py
index aa7d69dbe..413455e37 100644
--- a/src/common/connection_handlers_events.py
+++ b/src/common/connection_handlers_events.py
@@ -29,6 +29,7 @@ from common import atom
from common import nec
from common import helpers
from common import gajim
+from common import i18n
import nbxmpp
from common import dataforms
from common import exceptions
@@ -2351,25 +2352,23 @@ class NotificationEvent(nec.NetworkIncomingEvent):
self.popup_timeout = gajim.config.get('notification_timeout')
+ nick = i18n.direction_mark + gajim.get_name_from_jid(account, self.jid)
if event == 'status_change':
self.popup_title = _('%(nick)s Changed Status') % \
- {'nick': gajim.get_name_from_jid(account, self.jid)}
+ {'nick': nick}
self.popup_text = _('%(nick)s is now %(status)s') % \
- {'nick': gajim.get_name_from_jid(account, self.jid),\
- 'status': helpers.get_uf_show(pres_obj.show)}
+ {'nick': nick, 'status': helpers.get_uf_show(pres_obj.show)}
if pres_obj.status:
self.popup_text = self.popup_text + " : " + pres_obj.status
self.popup_event_type = _('Contact Changed Status')
elif event == 'contact_connected':
- self.popup_title = _('%(nickname)s Signed In') % \
- {'nickname': gajim.get_name_from_jid(account, self.jid)}
+ self.popup_title = _('%(nickname)s Signed In') % {'nickname': nick}
self.popup_text = ''
if pres_obj.status:
self.popup_text = pres_obj.status
self.popup_event_type = _('Contact Signed In')
elif event == 'contact_disconnected':
- self.popup_title = _('%(nickname)s Signed Out') % \
- {'nickname': gajim.get_name_from_jid(account, self.jid)}
+ self.popup_title = _('%(nickname)s Signed Out') % {'nickname': nick}
self.popup_text = ''
if pres_obj.status:
self.popup_text = pres_obj.status
diff --git a/src/common/i18n.py b/src/common/i18n.py
index 4f82c7d1c..072c25266 100644
--- a/src/common/i18n.py
+++ b/src/common/i18n.py
@@ -26,6 +26,12 @@ import gettext
import os
import defs
import unicodedata
+import gtk
+
+if gtk.widget_get_default_direction() == gtk.TEXT_DIR_LTR:
+ direction_mark = u'\u200E'
+else:
+ direction_mark = u'\u200F'
def paragraph_direction_mark(text):
"""
diff --git a/src/conversation_textview.py b/src/conversation_textview.py
index cf70cee89..b7f2300f0 100644
--- a/src/conversation_textview.py
+++ b/src/conversation_textview.py
@@ -1294,10 +1294,7 @@ class ConversationTextview(gobject.GObject):
direction_mark = i18n.paragraph_direction_mark(unicode(text))
# don't apply direction mark if it's status message
if kind == 'status':
- if gtk.widget_get_default_direction() == gtk.TEXT_DIR_LTR:
- direction_mark = u'\u200E'
- else:
- direction_mark = u'\u200F'
+ direction_mark = i18n.direction_mark
if current_print_time == 'always' and kind != 'info' and not simple:
timestamp_str = self.get_time_to_show(tim)
timestamp = time.strftime(timestamp_str, tim)
diff --git a/src/groupchat_control.py b/src/groupchat_control.py
index a12e05039..c2e8d48ce 100644
--- a/src/groupchat_control.py
+++ b/src/groupchat_control.py
@@ -47,6 +47,7 @@ from common import gajim
from common import helpers
from common import dataforms
from common import ged
+from common import i18n
from chat_control import ChatControl
from chat_control import ChatControlBase
@@ -1513,7 +1514,8 @@ class GroupchatControl(ChatControlBase):
affiliation = 'none'
newly_created = False
- nick_jid = obj.nick
+ nick = i18n.direction_mark + obj.nick
+ nick_jid = nick
# Set to true if role or affiliation have changed
right_changed = False
@@ -1556,10 +1558,10 @@ class GroupchatControl(ChatControlBase):
if '307' in obj.status_code:
if obj.actor is None: # do not print 'kicked by None'
s = _('%(nick)s has been kicked: %(reason)s') % {
- 'nick': obj.nick, 'reason': obj.reason}
+ 'nick': nick, 'reason': obj.reason}
else:
s = _('%(nick)s has been kicked by %(who)s: '
- '%(reason)s') % {'nick': obj.nick, 'who': obj.actor,
+ '%(reason)s') % {'nick': nick, 'who': obj.actor,
'reason': obj.reason}
self.print_conversation(s, 'info', graphics=False)
if obj.nick == self.nick and not gajim.config.get(
@@ -1568,10 +1570,10 @@ class GroupchatControl(ChatControlBase):
elif '301' in obj.status_code:
if obj.actor is None: # do not print 'banned by None'
s = _('%(nick)s has been banned: %(reason)s') % {
- 'nick': obj.nick, 'reason': obj.reason}
+ 'nick': nick, 'reason': obj.reason}
else:
s = _('%(nick)s has been banned by %(who)s: '
- '%(reason)s') % {'nick': obj.nick, 'who': obj.actor,
+ '%(reason)s') % {'nick': nick, 'who': obj.actor,
'reason': obj.reason}
self.print_conversation(s, 'info', graphics=False)
if obj.nick == self.nick:
@@ -1598,7 +1600,7 @@ class GroupchatControl(ChatControlBase):
ctrl.no_autonegotiation = False
else:
s = _('%(nick)s is now known as %(new_nick)s') % {
- 'nick': obj.nick, 'new_nick': obj.new_nick}
+ 'nick': nick, 'new_nick': obj.new_nick}
tv = self.conv_textview
if obj.nick in tv.last_received_message_marks:
tv.last_received_message_marks[obj.new_nick] = \
@@ -1652,18 +1654,18 @@ class GroupchatControl(ChatControlBase):
self.print_conversation(s, 'info', graphics=False)
elif '321' in obj.status_code:
s = _('%(nick)s has been removed from the room '
- '(%(reason)s)') % { 'nick': obj.nick,
+ '(%(reason)s)') % { 'nick': nick,
'reason': _('affiliation changed') }
self.print_conversation(s, 'info', graphics=False)
elif '322' in obj.status_code:
s = _('%(nick)s has been removed from the room '
- '(%(reason)s)') % { 'nick': obj.nick,
+ '(%(reason)s)') % { 'nick': nick,
'reason': _('room configuration changed to '
'members-only') }
self.print_conversation(s, 'info', graphics=False)
elif '332' in obj.status_code:
s = _('%(nick)s has been removed from the room '
- '(%(reason)s)') % {'nick': obj.nick,
+ '(%(reason)s)') % {'nick': nick,
'reason': _('system shutdown') }
self.print_conversation(s, 'info', graphics=False)
# Room has been destroyed.
@@ -1697,7 +1699,7 @@ class GroupchatControl(ChatControlBase):
if '210' in obj.status_code:
# Server changed our nick
self.nick = obj.nick
- s = _('You are now known as %s') % obj.nick
+ s = _('You are now known as %s') % nick
self.print_conversation(s, 'info', graphics=False)
iter_ = self.add_contact_to_roster(obj.nick, obj.show, role,
affiliation, obj.status, obj.real_jid)