Change translation function name from _ to translate

This commit is contained in:
TrueTechy 2019-11-25 00:41:37 +00:00
commit 4e179890ec
22 changed files with 195 additions and 195 deletions

View file

@ -11,7 +11,7 @@ import xbmcaddon
import database
from dialogs import context
from helper import _, settings, dialog
from helper import translate, settings, dialog
from downloader import TheVoid
#################################################################################################
@ -19,12 +19,12 @@ from downloader import TheVoid
LOG = logging.getLogger("JELLYFIN." + __name__)
XML_PATH = (xbmcaddon.Addon('plugin.video.jellyfin').getAddonInfo('path'), "default", "1080i")
OPTIONS = {
'Refresh': _(30410),
'Delete': _(30409),
'Addon': _(30408),
'AddFav': _(30405),
'RemoveFav': _(30406),
'Transcode': _(30412)
'Refresh': translate(30410),
'Delete': translate(30409),
'Addon': translate(30408),
'AddFav': translate(30405),
'RemoveFav': translate(30406),
'Transcode': translate(30412)
}
#################################################################################################
@ -163,7 +163,7 @@ class Context(object):
if not settings('skipContextMenu.bool'):
if not dialog("yesno", heading="{jellyfin}", line1=_(33015)):
if not dialog("yesno", heading="{jellyfin}", line1=translate(33015)):
delete = False
if delete:

View file

