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

@ -1,4 +1,4 @@
from translate import _
from translate import translate
from exceptions import LibraryException
from utils import addon_id

View file

@ -15,7 +15,7 @@ import client
import requests
from downloader import TheVoid
from . import _, settings, window, dialog
from . import translate, settings, window, dialog
#################################################################################################
@ -111,7 +111,7 @@ class PlayUtils(object):
for source in sources:
selection.append(source.get('Name', "na"))
resp = dialog("select", _(33130), selection)
resp = dialog("select", translate(33130), selection)
if resp > -1:
source = sources[resp]
@ -581,7 +581,7 @@ class PlayUtils(object):
if len(audio_streams) > 1:
selection = list(audio_streams.keys())
resp = dialog("select", _(33013), selection)
resp = dialog("select", translate(33013), selection)
audio_selected = audio_streams[selection[resp]] if resp else source['DefaultAudioStreamIndex']
else: # Only one choice
audio_selected = audio_streams[next(iter(audio_streams))]
@ -608,7 +608,7 @@ class PlayUtils(object):
elif skip_dialog in (0, 2) and len(subs_streams):
selection = list(['No subtitles']) + list(subs_streams.keys())
resp = dialog("select", _(33014), selection)
resp = dialog("select", translate(33014), selection)
if resp:
index = subs_streams[selection[resp]] if resp > -1 else source.get('DefaultSubtitleStreamIndex')

View file

@ -14,7 +14,7 @@ LOG = logging.getLogger('JELLYFIN.' + __name__)
##################################################################################################
def _(string):
def translate(string):
''' Get add-on string. Returns in unicode.
'''

View file

@ -19,7 +19,7 @@ import xbmcaddon
import xbmcgui
import xbmcvfs
from translate import _
from translate import translate
#################################################################################################
@ -154,7 +154,7 @@ def dialog(dialog_type, *args, **kwargs):
"special://home/addons/plugin.video.jellyfin/resources/icon.png"
)
if "heading" in kwargs:
kwargs['heading'] = kwargs['heading'].replace("{jellyfin}", _('addon_name'))
kwargs['heading'] = kwargs['heading'].replace("{jellyfin}", translate('addon_name'))
types = {
'yesno': d.yesno,
@ -250,7 +250,7 @@ def validate(path):
if not xbmcvfs.exists(path):
LOG.info("Could not find %s", path)
if dialog("yesno", heading="{jellyfin}", line1="%s %s. %s" % (_(33047), path, _(33048))):
if dialog("yesno", heading="{jellyfin}", line1="%s %s. %s" % (translate(33047), path, translate(33048))):
return False

View file

@ -8,7 +8,7 @@ import xbmcgui
from .utils import should_stop
from .exceptions import LibraryException
from .translate import _
from .translate import translate
#################################################################################################
@ -28,10 +28,10 @@ def progress(message=None):
if item and type(item) == dict:
dialog.create(_('addon_name'), "%s %s" % (_('gathering'), item['Name']))
dialog.create(translate('addon_name'), "%s %s" % (translate('gathering'), item['Name']))
LOG.info("Processing %s: %s", item['Name'], item['Id'])
else:
dialog.create(_('addon_name'), message)
dialog.create(translate('addon_name'), message)
LOG.info("Processing %s", message)
if item:

View file

@ -8,7 +8,7 @@ import xml.etree.ElementTree as etree
import xbmc
from . import _, indent, write_xml, dialog, settings
from . import translate, indent, write_xml, dialog, settings
#################################################################################################
@ -127,7 +127,7 @@ def advanced_settings():
indent(xml)
write_xml(etree.tostring(xml, 'UTF-8'), path)
dialog("ok", heading="{jellyfin}", line1=_(33097))
dialog("ok", heading="{jellyfin}", line1=translate(33097))
xbmc.executebuiltin('RestartApp')
return True