Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reduce strings and rename upgrade message functions #158

Merged
merged 2 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions resources/language/resource.language.en_gb/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,7 @@ msgctxt "#32024"
msgid "Linux: Upgrade using apt"
msgstr ""

# empty strings from id 32025 to 32029

#. Used in OK dialog
msgctxt "#32030"
msgid "A new stable version of Kodi is available."
msgstr ""

#. Direct people to the website. Used in OK dialog
msgctxt "#32031"
msgid "Visit http://kodi.tv for more information."
msgstr ""
# empty strings from id 32025 to 32031

#. Used in OK dialog
msgctxt "#32032"
Expand Down Expand Up @@ -137,3 +127,20 @@ msgstr ""
msgctxt "#32042"
msgid "For more information, see https://kodi.wiki/view/Linux"
msgstr ""

msgctxt "#32043"
msgid "How can I help make Kodi better?"
msgstr ""

msgctxt "#32044"
msgid "Kodi Foundation products are for the users and created by the users. There are no highly paid developers or poorly paid support personnel on the phones ready to take your call. There are only users who have seen a problem and done their best to fix it. This means the Kodi Foundation will always need the contributions of users like you. How can you get involved?"
msgstr ""

msgctxt "#32045"
msgid "Donate"
msgstr ""

msgctxt "#32046"
msgid "Contribute"
msgstr ""

18 changes: 5 additions & 13 deletions resources/lib/version_check/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def dialog_yes_no(line1=0, line2=0):
return xbmcgui.Dialog().yesno(ADDON_NAME, '[CR]'.join([localise(line1), localise(line2)]))


def upgrade_message(msg):
def linux_upgrade_message(msg):
""" Prompt user with upgrade suggestion message

:param msg: string id for prompt message
Expand All @@ -183,7 +183,7 @@ def upgrade_message(msg):
return answer


def upgrade_message2(version_installed, version_available, version_stable, old_version):
def non_linux_upgrade_message(version_installed, version_available, version_stable, old_version):
""" Prompt user with upgrade suggestion message

:param version_installed: currently installed version
Expand Down Expand Up @@ -218,25 +218,17 @@ def upgrade_message2(version_installed, version_available, version_stable, old_v
if ADDON.getSetting('lastnotified_version') == '0.1.24':
ADDON.setSetting('lastnotified_stable', msg_stable)

# Show different dialogs depending if there's a newer stable available.
# Show different dialogs depending on if there's a newer stable available.
# Also split them between xbmc and kodi notifications to reduce possible confusion.
# People will find out once they visit the website.
# For stable only notify once and when there's a newer stable available.
# Ignore any add-on updates as those only count for != stable
if old_version == 'stable' and ADDON.getSetting('lastnotified_stable') != msg_stable:
if xbmcaddon.Addon('xbmc.addon').getAddonInfo('version') < '13.9.0':
xbmcgui.Dialog().ok(ADDON_NAME, '[CR]'.join([msg, localise(32030), localise(32031)]))
else:
xbmcgui.Dialog().ok(ADDON_NAME, '[CR]'.join([msg, localise(32032), localise(32033)]))
xbmcgui.Dialog().ok(ADDON_NAME, '[CR]'.join([msg, localise(32032), localise(32033)]))
ADDON.setSetting('lastnotified_stable', msg_stable)

elif old_version != 'stable' and ADDON.getSetting('lastnotified_version') != msg_available:
if xbmcaddon.Addon('xbmc.addon').getAddonInfo('version') < '13.9.0':
# point them to xbmc.org
xbmcgui.Dialog().ok(ADDON_NAME, '[CR]'.join([msg, localise(32035), localise(32031)]))
else:
# use kodi.tv
xbmcgui.Dialog().ok(ADDON_NAME, '[CR]'.join([msg, localise(32035), localise(32033)]))
xbmcgui.Dialog().ok(ADDON_NAME, '[CR]'.join([msg, localise(32035), localise(32033)]))

ADDON.setSetting('lastnotified_version', msg_available)

Expand Down
8 changes: 4 additions & 4 deletions resources/lib/version_check/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
from .common import wait_for_abort
from .common import message_restart
from .common import message_upgrade_success
from .common import upgrade_message
from .common import upgrade_message2
from .common import linux_upgrade_message
from .common import non_linux_upgrade_message
from .json_interface import get_version_file_list
from .json_interface import get_installed_version
from .versions import compare_version
Expand Down Expand Up @@ -105,7 +105,7 @@ def _version_check_linux(packages):

if handler:
if handler.check_upgrade_available(packages[0]):
if upgrade_message(32012):
if linux_upgrade_message(32012):
if ADDON.getSetting('upgrade_system') == 'false':
result = handler.upgrade_package(packages[0])
else:
Expand Down Expand Up @@ -171,4 +171,4 @@ def run():
else:
old_version, version_installed, version_available, version_stable = _version_check()
if old_version:
upgrade_message2(version_installed, version_available, version_stable, old_version)
non_linux_upgrade_message(version_installed, version_available, version_stable, old_version)
Loading