@ -19,7 +19,7 @@ import client
from database import reset, get_sync, Database, jellyfin_db, get_credentials
from objects import Objects, Actions
from downloader import TheVoid
from helper import _, event, settings, window, dialog, api, JSONRPC
from helper import translate, event, settings, window, dialog, api, JSONRPC
#################################################################################################
@ -146,14 +146,14 @@ def listing():
context = []
if view_id and node in ('movies', 'tvshows', 'musicvideos', 'music', 'mixed') and view_id not in whitelist:
label = "%s %s" % (label.decode('utf-8'), _(33166))
context.append((_(33123), "RunPlugin(plugin://plugin.video.jellyfin/?mode=synclib&id=%s)" % view_id))
label = "%s %s" % (label.decode('utf-8'), translate(33166))
context.append((translate(33123), "RunPlugin(plugin://plugin.video.jellyfin/?mode=synclib&id=%s)" % view_id))
if view_id and node in ('movies', 'tvshows', 'musicvideos', 'music') and view_id in whitelist:
context.append((_(33136), "RunPlugin(plugin://plugin.video.jellyfin/?mode=updatelib&id=%s)" % view_id))
context.append((_(33132), "RunPlugin(plugin://plugin.video.jellyfin/?mode=repairlib&id=%s)" % view_id))
context.append((_(33133), "RunPlugin(plugin://plugin.video.jellyfin/?mode=removelib&id=%s)" % view_id))
context.append((translate(33136), "RunPlugin(plugin://plugin.video.jellyfin/?mode=updatelib&id=%s)" % view_id))
context.append((translate(33132), "RunPlugin(plugin://plugin.video.jellyfin/?mode=repairlib&id=%s)" % view_id))
context.append((translate(33133), "RunPlugin(plugin://plugin.video.jellyfin/?mode=removelib&id=%s)" % view_id))
LOG.debug("--[ listing/%s/%s ] %s", node, label, path)
@ -171,22 +171,22 @@ def listing():
context = []
if server.get('ManualAddress'):
context.append((_(33141), "RunPlugin(plugin://plugin.video.jellyfin/?mode=removeserver&server=%s)" % server['Id']))
context.append((translate(33141), "RunPlugin(plugin://plugin.video.jellyfin/?mode=removeserver&server=%s)" % server['Id']))
if 'AccessToken' not in server:
directory("%s (%s)" % (server['Name'], _(30539)), "plugin://plugin.video.jellyfin/?mode=login&server=%s" % server['Id'], False, context=context)
directory("%s (%s)" % (server['Name'], translate(30539)), "plugin://plugin.video.jellyfin/?mode=login&server=%s" % server['Id'], False, context=context)
else:
directory(server['Name'], "plugin://plugin.video.jellyfin/?mode=browse&server=%s" % server['Id'], context=context)
directory(_(33194), "plugin://plugin.video.jellyfin/?mode=managelibs", True)
directory(_(33134), "plugin://plugin.video.jellyfin/?mode=addserver", False)
directory(_(33054), "plugin://plugin.video.jellyfin/?mode=adduser", False)
directory(_(5), "plugin://plugin.video.jellyfin/?mode=settings", False)
directory(_(33058), "plugin://plugin.video.jellyfin/?mode=reset", False)
directory(_(33192), "plugin://plugin.video.jellyfin/?mode=restartservice", False)
directory(translate(33194), "plugin://plugin.video.jellyfin/?mode=managelibs", True)
directory(translate(33134), "plugin://plugin.video.jellyfin/?mode=addserver", False)
directory(translate(33054), "plugin://plugin.video.jellyfin/?mode=adduser", False)
directory(translate(5), "plugin://plugin.video.jellyfin/?mode=settings", False)
directory(translate(33058), "plugin://plugin.video.jellyfin/?mode=reset", False)
directory(translate(33192), "plugin://plugin.video.jellyfin/?mode=restartservice", False)
if settings('backupPath'):
directory(_(33092), "plugin://plugin.video.jellyfin/?mode=backup", False)
directory(translate(33092), "plugin://plugin.video.jellyfin/?mode=backup", False)
xbmcplugin.setContent(int(sys.argv[1]), 'files')
xbmcplugin.endOfDirectory(int(sys.argv[1]))
@ -220,12 +220,12 @@ def dir_listitem(label, path, artwork=None, fanart=None):
def manage_libraries():
directory(_(33098), "plugin://plugin.video.jellyfin/?mode=refreshboxsets", False)
directory(_(33154), "plugin://plugin.video.jellyfin/?mode=addlibs", False)
directory(_(33139), "plugin://plugin.video.jellyfin/?mode=updatelibs", False)
directory(_(33140), "plugin://plugin.video.jellyfin/?mode=repairlibs", False)
directory(_(33184), "plugin://plugin.video.jellyfin/?mode=removelibs", False)
directory(_(33060), "plugin://plugin.video.jellyfin/?mode=thememedia", False)
directory(translate(33098), "plugin://plugin.video.jellyfin/?mode=refreshboxsets", False)
directory(translate(33154), "plugin://plugin.video.jellyfin/?mode=addlibs", False)
directory(translate(33139), "plugin://plugin.video.jellyfin/?mode=updatelibs", False)
directory(translate(33140), "plugin://plugin.video.jellyfin/?mode=repairlibs", False)
directory(translate(33184), "plugin://plugin.video.jellyfin/?mode=removelibs", False)
directory(translate(33060), "plugin://plugin.video.jellyfin/?mode=thememedia", False)
xbmcplugin.setContent(int(sys.argv[1]), 'files')
xbmcplugin.endOfDirectory(int(sys.argv[1]))
@ -345,9 +345,9 @@ def browse(media, view_id=None, folder=None, server_id=None):
context.append(("Play", "RunPlugin(plugin://plugin.video.jellyfin/?mode=playlist&id=%s&server=%s)" % (item['Id'], server_id)))
if item['UserData']['Played']:
context.append((_(16104), "RunPlugin(plugin://plugin.video.jellyfin/?mode=unwatched&id=%s&server=%s)" % (item['Id'], server_id)))
context.append((translate(16104), "RunPlugin(plugin://plugin.video.jellyfin/?mode=unwatched&id=%s&server=%s)" % (item['Id'], server_id)))
else:
context.append((_(16103), "RunPlugin(plugin://plugin.video.jellyfin/?mode=watched&id=%s&server=%s)" % (item['Id'], server_id)))
context.append((translate(16103), "RunPlugin(plugin://plugin.video.jellyfin/?mode=watched&id=%s&server=%s)" % (item['Id'], server_id)))
li.addContextMenuItems(context)
list_li.append((path, li, True))
@ -373,12 +373,12 @@ def browse(media, view_id=None, folder=None, server_id=None):
}
path = "%s?%s" % ("plugin://plugin.video.jellyfin/", urllib.urlencode(params))
li.setProperty('path', path)
context = [(_(13412), "RunPlugin(plugin://plugin.video.jellyfin/?mode=playlist&id=%s&server=%s)" % (item['Id'], server_id))]
context = [(translate(13412), "RunPlugin(plugin://plugin.video.jellyfin/?mode=playlist&id=%s&server=%s)" % (item['Id'], server_id))]
if item['UserData']['Played']:
context.append((_(16104), "RunPlugin(plugin://plugin.video.jellyfin/?mode=unwatched&id=%s&server=%s)" % (item['Id'], server_id)))
context.append((translate(16104), "RunPlugin(plugin://plugin.video.jellyfin/?mode=unwatched&id=%s&server=%s)" % (item['Id'], server_id)))
else:
context.append((_(16103), "RunPlugin(plugin://plugin.video.jellyfin/?mode=watched&id=%s&server=%s)" % (item['Id'], server_id)))
context.append((translate(16103), "RunPlugin(plugin://plugin.video.jellyfin/?mode=watched&id=%s&server=%s)" % (item['Id'], server_id)))
li.addContextMenuItems(context)
@ -740,14 +740,14 @@ def add_user():
users = TheVoid('GetUsers', {'IsDisabled': False, 'IsHidden': False}).get()
current = session[0]['AdditionalUsers']
result = dialog("select", _(33061), [_(33062), _(33063)] if current else [_(33062)])
result = dialog("select", translate(33061), [translate(33062), translate(33063)] if current else [translate(33062)])
if result < 0:
return
if not result: # Add user
eligible = [x for x in users if x['Id'] not in [current_user['UserId'] for current_user in current]]
resp = dialog("select", _(33064), [x['Name'] for x in eligible])
resp = dialog("select", translate(33064), [x['Name'] for x in eligible])
if resp < 0:
return
@ -755,7 +755,7 @@ def add_user():
user = eligible[resp]
event('AddUser', {'Id': user['Id'], 'Add': True})
else: # Remove user
resp = dialog("select", _(33064), [x['UserName'] for x in current])
resp = dialog("select", translate(33064), [x['UserName'] for x in current])
if resp < 0:
return
@ -786,7 +786,7 @@ def get_themes():
tvtunes.setSetting('custom_path', library)
LOG.info("TV Tunes custom path is enabled and set.")
else:
dialog("ok", heading="{jellyfin}", line1=_(33152))
dialog("ok", heading="{jellyfin}", line1=translate(33152))
return
@ -834,7 +834,7 @@ def get_themes():
tvtunes_nfo(nfo_file, paths)
dialog("notification", heading="{jellyfin}", message=_(33153), icon="{jellyfin}", time=1000, sound=False)
dialog("notification", heading="{jellyfin}", message=translate(33153), icon="{jellyfin}", time=1000, sound=False)
def delete_item():
@ -854,7 +854,7 @@ def backup():
path = settings('backupPath')
folder_name = "Kodi%s.%s" % (xbmc.getInfoLabel('System.BuildVersion')[:2], xbmc.getInfoLabel('System.Date(dd-mm-yy)'))
folder_name = dialog("input", heading=_(33089), defaultt=folder_name)
folder_name = dialog("input", heading=translate(33089), defaultt=folder_name)
if not folder_name:
return
@ -862,7 +862,7 @@ def backup():
backup = os.path.join(path, folder_name)
if xbmcvfs.exists(backup + '/'):
if not dialog("yesno", heading="{jellyfin}", line1=_(33090)):
if not dialog("yesno", heading="{jellyfin}", line1=translate(33090)):
return backup()
@ -875,7 +875,7 @@ def backup():
if not xbmcvfs.mkdirs(path) or not xbmcvfs.mkdirs(destination_databases):
LOG.info("Unable to create all directories")
dialog("notification", heading="{jellyfin}", icon="{jellyfin}", message=_(33165), sound=False)
dialog("notification", heading="{jellyfin}", icon="{jellyfin}", message=translate(33165), sound=False)
return
@ -900,4 +900,4 @@ def backup():
LOG.info("copied %s", filename)
LOG.info("backup completed")
dialog("ok", heading="{jellyfin}", line1="%s %s" % (_(33091), backup))
dialog("ok", heading="{jellyfin}", line1="%s %s" % (translate(33091), backup))

