diff --git a/i18n.sh b/i18n.sh new file mode 100755 index 0000000..5cfbb0b --- /dev/null +++ b/i18n.sh @@ -0,0 +1 @@ +xgettext --language=Python --keyword=_ --keyword=N_ --output=i18n/mitter.pot mitter mitterlib/ui/ui_pygtk.py mitterlib/network/twitter.py diff --git a/i18n/mitter.pot b/i18n/mitter.pot new file mode 100644 index 0000000..68cb8b0 --- /dev/null +++ b/i18n/mitter.pot @@ -0,0 +1,310 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-01-10 10:06-0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: mitter:53 +msgid "Display debugging information." +msgstr "" + +#: mitter:61 +msgid "Interface to be used." +msgstr "" + +#: mitter:98 +msgid "Sorry, no interface could be found for your system" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:385 +msgid "_File" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:385 +msgid "File" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:388 +msgid "_Edit" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:388 +msgid "Edit" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:391 +msgid "_Message" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:392 +msgid "Message related options" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:395 +msgid "_View" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:395 +msgid "View" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:398 +msgid "_Help" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:398 +msgid "Help" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:402 +msgid "_Quit" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:403 +msgid "Exit Mitter" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:408 +msgid "_Refresh" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:409 +msgid "Update the listing" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:413 +msgid "_Update" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:414 +msgid "Update your status" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:420 +msgid "_Cancel" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:421 +msgid "Cancel the update" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:426 +msgid "_Clear" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:427 +msgid "Clear the message list" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:431 +msgid "_Settings" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:432 mitterlib/ui/ui_pygtk.py:1002 +msgid "Settings" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:437 +msgid "_Delete" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:438 +msgid "Delete a post" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:443 +msgid "_Reply" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:444 +msgid "Send a response to someone's else message" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:449 +msgid "Re_post" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:450 +msgid "Put someone's else message on your timeline" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:456 +msgid "_Favourite" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:457 +msgid "Toggle the favourite status of a message" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:464 +msgid "_Messages" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:465 +msgid "Display messages" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:469 +msgid "_Replies" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:470 +msgid "Display replies" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:475 +msgid "_About" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:475 +msgid "About Mitter" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:549 +msgid "Mitter on GoogleCode" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:622 +#, python-format +msgid " — reposted by %s" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:626 +#, python-format +msgid " — in reply to %s" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:671 +msgid "Retrieving messages..." +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:694 +#, python-format +msgid "Open on %s" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:723 +#, python-format +msgid "Messages (%d)" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:727 +#, python-format +msgid "Replies (%d)" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:802 +#, python-format +msgid "(replying to %s)" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:807 +#, python-format +msgid "%d character %s" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:826 +msgid "Sending update..." +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:936 +msgid "Delete this message?" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:946 +msgid "Deleting message..." +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:972 +#, python-format +msgid "Reposting %s message..." +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:989 +#, python-format +msgid "Removing message from %s from favourites..." +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:991 +#, python-format +msgid "Marking message from %s as favourite..." +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:1019 +msgid "Refresh interval (minutes):" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:1024 +msgid "Interface" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:1182 +msgid "Retrieving replies..." +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:1194 +msgid "" +"Error retrieving current messages. Auto-refresh disabled. Use the \"Refresh" +"\" option to re-enable it." +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:1200 +msgid "Auto-update disabled" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:1222 +#, python-format +msgid "New messages retrieved. Next update in %d minutes." +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:1266 +msgid "Your status was updated." +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:1278 +msgid "Error updating your status. Please try again." +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:1292 +msgid "Message deleted." +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:1305 +msgid "Message reposted" +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:1315 +msgid "Error reposting message. Please try again." +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:1328 +msgid "Message unfavourited." +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:1330 +msgid "Message favourited." +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:1343 +msgid "Error changing favourite status of the message. Please, try again." +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:1419 +msgid "Refresh interval." +msgstr "" + +#: mitterlib/ui/ui_pygtk.py:1428 +msgid "Disable the use of the status icon." +msgstr "" diff --git a/mitterlib/network/twitter.py b/mitterlib/network/twitter.py index f9784d7..1b4b5d4 100644 --- a/mitterlib/network/twitter.py +++ b/mitterlib/network/twitter.py @@ -26,10 +26,10 @@ import htmlentitydefs import re import warnings import htmlentitydefs +import gettext from httplib import BadStatusLine from socket import error as socketError -#from mitterlib import htmlize from networkbase import NetworkBase, NetworkData, auth_options, \ NetworkDNSError, NetworkBadStatusLineError, NetworkLowLevelError, \ @@ -43,11 +43,22 @@ except ImportError: # Fallback to SimpleJSON import simplejson as json +# ---------------------------------------------------------------------- +# I18n bits +# ---------------------------------------------------------------------- +t = gettext.translation('ui_pygtk', fallback=True) +_ = t.gettext +N_ = t.ngettext + +# ---------------------------------------------------------------------- # logging +# ---------------------------------------------------------------------- _log = logging.getLogger('mitterlib.network.Twitter') +# ---------------------------------------------------------------------- # the month names come directly from the site, so we are not affected by # locale settings. +# ---------------------------------------------------------------------- _month_names = [None, 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] @@ -312,13 +323,13 @@ class Connection(NetworkBase): AUTH = [ {'name': 'username', 'flags': ['-u', '--username'], - 'prompt': 'Username', - 'help': 'Your twitter username', + 'prompt': _('Username'), + 'help': _('Your twitter username'), 'type': 'str'}, {'name': 'password', 'flags': ['-p', '--password'], - 'prompt': 'Password', - 'help': 'Your twitter password', + 'prompt': _('Password'), + 'help': _('Your twitter password'), 'type': 'passwd'}] @classmethod @@ -329,7 +340,7 @@ class Connection(NetworkBase): group=self.NAMESPACE, option='https', default=True, # Secure connections by default - help='Disable HTTPS (secure) connection with Twitter.', + help=_('Disable HTTPS (secure) connection with Twitter.'), action='store_false') options.add_option( group=self.NAMESPACE, @@ -490,6 +501,8 @@ class Connection(NetworkBase): data = self._request('/statuses/update.json', body=body) # TODO: Check if twitter sends an error message when the message is # too large. + # TODO: Some updates return the previous status, not the new one. Not + # sure what that means. return TwitterNetworkData(data) def repost(self, message): diff --git a/mitterlib/ui/ui_pygtk.py b/mitterlib/ui/ui_pygtk.py index 92b7241..a570cc5 100644 --- a/mitterlib/ui/ui_pygtk.py +++ b/mitterlib/ui/ui_pygtk.py @@ -453,8 +453,8 @@ class Interface(object): self._repost_action.connect('activate', self._repost_message) action_group.add_action_with_accel(self._repost_action, 'p') - self._favourite_action = gtk.Action('Favourite', _('_Favourite'), - _('Toggle the favourite status of a message'), + self._favourite_action = gtk.Action('Favourite', _('_Favorite'), + _('Toggle the favorite status of a message'), gtk.STOCK_ABOUT) self._favourite_action.set_property('sensitive', False) self._favourite_action.connect('activate', self._favourite_message) @@ -546,7 +546,7 @@ class Interface(object): about_window.set_copyright('2007-2010 Mitter Contributors') about_window.set_license(gpl_3) about_window.set_website('http://code.google.com/p/mitter') - about_window.set_website_label(_('Mitter on GoogleCode')) + about_window.set_website_label(_('Mitter project page')) about_window.set_authors([ 'Main developers:', 'Julio Biason', @@ -986,9 +986,9 @@ class Interface(object): self._favourite_iter = iter if message.favourite: - display = _('Removing message from %s from favourites...') + display = _('Removing message from %s from favorites...') else: - display = _('Marking message from %s as favourite...') + display = _('Marking message from %s as favorite...') self._update_status(display % (message.username)) self._threads.add_work(self._post_favourite_message, @@ -1219,8 +1219,11 @@ class Interface(object): interval = self._options[self.NAMESPACE]['refresh_interval'] _log.debug('Queueing next refresh in %d minutes', interval) - self._update_statusbar(_('New messages retrieved. Next update in ' \ - '%d minutes.') % (interval)) + prefix = _('New messages retrieved.') + suffix = N_('Next update in %d minute', 'Next update in %d minutes', + interval) + message = '%s %s.' % (prefix, suffix) + self._update_statusbar(message % (interval)) self._refresh_id = gobject.timeout_add( interval * 60 * 1000, self._refresh, None) @@ -1325,9 +1328,9 @@ class Interface(object): _log.debug('Favourite status changed.') message = self._grid.get_model().get_value(self._favourite_iter, 0) if message.favourite: - display = _('Message unfavourited.') + display = _('Message unfavorited.') else: - display = _('Message favourited.') + display = _('Message favorited.') self._update_statusbar(display) message.favourite = not message.favourite self._favourite_iter = None @@ -1340,7 +1343,7 @@ class Interface(object): error_win = gtk.MessageDialog(parent=self._main_window, type=gtk.MESSAGE_ERROR, - message_format=_('Error changing favourite status of the ' \ + message_format=_('Error changing favorite status of the ' \ 'message. Please, try again.'), buttons=gtk.BUTTONS_OK) error_win.run()