Move client.py messages to messages.py

This commit is contained in:
Et0h 2012-12-29 13:23:39 +00:00
parent a5ea8d94ea
commit 61ce659960
2 changed files with 558 additions and 530 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,16 +1,49 @@
en = { en = {
"connecting" : "Attempting to connect to {}:{}"
} # Client notifications
"connection-attempt-notification" : "Attempting to connect to {}:{}", #Port, IP
messages = { "reconnection-attempt-notification" : "Connection with server lost, attempting to reconnect",
"en": en "disconnection-notification" : "Disconnected from server",
} "connection-failed-notification" : "Connection with server failed",
def getMessage(locale, type_): "rewind-notification" : "Rewinded due to time difference with <{}>", #User
if(messages.has_key(locale)): "slowdown-notification" : "Slowing down due to time difference with <{}>", #User
if(messages[locale].has_key(type_)): "revert-notification" : "Reverting speed back to normal",
return messages[locale][type_]
if(messages["en"].has_key(type_)): "pause-notification" : "<{}> paused", #User
return messages["en"][type_] "unpause-notification" : "<{}> unpaused", #User
else: "seek-notification" : "<{}> jumped from {} to {}", #User, from time, to time
"current-offset-notification" : "Current offset: {} seconds", #Offset
"room-join-notification" : "<{}> has joined the room: '{}'", #User
"left-notification" : "<{}> has left", #User
"playing-notification" : "<{}> is playing '{}' ({})", #User, file, duration
"playing-notification/room-addendum" : " in room: '{}'", #Room
"file-different-notification" : "File you are playing appears to be different from <{}>'s", #User
"file-differences-notification" : "Your file differs in the following way(s): ",
"different-filesize-notification" : " (their file size is different from yours!)",
"file-played-by-notification" : "File: {} is being played by:", #User
"notplaying-notification" : "People who are not playing any file:",
# Client prompts
"enter-to-exit-prompt" : "Press enter to exit\n",
# Client errors
"server-timeout-error" : "Connection with server timed out"
}
messages = {
"en": en
}
def getMessage(locale, type_):
if(messages.has_key(locale)):
if(messages[locale].has_key(type_)):
return messages[locale][type_]
if(messages["en"].has_key(type_)):
return messages["en"][type_]
else:
raise KeyError() raise KeyError()