use plural forms (ngettext) in a string. please convert your strings that way
This commit is contained in:
parent
3c59acddc2
commit
6aefa6ae86
4 changed files with 31 additions and 31 deletions
|
@ -109,12 +109,12 @@ class Chat:
|
||||||
chat = self.names[jid]
|
chat = self.names[jid]
|
||||||
if len(self.xmls) > 1: # if more than one tab in the same window
|
if len(self.xmls) > 1: # if more than one tab in the same window
|
||||||
if self.widget_name == 'tabbed_chat_window':
|
if self.widget_name == 'tabbed_chat_window':
|
||||||
chat = 'Chat'
|
chat = _('Chat')
|
||||||
elif self.widget_name == 'groupchat_window':
|
elif self.widget_name == 'groupchat_window':
|
||||||
chat = 'Groupchat'
|
chat = _('Group Chat')
|
||||||
title = start + chat
|
title = start + chat
|
||||||
if len(gajim.connections) >= 2: # if we have 2 or more accounts
|
if len(gajim.connections) >= 2: # if we have 2 or more accounts
|
||||||
title = title + _(' (account: ') + self.account + ')'
|
title = title + ' (' + _('account: ') + self.account + ')'
|
||||||
|
|
||||||
self.window.set_title(title)
|
self.window.set_title(title)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
## common/i18n.py
|
## common/i18n.py
|
||||||
##
|
## -*- coding: utf-8 -*-
|
||||||
## Gajim Team:
|
## Gajim Team:
|
||||||
## - Yann Le Boulanger <asterix@lagaule.org>
|
## - Yann Le Boulanger <asterix@lagaule.org>
|
||||||
## - Vincent Hanquez <tab@snarc.org>
|
## - Vincent Hanquez <tab@snarc.org>
|
||||||
|
@ -17,8 +17,8 @@
|
||||||
## GNU General Public License for more details.
|
## GNU General Public License for more details.
|
||||||
##
|
##
|
||||||
|
|
||||||
APP='gajim'
|
APP = 'gajim'
|
||||||
DIR='../po'
|
DIR = '../po'
|
||||||
|
|
||||||
import locale
|
import locale
|
||||||
import gettext
|
import gettext
|
||||||
|
@ -36,5 +36,4 @@ def init():
|
||||||
def _(s):
|
def _(s):
|
||||||
if s == '':
|
if s == '':
|
||||||
return s
|
return s
|
||||||
assert s
|
|
||||||
return _translation.gettext(s)
|
return _translation.gettext(s)
|
||||||
|
|
|
@ -487,16 +487,12 @@ class ConfirmationDialogCheck(ConfirmationDialog):
|
||||||
def __init__(self, pritext, sectext='', checktext = ''):
|
def __init__(self, pritext, sectext='', checktext = ''):
|
||||||
HigDialog.__init__(self, None, pritext, sectext,
|
HigDialog.__init__(self, None, pritext, sectext,
|
||||||
gtk.STOCK_DIALOG_WARNING, [ [gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL] ])
|
gtk.STOCK_DIALOG_WARNING, [ [gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL] ])
|
||||||
|
|
||||||
# add ok button manually, because we need to focus on it
|
# add ok button manually, because we need to focus on it
|
||||||
ok_button = self.add_button (gtk.STOCK_OK, gtk.RESPONSE_OK)
|
ok_button = self.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
|
||||||
self.checkbutton = gtk.CheckButton(checktext)
|
self.checkbutton = gtk.CheckButton(checktext)
|
||||||
self.vbox.pack_start(self.checkbutton, expand=False, fill=True)
|
self.vbox.pack_start(self.checkbutton, expand=False, fill=True)
|
||||||
ok_button.grab_focus()
|
ok_button.grab_focus()
|
||||||
# override this method not to destroy the dialog
|
|
||||||
def get_response(self):
|
|
||||||
self.show_all()
|
|
||||||
response = gtk.Dialog.run(self)
|
|
||||||
return response
|
|
||||||
|
|
||||||
def is_checked(self):
|
def is_checked(self):
|
||||||
''' Get active state of the checkbutton '''
|
''' Get active state of the checkbutton '''
|
||||||
|
|
|
@ -30,6 +30,7 @@ import gtkgui_helpers
|
||||||
from gajim import Contact
|
from gajim import Contact
|
||||||
from common import gajim
|
from common import gajim
|
||||||
from common import helpers
|
from common import helpers
|
||||||
|
from gettext import ngettext
|
||||||
from common import i18n
|
from common import i18n
|
||||||
|
|
||||||
_ = i18n._
|
_ = i18n._
|
||||||
|
@ -111,7 +112,6 @@ class GroupchatWindow(chat.Chat):
|
||||||
|
|
||||||
def on_groupchat_window_delete_event(self, widget, event):
|
def on_groupchat_window_delete_event(self, widget, event):
|
||||||
"""close window"""
|
"""close window"""
|
||||||
stop_propagation = False
|
|
||||||
for room_jid in self.xmls:
|
for room_jid in self.xmls:
|
||||||
if time.time() - gajim.last_message_time[self.account][room_jid] < 2:
|
if time.time() - gajim.last_message_time[self.account][room_jid] < 2:
|
||||||
dialog = dialogs.ConfirmationDialog(
|
dialog = dialogs.ConfirmationDialog(
|
||||||
|
@ -119,33 +119,38 @@ class GroupchatWindow(chat.Chat):
|
||||||
_('If you close this window, this message will be lost.')
|
_('If you close this window, this message will be lost.')
|
||||||
)
|
)
|
||||||
if dialog.get_response() != gtk.RESPONSE_OK:
|
if dialog.get_response() != gtk.RESPONSE_OK:
|
||||||
stop_propagation = True #stop the propagation of the event
|
dialog.destroy()
|
||||||
if not stop_propagation and self.confirm_close:
|
return True # stop the propagation of the delete event
|
||||||
if len(self.xmls) >=2:
|
|
||||||
|
if self.confirm_close:
|
||||||
|
name = ''
|
||||||
names = ''
|
names = ''
|
||||||
|
if len(self.xmls) >= 2:
|
||||||
for room in self.xmls:
|
for room in self.xmls:
|
||||||
if names != '':
|
if names != '':
|
||||||
names += ', '
|
names += ', '
|
||||||
names += gajim.get_nick_from_jid(room)
|
names += gajim.get_nick_from_jid(room)
|
||||||
pritext = _('Are you sure you want to leave rooms "%s"?') \
|
|
||||||
% names
|
|
||||||
sectext = \
|
|
||||||
_('If you close this window, you will be disconnected from these rooms.')
|
|
||||||
else:
|
else:
|
||||||
name = gajim.get_nick_from_jid(room_jid)
|
name = gajim.get_nick_from_jid(room_jid)
|
||||||
pritext = _('Are you sure you want to leave room "%s"?') \
|
|
||||||
% name
|
pritext = ngettext('Are you sure you want to leave room "%s"?' % name,
|
||||||
sectext = \
|
'Are you sure you want to leave rooms "%s"?' % names, len(self.xmls))
|
||||||
_('If you close this window, you will be disconnected from the room.')
|
|
||||||
|
sectext = ngettext(
|
||||||
|
'If you close this window, you will be disconnected from this room.',
|
||||||
|
'If you close this window, you will be disconnected from these rooms.',
|
||||||
|
len(self.xmls))
|
||||||
|
|
||||||
dialog = dialogs.ConfirmationDialogCheck(pritext, sectext,
|
dialog = dialogs.ConfirmationDialogCheck(pritext, sectext,
|
||||||
_('Do not ask me again') )
|
_('Do not ask me again') )
|
||||||
|
|
||||||
if dialog.get_response() != gtk.RESPONSE_OK:
|
if dialog.get_response() != gtk.RESPONSE_OK:
|
||||||
stop_propagation = True
|
return True # stop propagation of the delete event
|
||||||
|
|
||||||
if dialog.is_checked():
|
if dialog.is_checked():
|
||||||
gajim.config.set('confirm_close_muc', False)
|
gajim.config.set('confirm_close_muc', False)
|
||||||
dialog.destroy()
|
dialog.destroy()
|
||||||
if stop_propagation:
|
|
||||||
return True
|
|
||||||
for room_jid in self.xmls:
|
for room_jid in self.xmls:
|
||||||
gajim.connections[self.account].send_gc_status(self.nicks[room_jid],
|
gajim.connections[self.account].send_gc_status(self.nicks[room_jid],
|
||||||
room_jid, 'offline', 'offline')
|
room_jid, 'offline', 'offline')
|
||||||
|
|
Loading…
Add table
Reference in a new issue