move the big error message into FTL
this works around the issue Pontoon has with saving translations with trailing newlines, and makes it easier for translators to update in the future, as the errors are now using markdown
This commit is contained in:
parent
7230b6e390
commit
703b9da09c
@ -6,10 +6,12 @@ import re
|
|||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
|
from markdown import markdown
|
||||||
|
|
||||||
from anki.lang import _
|
from anki.lang import _
|
||||||
from aqt import mw
|
from aqt import mw
|
||||||
from aqt.qt import *
|
from aqt.qt import *
|
||||||
from aqt.utils import showText, showWarning, supportText
|
from aqt.utils import FString, showText, showWarning, supportText, tr
|
||||||
|
|
||||||
if not os.environ.get("DEBUG"):
|
if not os.environ.get("DEBUG"):
|
||||||
|
|
||||||
@ -80,8 +82,6 @@ your system's temporary folder may be incorrect."""
|
|||||||
"Your firewall or antivirus program is preventing Anki from creating a connection to itself. Please add an exception for Anki."
|
"Your firewall or antivirus program is preventing Anki from creating a connection to itself. Please add an exception for Anki."
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if "Pyaudio not" in error:
|
|
||||||
return showWarning(_("Please install PyAudio"))
|
|
||||||
if "install mplayer" in error:
|
if "install mplayer" in error:
|
||||||
return showWarning(
|
return showWarning(
|
||||||
_(
|
_(
|
||||||
@ -106,62 +106,14 @@ your system's temporary folder may be incorrect."""
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
if "disk I/O error" in error:
|
if "disk I/O error" in error:
|
||||||
return showWarning(
|
showWarning(markdown(tr(FString.ERRORS_ACCESSING_DB)))
|
||||||
_(
|
return
|
||||||
"""\
|
|
||||||
An error occurred while accessing the database.
|
|
||||||
|
|
||||||
Possible causes:
|
|
||||||
|
|
||||||
- Antivirus, firewall, backup, or synchronization software may be \
|
|
||||||
interfering with Anki. Try disabling such software and see if the \
|
|
||||||
problem goes away.
|
|
||||||
- Your disk may be full.
|
|
||||||
- The Documents/Anki folder may be on a network drive.
|
|
||||||
- Files in the Documents/Anki folder may not be writeable.
|
|
||||||
- Your hard disk may have errors.
|
|
||||||
|
|
||||||
It's a good idea to run Tools>Check Database to ensure your collection \
|
|
||||||
is not corrupt.
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
stdText = _(
|
|
||||||
"""\
|
|
||||||
<h1>Error</h1>
|
|
||||||
|
|
||||||
<p>An error occurred. Please use <b>Tools > Check Database</b> to see if \
|
|
||||||
that fixes the problem.</p>
|
|
||||||
|
|
||||||
<p>If problems persist, please report the problem on our \
|
|
||||||
<a href="https://help.ankiweb.net">support site</a>. Please copy and paste \
|
|
||||||
the information below into your report.</p>"""
|
|
||||||
)
|
|
||||||
|
|
||||||
pluginText = _(
|
|
||||||
"""\
|
|
||||||
<h1>Error</h1>
|
|
||||||
|
|
||||||
<p>An error occurred. Please start Anki while holding down the shift \
|
|
||||||
key, which will temporarily disable the add-ons you have installed.</p>
|
|
||||||
|
|
||||||
<p>If the issue only occurs when add-ons are enabled, please use the \
|
|
||||||
Tools>Add-ons menu item to disable some add-ons and restart Anki, \
|
|
||||||
repeating until you discover the add-on that is causing the problem.</p>
|
|
||||||
|
|
||||||
<p>When you've discovered the add-on that is causing the problem, please \
|
|
||||||
report the issue on the <a href="https://help.ankiweb.net/discussions/add-ons/">\
|
|
||||||
add-ons section</a> of our support site.
|
|
||||||
|
|
||||||
<p>Debug info:</p>
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
if self.mw.addonManager.dirty:
|
if self.mw.addonManager.dirty:
|
||||||
txt = pluginText
|
txt = markdown(tr(FString.ERRORS_ADDONS_ACTIVE_POPUP))
|
||||||
error = supportText() + self._addonText(error) + "\n" + error
|
error = supportText() + self._addonText(error) + "\n" + error
|
||||||
else:
|
else:
|
||||||
txt = stdText
|
txt = markdown(tr(FString.ERRORS_STANDARD_POPUP))
|
||||||
error = supportText() + "\n" + error
|
error = supportText() + "\n" + error
|
||||||
|
|
||||||
# show dialog
|
# show dialog
|
||||||
|
39
qt/ftl/errors.ftl
Normal file
39
qt/ftl/errors.ftl
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
-errors-support-site = [support site](https://help.ankiweb.net)
|
||||||
|
errors-standard-popup =
|
||||||
|
# Error
|
||||||
|
|
||||||
|
An error occurred. Please use **Tools > Check Database** to see if
|
||||||
|
that fixes the problem.
|
||||||
|
|
||||||
|
If problems persist, please report the problem on our { -errors-support-site }.
|
||||||
|
Please copy and paste the information below into your report.
|
||||||
|
-errors-addon-support-site = [add-on support site](https://help.ankiweb.net/discussions/add-ons/)
|
||||||
|
errors-addons-active-popup =
|
||||||
|
# Error
|
||||||
|
|
||||||
|
An error occurred. Please start Anki while holding down the shift key,
|
||||||
|
which will temporarily disable the add-ons you have installed.
|
||||||
|
|
||||||
|
If the issue only occurs when add-ons are enabled, please use the
|
||||||
|
Tools > Add-ons menu item to disable some add-ons and restart Anki,
|
||||||
|
repeating until you discover the add-on that is causing the problem.
|
||||||
|
|
||||||
|
When you've discovered the add-on that is causing the problem, please
|
||||||
|
report the issue on the { -errors-addon-support-site }.
|
||||||
|
|
||||||
|
Debug info:
|
||||||
|
errors-accessing-db =
|
||||||
|
An error occurred while accessing the database.
|
||||||
|
|
||||||
|
Possible causes:
|
||||||
|
|
||||||
|
- Antivirus, firewall, backup, or synchronization software may be
|
||||||
|
interfering with Anki. Try disabling such software and see if the
|
||||||
|
problem goes away.
|
||||||
|
- Your disk may be full.
|
||||||
|
- The Documents/Anki folder may be on a network drive.
|
||||||
|
- Files in the Documents/Anki folder may not be writeable.
|
||||||
|
- Your hard disk may have errors.
|
||||||
|
|
||||||
|
It's a good idea to run Tools>Check Database to ensure your collection is not corrupt.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user