/quit can have a message. fixed #1488

This commit is contained in:
louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 2010-06-13 15:40:03 +00:00
parent b723a94efc
commit accfe046be
7 changed files with 187 additions and 80 deletions

View file

@ -42,5 +42,12 @@ uninstall:
rm -f $$gettextfile; \
done
mo:
for localename in `find locale/ -maxdepth 1 -type d | grep -v '.svn' | sed 's:locale/::g'` ; do \
if [ -d locale/$$localename ]; then \
msgfmt locale/$$localename/LC_MESSAGES/poezio.po -o locale/$$localename/LC_MESSAGES/poezio.mo -v; \
fi \
done
pot:
xgettext src/*.py --from-code=utf-8 --keyword=_ -o locale/poezio.pot

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-05-12 15:08+0200\n"
"POT-Creation-Date: 2010-06-13 16:13+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -16,7 +16,7 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/connection.py:91
#: src/connection.py:105
#, python-format
msgid ""
"Error: Could not authenticate. Please make sure the server you chose (%s) "
@ -24,10 +24,6 @@ msgid ""
msgstr ""
#: src/gui.py:67
msgid "OLOL, this is SOOO recursive"
msgstr ""
#: src/gui.py:68
msgid ""
"Usage: /join [room_name][/nick] [password]\n"
"Join: Join the specified room. You can specify a nickname after a slash (/). "
@ -37,78 +33,78 @@ msgid ""
"password to join the room.\n"
"Examples:\n"
"/join room@server.tld\n"
"/join room@server.tld/John\n"
"/join room@server.tld/ John\n"
"/join /me_again\n"
"/join\n"
"/join room@server.tld/my_nick password\n"
"/join / pass"
msgstr ""
#: src/gui.py:69
#: src/gui.py:68
msgid ""
"Usage: /quit\n"
"Quit: Just disconnect from the server and exit poezio."
msgstr ""
#: src/gui.py:70
#: src/gui.py:69
msgid ""
"Usage: /exit\n"
"Exit: Just disconnect from the server and exit poezio."
msgstr ""
#: src/gui.py:71
#: src/gui.py:70
msgid ""
"Usage: /next\n"
"Next: Go to the next room."
msgstr ""
#: src/gui.py:72
#: src/gui.py:71
msgid ""
"Usage: /n\n"
"N: Go to the next room."
msgstr ""
#: src/gui.py:73
#: src/gui.py:72
msgid ""
"Usage: /prev\n"
"Prev: Go to the previous room."
msgstr ""
#: src/gui.py:74
#: src/gui.py:73
msgid ""
"Usage: /p\n"
"P: Go to the previous room."
msgstr ""
#: src/gui.py:75
#: src/gui.py:74
msgid ""
"Usage: /win <number>\n"
"Win: Go to the specified room."
msgstr ""
#: src/gui.py:76
#: src/gui.py:75
msgid ""
"Usage: /w <number>\n"
"W: Go to the specified room."
msgstr ""
#: src/gui.py:77
msgid "Usage: /ignore <nickname>\\Ignore: Ignore a specified nickname."
#: src/gui.py:76
msgid "Usage: /ignore <nickname> \\Ignore: Ignore a specified nickname."
msgstr ""
#: src/gui.py:78
#: src/gui.py:77
msgid ""
"Usage: /unignore <nickname>\\Unignore: Remove the specified nickname from "
"the ignore list."
msgstr ""
#: src/gui.py:79
#: src/gui.py:78
msgid ""
"Usage: /part [message]\n"
"Part: disconnect from a room. You can specify an optional message."
" Part: disconnect from a room. You can specify an optional message."
msgstr ""
#: src/gui.py:80
#: src/gui.py:79
msgid ""
"Usage: /show <availability> [status]\n"
"Show: Change your availability and (optionaly) your status. The "
@ -117,36 +113,36 @@ msgid ""
"message"
msgstr ""
#: src/gui.py:81
#: src/gui.py:80
msgid ""
"Usage: /away [message]\n"
"Away: Sets your availability to away and (optional) sets your status "
"message. This is equivalent to \"/show away [message]\""
"message. This is equivalent to '/show away [message]'"
msgstr ""
#: src/gui.py:81
msgid ""
"Usage: /busy [message]\n"
"Busy: Sets your availability to busy and (optional) sets your status "
"message. This is equivalent to '/show busy [message]'"
msgstr ""
#: src/gui.py:82
msgid ""
"Usage: /busy [message]\n"
"Busy: Sets your availability to busy and (optional) sets your status "
"message. This is equivalent to \"/show busy [message]\""
"Usage: /avail [message]\n"
"Avail: Sets your availability to available and (optional) sets your status "
"message. This is equivalent to '/show available [message]'"
msgstr ""
#: src/gui.py:83
msgid ""
"Usage: /avail [message]\n"
"Avail: Sets your availability to available and (optional) sets your status "
"message. This is equivalent to \"/show available [message]\""
"Usage: /available [message]\n"
"Available: Sets your availability to available and (optional) sets your "
"status message. This is equivalent to '/show available [message]'"
msgstr ""
#: src/gui.py:84
msgid ""
"Usage: /available [message]\n"
"Available: Sets your availability to available and (optional) sets your "
"status message. This is equivalent to \"/show available [message]\""
msgstr ""
#: src/gui.py:85
msgid ""
"Usage: /bookmark [roomname][/nick]\n"
"Bookmark: Bookmark the specified room (you will then auto-join it on each "
"poezio start). This commands uses the same syntaxe as /join. Type /help join "
@ -155,7 +151,7 @@ msgid ""
"room (instead of default_nick)"
msgstr ""
#: src/gui.py:86
#: src/gui.py:85
msgid ""
"Usage: /set <option> [value]\n"
"Set: Sets the value to the option in your configuration file. You can, for "
@ -164,131 +160,197 @@ msgid ""
"(nothing) by providing no [value] after <option>."
msgstr ""
#: src/gui.py:87
#: src/gui.py:86
msgid ""
"Usage: /kick <nick> [reason]\n"
"Kick: Kick the user with the specified nickname. You also can give an "
"optional reason."
msgstr ""
#: src/gui.py:88
#: src/gui.py:87
msgid ""
"Usage: /topic <subject>\n"
"Usage: /topic <subject> \n"
"Topic: Change the subject of the room"
msgstr ""
#: src/gui.py:89
#: src/gui.py:88
msgid ""
"Usage: /nick <nickname>\n"
"Usage: /query <nick>\n"
"Query: Open a private conversation with <nick>. This nick has to be present "
"in the room you're currently in."
msgstr ""
#: src/gui.py:90
msgid ""
"Usage: /nick <nickname> \n"
"Nick: Change your nickname in the current room"
msgstr ""
#: src/gui.py:193
#: src/gui.py:219
msgid "Welcome on Poezio \\o/!"
msgstr ""
#: src/gui.py:194
#: src/gui.py:220
#, python-format
msgid "Your JID is %s"
msgstr ""
#: src/gui.py:229
#: src/gui.py:281
msgid "Unknown error"
msgstr ""
#: src/gui.py:282
#, python-format
msgid "Error: %(code)s-%(msg)s: %(body)s"
msgstr ""
#: src/gui.py:231
#: src/gui.py:285
msgid ""
"To provide a password in order to join the room, type \"/join / password"
"\" (replace \"password\" by the real password)"
msgstr ""
#: src/gui.py:246
#: src/gui.py:345
#, python-format
msgid "message received for a non-existing room: %s"
msgstr ""
#: src/gui.py:252
#: src/gui.py:351
#, python-format
msgid "%(nick)s changed the subject to: %(subject)s"
msgstr ""
#: src/gui.py:254
#: src/gui.py:353
#, python-format
msgid "The subject is: %(subject)s"
msgstr ""
#: src/gui.py:284
#: src/gui.py:389
#, python-format
msgid "Your nickname is %s"
msgstr ""
#: src/gui.py:286
#: src/gui.py:391
#, python-format
msgid "%s is in the room"
msgstr ""
#: src/gui.py:296
#: src/gui.py:402
#, python-format
msgid "%(nick)s joined the room %(roomname)s"
msgstr ""
#: src/gui.py:302
#: src/gui.py:414
#, python-format
msgid "%(old)s is now known as %(new)s"
msgstr ""
#: src/gui.py:418
#, python-format
msgid "%(old_nick)s is now known as %(new_nick)s"
msgstr ""
#: src/gui.py:317
#: src/gui.py:437
#, python-format
msgid "You have been kicked by %(by)s. Reason: %(reason)s"
msgstr ""
#: src/gui.py:319
#: src/gui.py:439
#, python-format
msgid "You have been kicked. Reason: %s"
msgstr ""
#: src/gui.py:322
#: src/gui.py:442
#, python-format
msgid "%(nick)s has been kicked by %(by)s. Reason: %(reason)s"
msgstr ""
#: src/gui.py:324
#: src/gui.py:444
#, python-format
msgid "%(nick)s has been kicked. Reason: %(reason)s"
msgstr ""
#: src/gui.py:333
#: src/gui.py:450 src/gui.py:453
#, python-format
msgid "%s has left the room"
msgstr ""
#: src/gui.py:343
#: src/gui.py:457
#, python-format
msgid "%(nick)s changed his/her status : %(a)s, %(b)s, %(c)s, %(d)s"
msgid "%s changed his/her status: "
msgstr ""
#: src/gui.py:388
#: src/gui.py:459
#, python-format
msgid "affiliation: %s,"
msgstr ""
#: src/gui.py:461
#, python-format
msgid "role: %s,"
msgstr ""
#: src/gui.py:463
#, python-format
msgid "show: %s,"
msgstr ""
#: src/gui.py:465
#, python-format
msgid "status: %s,"
msgstr ""
#: src/gui.py:518
#, python-format
msgid "Error: unknown command (%s)"
msgstr ""
#: src/gui.py:397
msgid "Available commands are:"
#: src/gui.py:534
msgid "Available commands are: "
msgstr ""
#: src/gui.py:400
#: src/gui.py:537
msgid ""
"\n"
"Type /help <command_name> to know what each command does"
msgstr ""
#: src/gui.py:405
#: src/gui.py:542
#, python-format
msgid "Unknown command: %s"
msgstr ""
#: src/gui.py:470
#: src/gui.py:616
#, python-format
msgid "already in room [%s]"
msgstr ""
#: src/gui.py:720
#, python-format
msgid "%s is now ignored"
msgstr ""
#: src/gui.py:722
#, python-format
msgid "%s is already ignored"
msgstr ""
#: src/gui.py:736
#, python-format
msgid "%s was not ignored"
msgstr ""
#: src/gui.py:741
#, python-format
msgid "%s is now unignored"
msgstr ""
#: src/gui.py:798
#, python-format
msgid "The subject of the room is: %s"
msgstr ""
#: src/window.py:135
#, python-format
msgid "%(nick)s from room %(room)s"
msgstr ""

View file

@ -23,13 +23,16 @@ Defines the Connection class
from gettext import (bindtextdomain, textdomain, bind_textdomain_codeset,
gettext as _)
# from os.path import isfile
# if isfile('../locale/poezio.pot'):
# localedir = '../locale'
# else:
# localedir = '/usr/share/locale'
bindtextdomain('poezio')
textdomain('poezio')
bind_textdomain_codeset('poezio', 'utf-8')
import locale
locale.setlocale(locale.LC_ALL, '')
# bindtextdomain('poezio', localedir)
# textdomain('poezio')
# bind_textdomain_codeset('poezio', 'utf-8')
import sys

View file

@ -19,13 +19,22 @@
from gettext import (bindtextdomain, textdomain, bind_textdomain_codeset,
gettext as _)
from os.path import isfile
bindtextdomain('poezio')
textdomain('poezio')
bind_textdomain_codeset('poezio', 'utf-8')
from time import sleep
# if isfile('../locale/poezio.pot'):
# localedir = '../locale'
# else:
# localedir = '/usr/share/locale'
# bindtextdomain('poezio', localedir)
# textdomain('poezio')
# bind_textdomain_codeset('poezio', 'utf-8')
# import locale
# locale.setlocale(locale.LC_ALL, '')
import locale
locale.setlocale(locale.LC_ALL, '')
import sys
import curses
@ -824,5 +833,12 @@ class Gui(object):
"""
/quit
"""
if len(args):
msg = ' '.join(args)
else:
msg = None
if msg:
self.muc.disconnect(self.rooms, msg)
sleep(0.2) # :(
self.reset_curses()
sys.exit()

View file

@ -179,6 +179,16 @@ class MultiUserChat(object):
pres.setStatus(msg)
self.connection.send(pres)
def disconnect(self, rooms, msg):
"""
"""
for room in rooms:
if room.jid is None and room.joined:
pres = Presence(to='%s' % room.name,
typ='unavailable')
pres.setStatus(msg)
self.connection.send(pres)
def on_disconnect(self):
"""Called at disconnection"""
for room in self.rooms:

View file

@ -23,6 +23,9 @@ Starting point of poezio. Launches both the Connection and Gui
import sys
# import locale
# locale.setlocale(locale.LC_ALL, '')
# disable any printout (this would mess the display)
# sys.stdout = open('/dev/null', 'w')
sys.stderr = open('errors', 'w')

View file

@ -20,10 +20,16 @@
from gettext import (bindtextdomain, textdomain, bind_textdomain_codeset,
gettext as _)
from os.path import isfile
bindtextdomain('poezio')
textdomain('poezio')
bind_textdomain_codeset('poezio', 'utf-8')
# if isfile('../locale/poezio.pot'):
# localedir = '../locale'
# else:
# localedir = '/usr/share/locale'
# bindtextdomain('poezio', localedir)
# textdomain('poezio')
# bind_textdomain_codeset('poezio', 'utf-8')
import locale
locale.setlocale(locale.LC_ALL, '')
@ -167,7 +173,7 @@ class RoomInfo(Win):
break
(y, x) = self.win.getyx()
try:
self.win.addstr(y, x-1, '] '+ current.name.encode('utf-8') , curses.color_pair(1))
self.win.addstr(y, x-1, '] '+ current.name.encode('utf-8'), curses.color_pair(1))
except:
pass
while True: