Skip to content

Commit

Permalink
Language
Browse files Browse the repository at this point in the history
Now with Spanish support
  • Loading branch information
daviddavo committed Dec 23, 2016
1 parent 5e22ff0 commit b4ade1d
Show file tree
Hide file tree
Showing 6 changed files with 169 additions and 11 deletions.
75 changes: 75 additions & 0 deletions resources/language/English/strings.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Kodi Media Center language file
# Addon Name: Simkl TV Tracker
# Addon id: script.services.simkl

msgid ""
msgstr ""
"Project-Id-Version: Kodi Addons\n"
"Report-Msgid-Bugs-To: alanwww1@xbmc.org\n"
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: David Davó\n"
"Language-Team: English\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: en\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#Settings

msgctxt "#32001"
msgid "Please click to Log In"
msgstr ""

msgctxt "#32002"
msgid "Other options"
msgstr ""

msgctxt "#32003"
msgid "Sync library"
msgstr ""

msgctxt "#32006"
msgid "Scrobble at percentage"
msgstr ""

msgctxt "#32007"
msgid "Checkin percentage"
msgstr ""

msgctxt "#32008"
msgid "Show bubble when scrobbled"
msgstr ""

#Up to 32020 to settings. 32021-2024 to login dialog

msgctxt "#32021"
msgid "Simkl login"
msgstr ""

msgctxt "#32022"
msgid "Enter to the following URL: {}"
msgstr ""

msgctxt "#32023"
msgcid "Remaining time: {}/{}"
msgstr ""

# Blahblahblah

msgctxt "#32025"
msgid "Hello again, {}"
msgstr ""

msgctxt "#32026"
msgid "Please Log In in addon settings"
msgstr ""

msgctxt "#32027"
msgid "You don't have internet"
msgstr ""

#msgctxt "#"
#msgid ""
#msgstr ""
75 changes: 75 additions & 0 deletions resources/language/Spanish/strings.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Kodi Media Center language file
# Addon Name: Simkl TV Tracker
# Addon id: script.services.simkl

msgid ""
msgstr ""
"Project-Id-Version: Kodi Addons\n"
"Report-Msgid-Bugs-To: alanwww1@xbmc.org\n"
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: David Davó\n"
"Language-Team: Spanish\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#Settings

msgctxt "#32001"
msgid "Please click to Log In"
msgstr "Por favor haz click para iniciar sesión"

msgctxt "#32002"
msgid "Other options"
msgstr "Otras opciones"

msgctxt "#32003"
msgid "Sync library"
msgstr "Sincronizar librerías"

msgctxt "#32006"
msgid "Scrobble at percentage"
msgstr "Scrobble al llegar a..."

msgctxt "#32007"
msgid "Checkin percentage"
msgstr "Checkin al llegar a..."

msgctxt "#32008"
msgid "Show bubble when scrobbled"
msgstr "Mostrar notificación al scrobble"

#Up to 32020 to settings

msgctxt "#32021"
msgid "Simkl login"
msgstr "Inicio de sesión en Simkl"

msgctxt "#32022"
msgid "Enter to the following URL: {}"
msgstr "Entra a la siguiente URL: {}"

msgctxt "#32023"
msgcid "Remaining time: {}/{}"
msgstr "Tiempo restante: {}/{}"

# Blahblahblah

msgctxt "#32025"
msgid "Hello again, {}"
msgstr "Hola de nuevo, {}"

msgctxt "#32026"
msgid "Please Log In in addon settings"
msgstr "Por favor inicia sesión en la configuración del addon"

msgctxt "#32027"
msgid "You don't have internet"
msgstr "No tienes conexión a internet"

#msgctxt "#"
#msgid ""
#msgstr ""
8 changes: 5 additions & 3 deletions resources/lib/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

__addon__ = xbmcaddon.Addon("script.service.simkl")
__icon__ = __addon__.getAddonInfo("icon")
def getstr(id): return __addon__.getLocalizedString(id)