View file

@ -19,7 +19,7 @@ import library
import setup
import monitor
from views import Views, verify_kodi_defaults
from helper import _, window, settings, event, dialog
from helper import translate, window, settings, event, dialog
from jellyfin import Jellyfin
#################################################################################################
@ -116,7 +116,7 @@ class Service(xbmc.Monitor):
if window('jellyfin.restart.bool'):
window('jellyfin.restart', clear=True)
dialog("notification", heading="{jellyfin}", message=_(33193), icon="{jellyfin}", time=1000, sound=False)
dialog("notification", heading="{jellyfin}", message=translate(33193), icon="{jellyfin}", time=1000, sound=False)
raise Exception('RestartService')
@ -183,7 +183,7 @@ class Service(xbmc.Monitor):
users = [user for user in (settings('additionalUsers') or "").decode('utf-8').split(',') if user]
users.insert(0, settings('username').decode('utf-8'))
dialog("notification", heading="{jellyfin}", message="%s %s" % (_(33000), ", ".join(users)),
dialog("notification", heading="{jellyfin}", message="%s %s" % (translate(33000), ", ".join(users)),
icon="{jellyfin}", time=1500, sound=False)
if self.library_thread is None:
@ -196,7 +196,7 @@ class Service(xbmc.Monitor):
if self.warn or data.get('ServerId'):
self.warn = data.get('ServerId') is not None
dialog("notification", heading="{jellyfin}", message=_(33146) if data.get('ServerId') is None else _(33149), icon=xbmcgui.NOTIFICATION_ERROR)
dialog("notification", heading="{jellyfin}", message=translate(33146) if data.get('ServerId') is None else translate(33149), icon=xbmcgui.NOTIFICATION_ERROR)
if data.get('ServerId') is None:
self.stop_default()
@ -207,7 +207,7 @@ class Service(xbmc.Monitor):
self.start_default()
elif method == 'Unauthorized':
dialog("notification", heading="{jellyfin}", message=_(33147) if data['ServerId'] is None else _(33148), icon=xbmcgui.NOTIFICATION_ERROR)
dialog("notification", heading="{jellyfin}", message=translate(33147) if data['ServerId'] is None else translate(33148), icon=xbmcgui.NOTIFICATION_ERROR)
if data.get('ServerId') is None and self.settings['auth_check']:
@ -224,7 +224,7 @@ class Service(xbmc.Monitor):
return
if settings('restartMsg.bool'):
dialog("notification", heading="{jellyfin}", message=_(33006), icon="{jellyfin}")
dialog("notification", heading="{jellyfin}", message=translate(33006), icon="{jellyfin}")
self.stop_default()
@ -249,7 +249,7 @@ class Service(xbmc.Monitor):
elif method == 'UpdateServer':
dialog("ok", heading="{jellyfin}", line1=_(33151))
dialog("ok", heading="{jellyfin}", line1=translate(33151))
self.connect.setup_manual_server()
elif method == 'UserDataChanged' and self.library_thread:
@ -383,13 +383,13 @@ class Service(xbmc.Monitor):
if not self.settings.get('mode_warn'):
self.settings['mode_warn'] = True
dialog("yesno", heading="{jellyfin}", line1=_(33118))
dialog("yesno", heading="{jellyfin}", line1=translate(33118))
if settings('kodiCompanion.bool') != self.settings['kodi_companion']:
self.settings['kodi_companion'] = settings('kodiCompanion.bool')
if not self.settings['kodi_companion']:
dialog("ok", heading="{jellyfin}", line1=_(33138))
dialog("ok", heading="{jellyfin}", line1=translate(33138))
def reload_objects(self):