Added some comments for translators

This commit is contained in:
Manuel Cortez 2016-06-29 10:56:41 -05:00
parent f5608576c9
commit e528aa1eec
6 changed files with 25 additions and 3 deletions

View File

@ -20,6 +20,7 @@ class attach(object):
imageInfo = {"type": "photo", "file": image, "description": os.path.basename(image)} imageInfo = {"type": "photo", "file": image, "description": os.path.basename(image)}
log.debug("Image data to upload: %r" % (imageInfo,)) log.debug("Image data to upload: %r" % (imageInfo,))
self.attachments.append(imageInfo) self.attachments.append(imageInfo)
# Translators: This is the text displayed in the attachments dialog, when the user adds a photo.
info = [_(u"Photo"), os.path.basename(image)] info = [_(u"Photo"), os.path.basename(image)]
self.dialog.attachments.insert_item(False, *info) self.dialog.attachments.insert_item(False, *info)
self.dialog.remove.Enable(True) self.dialog.remove.Enable(True)

View File

@ -165,6 +165,7 @@ class baseBuffer(object):
l = self.session.vk.client.likes.add(owner_id=user, item_id=id, type=type_) l = self.session.vk.client.likes.add(owner_id=user, item_id=id, type=type_)
self.session.db[self.name]["items"][self.tab.list.get_selected()]["likes"]["count"] = l["likes"] self.session.db[self.name]["items"][self.tab.list.get_selected()]["likes"]["count"] = l["likes"]
self.session.db[self.name]["items"][self.tab.list.get_selected()]["likes"]["user_likes"] = 1 self.session.db[self.name]["items"][self.tab.list.get_selected()]["likes"]["user_likes"] = 1
# Translators: This will be used when user presses like.
output.speak(_(u"You liked this")) output.speak(_(u"You liked this"))
def do_dislike(self, *args, **kwargs): def do_dislike(self, *args, **kwargs):
@ -178,6 +179,7 @@ class baseBuffer(object):
l = self.session.vk.client.likes.delete(owner_id=user, item_id=id, type=type_) l = self.session.vk.client.likes.delete(owner_id=user, item_id=id, type=type_)
self.session.db[self.name]["items"][self.tab.list.get_selected()]["likes"]["count"] = l["likes"] self.session.db[self.name]["items"][self.tab.list.get_selected()]["likes"]["count"] = l["likes"]
self.session.db[self.name]["items"][self.tab.list.get_selected()]["likes"]["user_likes"] = 2 self.session.db[self.name]["items"][self.tab.list.get_selected()]["likes"]["user_likes"] = 2
# Translators: This will be user in 'dislike'
output.speak(_(u"You don't like this")) output.speak(_(u"You don't like this"))
def do_comment(self, *args, **kwargs): def do_comment(self, *args, **kwargs):
@ -335,6 +337,7 @@ class audioBuffer(feedBuffer):
return False return False
def get_more_items(self, *args, **kwargs): def get_more_items(self, *args, **kwargs):
# Translators: Some buffers can't use the get previous item feature due to API limitations.
output.speak(_(u"This buffer doesn't support getting more items.")) output.speak(_(u"This buffer doesn't support getting more items."))
def onFocus(self, *args, **kwargs): def onFocus(self, *args, **kwargs):
@ -366,6 +369,7 @@ class audioBuffer(feedBuffer):
id = self.get_post()["id"] id = self.get_post()["id"]
response = self.session.vk.client.audio.moveToAlbum(album_id=album.item, audio_ids=id) response = self.session.vk.client.audio.moveToAlbum(album_id=album.item, audio_ids=id)
if response == 1: if response == 1:
# Translators: Used when the user has moved an audio to an album.
output.speak(_(u"Moved")) output.speak(_(u"Moved"))
def get_menu(self): def get_menu(self):

View File