xbmc.log("Simkl: Icon: "+str(__icon__))

not_dialog = xbmcgui.Dialog()
Expand All @@ -19,13 +21,13 @@ def __init__(self, url, pin, check_login, log, exp=900, inter=5, api=None):
#TODO: If user is loged in, show a confirmation dialog
API = api
self.dialog = xbmcgui.DialogProgress()
self.dialog.create("Simkl login",
"Enter to the following URL: {}".format(url), "PIN: {}".format(pin))
self.dialog.create(getstr(32021),
getstr(32022).format(url), "PIN: {}".format(pin))
waiting = True
cnt = 0
while waiting:
pct = min(max(1, int( round( cnt*100 / exp, 0))), 99)
self.dialog.update(pct, line3="Remaining time: {}/{}".format(
self.dialog.update(pct, line3=getstr(32023).format(
str(cnt).zfill(3), exp))

if cnt % (inter+1) == 0 and cnt>1:
Expand Down
4 changes: 3 additions & 1 deletion resources/lib/simklapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import interface
import httplib

def getstr(id): return interface.getstr(id)

REDIRECT_URI = "http://simkl.com"
USERFILE = xbmc.translatePath("special://profile/simkl_key")
if not os.path.exists(USERFILE):
Expand Down Expand Up @@ -46,7 +48,7 @@ def __init__(self):
api.login()
except Exception:
xbmc.log("Simkl: {}".format("No INTERNET"))
interface.notify("You don't have internet")
interface.notify(getstr(32027))
self.internet = False

def login(self):
Expand Down
12 changes: 7 additions & 5 deletions resources/settings.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings>
<category label="LogIn">
<setting label="Please click to log in" type="action" action="RunScript(special://home/addons/script.service.simkl/resources/lib/simklapi.py, login, special://xbmc/)"/>
<setting label="32001" type="action" action="RunScript(special://home/addons/script.service.simkl/resources/lib/simklapi.py, login, special://xbmc/)"/>
</category>
<setting type="sep"/>
<category label="Options">
<setting label="Other options" type="lsep"/>
<setting label="Sync library" type="bool" id="synclib" default="false" enable="false"/>
<setting label="32002" type="lsep"/>
<setting label="32003" type="bool" id="synclib" default="false" enable="false"/>
<setting label="Scrobbler" type="lsep"/>
<setting label="Auto-scrobble" type="bool" id="autoscrobble" default="true"/>
<setting label="Scrobble at percentage" type="slider" id="scr-pct" default="70" range="0,100" option="percent" enable="gt(-1,-2)" />
<setting label="Checkin percentage" type="slider" id="sct-w-pct" default="10" range="0,100" option="percent"/>
<setting label="32006" type="slider" id="scr-pct" default="70" range="0,100" option="percent" enable="gt(-1,-2)" />
<setting label="32007" type="slider" id="sct-w-pct" default="10" range="0,100" option="
percent"/>
<setting label="32008" type="bool" id="bubble" default="false" enable="false"/>
</category>
</settings>
6 changes: 4 additions & 2 deletions service.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
from resources.lib import simklapi as API

simkl_addon = xbmcaddon.Addon()
interface.__addon__ = simkl_addon
autoscrobble = simkl_addon.getSetting("autoscrobble")
def getstr(id): return simkl_addon.getLocalizedString(id)

if __name__ == "__main__":
xbmc.log("Simkl dir: " + str(xbmc.translatePath("special://home")))
Expand All @@ -26,9 +28,9 @@
#Remember: if getTime() is more than x% scrobble file

if not API.api.is_user_logged():
interface.notify("Please Log In in addon settings")
interface.notify(getstr(32026))
else:
interface.notify("Hello again {}".format(API.api.USERSETTINGS["user"]["name"]))
interface.notify(getstr(32025).format(API.api.USERSETTINGS["user"]["name"]))

while not monitor.abortRequested():
if monitor.waitForAbort(60):
Expand Down

0 comments on commit b4ade1d

Please sign in to comment.