From c1dfc3ac1fdc0d873281e498e6690588251c665c Mon Sep 17 00:00:00 2001 From: Athanasius Date: Wed, 26 Aug 2020 14:13:06 +0100 Subject: [PATCH] Plugins "Not Python 3.x": Hacky escaping fix so translations work --- EDMarketConnector.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/EDMarketConnector.py b/EDMarketConnector.py index 8867dfbf..dc1bdd16 100755 --- a/EDMarketConnector.py +++ b/EDMarketConnector.py @@ -949,9 +949,26 @@ if __name__ == "__main__": def messagebox_not_py3(): plugins_not_py3_last = config.getint('plugins_not_py3_last') or 0 if (plugins_not_py3_last + 86400) < int(time()) and len(plug.PLUGINS_not_py3): + # Yes, this is horribly hacky so as to be sure we match the key + # that we told Translators to use. + popup_text = "One or more of your enabled plugins do not yet have support for Python 3.x. Please see the " \ + "list on the '{PLUGINS}' tab of '{FILE}' > '{SETTINGS}'. You should check if there is an " \ + "updated version available, else alert the developer that they need to update the code for " \ + "Python 3.x.\r\n\r\nYou can disable a plugin by renaming its folder to have '{DISABLED}' on " \ + "the end of the name." + popup_text = popup_text.replace('\n', '\\n') + popup_text = popup_text.replace('\r', '\\r') + # Now the string should match, so try translation + popup_text = _(popup_text) + # And substitute in the other words. + popup_text.format(PLUGINS=_('Plugins'), FILE=_('File'), SETTINGS=_('Settings'), DISABLED='.disabled') + # And now we do need these to be actual \r\n + popup_text = popup_text.replace('\\n', '\n') + popup_text = popup_text.replace('\\r', '\r') + tk.messagebox.showinfo( _('EDMC: Plugins Without Python 3.x Support'), - _("One or more of your enabled plugins do not yet have support for Python 3.x. Please see the list on the '{PLUGINS}' tab of '{FILE}' > '{SETTINGS}'. You should check if there is an updated version available, else alert the developer that they need to update the code for Python 3.x.\r\n\r\nYou can disable a plugin by renaming its folder to have '{DISABLED}' on the end of the name.".format(PLUGINS=_('Plugins'), FILE=_('File'), SETTINGS=_('Settings'), DISABLED='.disabled')) + popup_text ) config.set('plugins_not_py3_last', int(time()))