@ -57,9 +57,11 @@ class Controller(object):
log.debug("Creating controls for the window...") log.debug("Creating controls for the window...")
posts_ = buffers.empty(parent=self.window.tb, name="posts") posts_ = buffers.empty(parent=self.window.tb, name="posts")
self.buffers.append(posts_) self.buffers.append(posts_)
# Translators: Name for the posts tab in the tree view.
self.window.add_buffer(posts_.tab, _(u"Posts")) self.window.add_buffer(posts_.tab, _(u"Posts"))
home = buffers.baseBuffer(parent=self.window.tb, name="home_timeline", session=self.session, composefunc="compose_new", endpoint="newsfeed", count=self.session.settings["buffers"]["count_for_wall_buffers"]) home = buffers.baseBuffer(parent=self.window.tb, name="home_timeline", session=self.session, composefunc="compose_new", endpoint="newsfeed", count=self.session.settings["buffers"]["count_for_wall_buffers"])
self.buffers.append(home) self.buffers.append(home)
# Translators: Newsfeed's name in the tree view.
self.window.insert_buffer(home.tab, _(u"Home"), self.window.search("posts")) self.window.insert_buffer(home.tab, _(u"Home"), self.window.search("posts"))
self.repeatedUpdate = RepeatingTimer(180, self.update_all_buffers) self.repeatedUpdate = RepeatingTimer(180, self.update_all_buffers)
self.repeatedUpdate.start() self.repeatedUpdate.start()
@ -69,13 +71,12 @@ class Controller(object):
feed = buffers.feedBuffer(parent=self.window.tb, name="me_feed", composefunc="compose_status", session=self.session, endpoint="get", parent_endpoint="wall", extended=1, count=self.session.settings["buffers"]["count_for_wall_buffers"]) feed = buffers.feedBuffer(parent=self.window.tb, name="me_feed", composefunc="compose_status", session=self.session, endpoint="get", parent_endpoint="wall", extended=1, count=self.session.settings["buffers"]["count_for_wall_buffers"])
self.buffers.append(feed) self.buffers.append(feed)
# Translators: Own user's wall name in the tree view.
self.window.insert_buffer(feed.tab, _(u"My wall"), self.window.search("posts")) self.window.insert_buffer(feed.tab, _(u"My wall"), self.window.search("posts"))
audios = buffers.empty(parent=self.window.tb, name="audios") audios = buffers.empty(parent=self.window.tb, name="audios")
self.buffers.append(audios) self.buffers.append(audios)
# Translators: name for the music category in the tree view.
self.window.add_buffer(audios.tab, _(u"Music")) self.window.add_buffer(audios.tab, _(u"Music"))
albums = buffers.empty(parent=self.window.tb, name="albums")
self.buffers.append(albums)
self.window.insert_buffer(albums.tab, _(u"Albums"), self.window.search("audios"))
audio = buffers.audioBuffer(parent=self.window.tb, name="me_audio", composefunc="compose_audio", session=self.session, endpoint="get", parent_endpoint="audio", full_list=True, count=self.session.settings["buffers"]["count_for_audio_buffers"]) audio = buffers.audioBuffer(parent=self.window.tb, name="me_audio", composefunc="compose_audio", session=self.session, endpoint="get", parent_endpoint="audio", full_list=True, count=self.session.settings["buffers"]["count_for_audio_buffers"])
self.buffers.append(audio) self.buffers.append(audio)
@ -86,6 +87,9 @@ class Controller(object):
r_audio = buffers.audioBuffer(parent=self.window.tb, name="recommended_audio", composefunc="compose_audio", session=self.session, endpoint="getRecommendations", parent_endpoint="audio", full_list=True, count=self.session.settings["buffers"]["count_for_audio_buffers"]) r_audio = buffers.audioBuffer(parent=self.window.tb, name="recommended_audio", composefunc="compose_audio", session=self.session, endpoint="getRecommendations", parent_endpoint="audio", full_list=True, count=self.session.settings["buffers"]["count_for_audio_buffers"])
self.buffers.append(r_audio) self.buffers.append(r_audio)
self.window.insert_buffer(r_audio.tab, _(u"Recommendations"), self.window.search("audios")) self.window.insert_buffer(r_audio.tab, _(u"Recommendations"), self.window.search("audios"))
albums = buffers.empty(parent=self.window.tb, name="albums")
self.buffers.append(albums)
self.window.insert_buffer(albums.tab, _(u"Albums"), self.window.search("audios"))
people = buffers.empty(parent=self.window.tb, name="people") people = buffers.empty(parent=self.window.tb, name="people")
self.buffers.append(people) self.buffers.append(people)
self.window.add_buffer(people.tab, _(u"People")) self.window.add_buffer(people.tab, _(u"People"))
@ -143,6 +147,7 @@ class Controller(object):
self.window.change_status(_(u"Ready")) self.window.change_status(_(u"Ready"))
for i in self.buffers: for i in self.buffers:
if hasattr(i, "get_items"): if hasattr(i, "get_items"):
# Translators: {0} will be replaced with the name of a buffer.
self.window.change_status(_(u"Loading items for {0}").format(i.name,)) self.window.change_status(_(u"Loading items for {0}").format(i.name,))
i.get_items() i.get_items()
self.window.change_status(_(u"Ready")) self.window.change_status(_(u"Ready"))
@ -215,6 +220,7 @@ class Controller(object):
newbuff = buffers.audioBuffer(parent=self.window.tb, name=u"{0}_audiosearch".format(q.decode("utf-8"),), session=self.session, composefunc="compose_audio", parent_endpoint="audio", endpoint="search", q=q, count=count, auto_complete=auto_complete, lyrics=lyrics, performer_only=performer_only, sort=sort) newbuff = buffers.audioBuffer(parent=self.window.tb, name=u"{0}_audiosearch".format(q.decode("utf-8"),), session=self.session, composefunc="compose_audio", parent_endpoint="audio", endpoint="search", q=q, count=count, auto_complete=auto_complete, lyrics=lyrics, performer_only=performer_only, sort=sort)
self.buffers.append(newbuff) self.buffers.append(newbuff)
call_threaded(newbuff.get_items) call_threaded(newbuff.get_items)
# Translators: {0} will be replaced with the search term.
self.window.insert_buffer(newbuff.tab, _(u"Search for {0}").format(q.decode("utf-8"),), self.window.search("audios")) self.window.insert_buffer(newbuff.tab, _(u"Search for {0}").format(q.decode("utf-8"),), self.window.search("audios"))
def update_status_bar(self, status): def update_status_bar(self, status):
@ -263,12 +269,15 @@ class Controller(object):
return return
if buffertype == "audio": if buffertype == "audio":
buffer = buffers.audioBuffer(parent=self.window.tb, name="{0}_audio".format(user_id,), composefunc="compose_audio", session=self.session, endpoint="get", parent_endpoint="audio", full_list=True, count=self.session.settings["buffers"]["count_for_audio_buffers"], user_id=user_id) buffer = buffers.audioBuffer(parent=self.window.tb, name="{0}_audio".format(user_id,), composefunc="compose_audio", session=self.session, endpoint="get", parent_endpoint="audio", full_list=True, count=self.session.settings["buffers"]["count_for_audio_buffers"], user_id=user_id)
# Translators: {0} will be replaced with an user.
name_ = _(u"{0}'s audios").format(user,) name_ = _(u"{0}'s audios").format(user,)
elif buffertype == "wall": elif buffertype == "wall":
buffer = buffers.feedBuffer(parent=self.window.tb, name="{0}_feed".format(user_id,), composefunc="compose_status", session=self.session, endpoint="get", parent_endpoint="wall", extended=1, count=self.session.settings["buffers"]["count_for_wall_buffers"], owner_id=user_id) buffer = buffers.feedBuffer(parent=self.window.tb, name="{0}_feed".format(user_id,), composefunc="compose_status", session=self.session, endpoint="get", parent_endpoint="wall", extended=1, count=self.session.settings["buffers"]["count_for_wall_buffers"], owner_id=user_id)
# Translators: {0} will be replaced with an user.
name_ = _(u"{0}'s wall posts").format(user,) name_ = _(u"{0}'s wall posts").format(user,)
elif buffertype == "friends": elif buffertype == "friends":
buffer = buffers.peopleBuffer(parent=self.window.tb, name="friends_{0}".format(user_id,), composefunc="compose_person", session=self.session, endpoint="get", parent_endpoint="friends", count=5000, fields="uid, first_name, last_name, last_seen", user_id=user_id) buffer = buffers.peopleBuffer(parent=self.window.tb, name="friends_{0}".format(user_id,), composefunc="compose_person", session=self.session, endpoint="get", parent_endpoint="friends", count=5000, fields="uid, first_name, last_name, last_seen", user_id=user_id)
# Translators: {0} will be replaced with an user.
name_ = _(u"{0}'s friends").format(user,) name_ = _(u"{0}'s friends").format(user,)
self.buffers.append(buffer) self.buffers.append(buffer)
call_threaded(self.complete_buffer_creation, buffer=buffer, name_=name_, position=self.window.search("timelines")) call_threaded(self.complete_buffer_creation, buffer=buffer, name_=name_, position=self.window.search("timelines"))
@ -298,6 +307,7 @@ class Controller(object):
return return
buffer = buffers.chatBuffer(parent=self.window.tb, name="{0}_messages".format(user_id,), composefunc="compose_message", session=self.session, count=200, user_id=user_id, rev=1) buffer = buffers.chatBuffer(parent=self.window.tb, name="{0}_messages".format(user_id,), composefunc="compose_message", session=self.session, count=200, user_id=user_id, rev=1)
self.buffers.append(buffer) self.buffers.append(buffer)
# Translators: {0} will be replaced with an user.
self.window.insert_buffer(buffer.tab, _(u"Chat with {0}").format(self.session.get_user_name(user_id,)), self.window.search("chats")) self.window.insert_buffer(buffer.tab, _(u"Chat with {0}").format(self.session.get_user_name(user_id,)), self.window.search("chats"))
if setfocus: if setfocus:
pos = self.window.search(buffer.name) pos = self.window.search(buffer.name)
@ -353,6 +363,7 @@ class Controller(object):
self.session.audio_albums = albums["items"] self.session.audio_albums = albums["items"]
for i in albums["items"]: for i in albums["items"]:
buffer = buffers.audioBuffer(parent=self.window.tb, name="{0}_audio_album".format(i["id"],), composefunc="compose_audio", session=self.session, endpoint="get", parent_endpoint="audio", full_list=True, count=self.session.settings["buffers"]["count_for_audio_buffers"], user_id=user_id, album_id=i["id"]) buffer = buffers.audioBuffer(parent=self.window.tb, name="{0}_audio_album".format(i["id"],), composefunc="compose_audio", session=self.session, endpoint="get", parent_endpoint="audio", full_list=True, count=self.session.settings["buffers"]["count_for_audio_buffers"], user_id=user_id, album_id=i["id"])
# Translators: {0} Will be replaced with an audio album's title.
name_ = _(u"Album: {0}").format(i["title"],) name_ = _(u"Album: {0}").format(i["title"],)
self.buffers.append(buffer) self.buffers.append(buffer)
self.window.insert_buffer(buffer.tab, name_, self.window.search("albums")) self.window.insert_buffer(buffer.tab, name_, self.window.search("albums"))
@ -367,6 +378,7 @@ class Controller(object):
if response.has_key("album_id") == False: return if response.has_key("album_id") == False: return
album_id = response["album_id"] album_id = response["album_id"]
buffer = buffers.audioBuffer(parent=self.window.tb, name="{0}_audio_album".format(album_id,), composefunc="compose_audio", session=self.session, endpoint="get", parent_endpoint="audio", full_list=True, count=self.session.settings["buffers"]["count_for_audio_buffers"], user_id=self.session.user_id, album_id=album_id) buffer = buffers.audioBuffer(parent=self.window.tb, name="{0}_audio_album".format(album_id,), composefunc="compose_audio", session=self.session, endpoint="get", parent_endpoint="audio", full_list=True, count=self.session.settings["buffers"]["count_for_audio_buffers"], user_id=self.session.user_id, album_id=album_id)
# Translators: {0} will be replaced with an audio album's title.
name_ = _(u"Album: {0}").format(d.get("title"),) name_ = _(u"Album: {0}").format(d.get("title"),)
self.buffers.append(buffer) self.buffers.append(buffer)
self.window.insert_buffer(buffer.tab, name_, self.window.search("albums")) self.window.insert_buffer(buffer.tab, name_, self.window.search("albums"))

View File

@ -34,6 +34,7 @@ class audioPlayer(object):
if self.is_working == False: if self.is_working == False:
self.is_working = True self.is_working = True
self.stream = URLStream(url=url["url"]) self.stream = URLStream(url=url["url"])
# Translators: {0} will be replaced with a song's title and {1} with the artist.
msg = _(u"Playing {0} by {1}").format(url["title"], url["artist"]) msg = _(u"Playing {0} by {1}").format(url["title"], url["artist"])
pub.sendMessage("update-status-bar", status=msg) pub.sendMessage("update-status-bar", status=msg)
self.stream.volume = self.vol/100.0 self.stream.volume = self.vol/100.0

View File

@ -23,6 +23,7 @@ def get_user(id, profiles):
for i in profiles: for i in profiles:
if i["id"] == id: if i["id"] == id:
return u"{0} {1}".format(i["first_name"], i["last_name"]) return u"{0} {1}".format(i["first_name"], i["last_name"])
# Translators: This string is user when socializer can't find the right user information.
return _(u"Unknown username") return _(u"Unknown username")
def add_attachment(attachment): def add_attachment(attachment):
@ -102,9 +103,11 @@ class postController(object):
def get_post_information(self): def get_post_information(self):
from_ = self.session.get_user_name(self.post[self.user_identifier]) from_ = self.session.get_user_name(self.post[self.user_identifier])
if self.post.has_key("copy_history"): if self.post.has_key("copy_history"):
# Translators: {0} will be replaced with an user.
title = _(u"repost from {0}").format(from_,) title = _(u"repost from {0}").format(from_,)
else: else:
if self.post.has_key("from_id") and self.post.has_key("owner_id"): if self.post.has_key("from_id") and self.post.has_key("owner_id"):
# Translators: {0} will be replaced with the user who is posting, and {2} with the wall owner.
title = _(u"Post from {0} in the {1}'s wall").format(self.session.get_user_name(self.post["from_id"]), self.session.get_user_name(self.post["owner_id"])) title = _(u"Post from {0} in the {1}'s wall").format(self.session.get_user_name(self.post["from_id"]), self.session.get_user_name(self.post["owner_id"]))
else: else:
title = _(u"Post from {0}").format(from_,) title = _(u"Post from {0}").format(from_,)

View File

@ -66,6 +66,7 @@ def add_text(status):
def compose_person(status, session): def compose_person(status, session):
if status.has_key("last_seen"): if status.has_key("last_seen"):
original_date = arrow.get(status["last_seen"]["time"]) original_date = arrow.get(status["last_seen"]["time"])
# Translators: This is the date of last seen
last_seen = _(u"{0}").format(original_date.humanize(locale=languageHandler.getLanguage()),) last_seen = _(u"{0}").format(original_date.humanize(locale=languageHandler.getLanguage()),)
elif status.has_key("last_seen") == False and status.has_key("deactivated"): elif status.has_key("last_seen") == False and status.has_key("deactivated"):
last_seen = _(u"Account deactivated") last_seen = _(u"Account deactivated")