mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
migrate strings with trailing newlines to fluent
This commit is contained in:
parent
f4d38f579d
commit
43f5d13ed6
11 changed files with 45 additions and 39 deletions
|
@ -26,7 +26,7 @@ from anki.lang import _, ngettext
|
||||||
from anki.media import MediaManager
|
from anki.media import MediaManager
|
||||||
from anki.models import ModelManager, NoteType, Template
|
from anki.models import ModelManager, NoteType, Template
|
||||||
from anki.notes import Note
|
from anki.notes import Note
|
||||||
from anki.rsbackend import RustBackend
|
from anki.rsbackend import TR, RustBackend
|
||||||
from anki.sched import Scheduler as V1Scheduler
|
from anki.sched import Scheduler as V1Scheduler
|
||||||
from anki.schedv2 import Scheduler as V2Scheduler
|
from anki.schedv2 import Scheduler as V2Scheduler
|
||||||
from anki.tags import TagManager
|
from anki.tags import TagManager
|
||||||
|
@ -580,9 +580,11 @@ select group_concat(ord+1), count(), flds from cards c, notes n
|
||||||
where c.nid = n.id and c.id in %s group by nid"""
|
where c.nid = n.id and c.id in %s group by nid"""
|
||||||
% ids2str(cids)
|
% ids2str(cids)
|
||||||
):
|
):
|
||||||
rep += _("Empty card numbers: %(c)s\nFields: %(f)s\n\n") % dict(
|
rep += self.tr(
|
||||||
c=ords, f=flds.replace("\x1f", " / ")
|
TR.EMPTY_CARDS_CARD_LINE,
|
||||||
|
**{"card-numbers": ords, "fields": flds.replace("\x1f", " / ")},
|
||||||
)
|
)
|
||||||
|
rep += "\n\n"
|
||||||
return rep
|
return rep
|
||||||
|
|
||||||
# Field checksums and sorting fields
|
# Field checksums and sorting fields
|
||||||
|
|
|
@ -28,6 +28,7 @@ from anki.httpclient import HttpClient
|
||||||
from anki.lang import _, ngettext
|
from anki.lang import _, ngettext
|
||||||
from aqt.qt import *
|
from aqt.qt import *
|
||||||
from aqt.utils import (
|
from aqt.utils import (
|
||||||
|
TR,
|
||||||
askUser,
|
askUser,
|
||||||
getFile,
|
getFile,
|
||||||
isWin,
|
isWin,
|
||||||
|
@ -40,6 +41,7 @@ from aqt.utils import (
|
||||||
showInfo,
|
showInfo,
|
||||||
showWarning,
|
showWarning,
|
||||||
tooltip,
|
tooltip,
|
||||||
|
tr,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -205,16 +207,11 @@ class AddonManager:
|
||||||
__import__(addon.dir_name)
|
__import__(addon.dir_name)
|
||||||
except:
|
except:
|
||||||
showWarning(
|
showWarning(
|
||||||
_(
|
tr(
|
||||||
"""\
|
TR.ADDONS_FAILED_TO_LOAD,
|
||||||
An add-on you installed failed to load. If problems persist, please \
|
name=addon.human_name(),
|
||||||
go to the Tools>Add-ons menu, and disable or delete the add-on.
|
traceback=traceback.format_exc(),
|
||||||
|
|
||||||
When loading '%(name)s':
|
|
||||||
%(traceback)s
|
|
||||||
"""
|
|
||||||
)
|
)
|
||||||
% dict(name=addon.human_name(), traceback=traceback.format_exc())
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def onAddonsDialog(self):
|
def onAddonsDialog(self):
|
||||||
|
|
|
@ -128,7 +128,7 @@ your system's temporary folder may be incorrect."""
|
||||||
addons = [
|
addons = [
|
||||||
mw.addonManager.addonName(i) for i in dict.fromkeys(reversed(matches))
|
mw.addonManager.addonName(i) for i in dict.fromkeys(reversed(matches))
|
||||||
]
|
]
|
||||||
txt = _("""Add-ons possibly involved: {}\n""")
|
|
||||||
# highlight importance of first add-on:
|
# highlight importance of first add-on:
|
||||||
addons[0] = "<b>{}</b>".format(addons[0])
|
addons[0] = "<b>{}</b>".format(addons[0])
|
||||||
return txt.format(", ".join(addons))
|
addons_str = ", ".join(addons)
|
||||||
|
return tr(TR.ADDONS_POSSIBLY_INVOLVED, addons=addons_str) + "\n"
|
||||||
|
|
|
@ -18,6 +18,7 @@ from anki.lang import _, ngettext
|
||||||
from aqt import AnkiQt, gui_hooks
|
from aqt import AnkiQt, gui_hooks
|
||||||
from aqt.qt import *
|
from aqt.qt import *
|
||||||
from aqt.utils import (
|
from aqt.utils import (
|
||||||
|
TR,
|
||||||
askUser,
|
askUser,
|
||||||
getFile,
|
getFile,
|
||||||
getOnlyText,
|
getOnlyText,
|
||||||
|
@ -26,6 +27,7 @@ from aqt.utils import (
|
||||||
showText,
|
showText,
|
||||||
showWarning,
|
showWarning,
|
||||||
tooltip,
|
tooltip,
|
||||||
|
tr,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -196,7 +198,7 @@ you can enter it here. Use \\t to represent tab."""
|
||||||
showUnicodeWarning()
|
showUnicodeWarning()
|
||||||
return
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
msg = _("Import failed.\n")
|
msg = tr(TR.IMPORTING_FAILED_DEBUG_INFO) + "\n"
|
||||||
err = repr(str(e))
|
err = repr(str(e))
|
||||||
if "1-character string" in err:
|
if "1-character string" in err:
|
||||||
msg += err
|
msg += err
|
||||||
|
@ -360,7 +362,7 @@ def importFile(mw, file):
|
||||||
if msg == "'unknownFormat'":
|
if msg == "'unknownFormat'":
|
||||||
showWarning(_("Unknown file format."))
|
showWarning(_("Unknown file format."))
|
||||||
else:
|
else:
|
||||||
msg = _("Import failed. Debugging info:\n")
|
msg = tr(TR.IMPORTING_FAILED_DEBUG_INFO) + "\n"
|
||||||
msg += str(traceback.format_exc())
|
msg += str(traceback.format_exc())
|
||||||
showText(msg)
|
showText(msg)
|
||||||
return
|
return
|
||||||
|
@ -405,7 +407,7 @@ Unable to import from a read-only file."""
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
msg = _("Import failed.\n")
|
msg = tr(TR.IMPORTING_FAILED_DEBUG_INFO) + "\n"
|
||||||
msg += str(traceback.format_exc())
|
msg += str(traceback.format_exc())
|
||||||
showText(msg)
|
showText(msg)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -42,6 +42,7 @@ from aqt.qt import sip
|
||||||
from aqt.taskman import TaskManager
|
from aqt.taskman import TaskManager
|
||||||
from aqt.theme import theme_manager
|
from aqt.theme import theme_manager
|
||||||
from aqt.utils import (
|
from aqt.utils import (
|
||||||
|
TR,
|
||||||
askUser,
|
askUser,
|
||||||
checkInvalidFilename,
|
checkInvalidFilename,
|
||||||
getFile,
|
getFile,
|
||||||
|
@ -55,6 +56,7 @@ from aqt.utils import (
|
||||||
showText,
|
showText,
|
||||||
showWarning,
|
showWarning,
|
||||||
tooltip,
|
tooltip,
|
||||||
|
tr,
|
||||||
)
|
)
|
||||||
|
|
||||||
install_pylib_legacy()
|
install_pylib_legacy()
|
||||||
|
@ -439,16 +441,7 @@ close the profile or restart Anki."""
|
||||||
return self._loadCollection()
|
return self._loadCollection()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
showWarning(
|
showWarning(
|
||||||
_(
|
tr(TR.ERRORS_UNABLE_OPEN_COLLECTION) + "\n" + traceback.format_exc()
|
||||||
"""\
|
|
||||||
Anki was unable to open your collection file. If problems persist after \
|
|
||||||
restarting your computer, please use the Open Backup button in the profile \
|
|
||||||
manager.
|
|
||||||
|
|
||||||
Debug info:
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
+ traceback.format_exc()
|
|
||||||
)
|
)
|
||||||
# clean up open collection if possible
|
# clean up open collection if possible
|
||||||
if self.col:
|
if self.col:
|
||||||
|
|
|
@ -19,11 +19,11 @@ import anki.lang
|
||||||
import aqt.forms
|
import aqt.forms
|
||||||
import aqt.sound
|
import aqt.sound
|
||||||
from anki.db import DB
|
from anki.db import DB
|
||||||
from anki.lang import _
|
from anki.lang import _, without_unicode_isolation
|
||||||
from anki.utils import intTime, isMac, isWin
|
from anki.utils import intTime, isMac, isWin
|
||||||
from aqt import appHelpSite
|
from aqt import appHelpSite
|
||||||
from aqt.qt import *
|
from aqt.qt import *
|
||||||
from aqt.utils import locale_dir, showWarning
|
from aqt.utils import TR, locale_dir, showWarning, tr
|
||||||
|
|
||||||
metaConf = dict(
|
metaConf = dict(
|
||||||
ver=0,
|
ver=0,
|
||||||
|
@ -375,16 +375,9 @@ create table if not exists profiles
|
||||||
self.create(_("User 1"))
|
self.create(_("User 1"))
|
||||||
p = os.path.join(self.base, "README.txt")
|
p = os.path.join(self.base, "README.txt")
|
||||||
open(p, "w", encoding="utf8").write(
|
open(p, "w", encoding="utf8").write(
|
||||||
_(
|
without_unicode_isolation(
|
||||||
"""\
|
tr(TR.PROFILES_FOLDER_README, link=appHelpSite + "#startupopts")
|
||||||
This folder stores all of your Anki data in a single location,
|
|
||||||
to make backups easy. To tell Anki to use a different location,
|
|
||||||
please see:
|
|
||||||
|
|
||||||
%s
|
|
||||||
"""
|
|
||||||
)
|
)
|
||||||
% (appHelpSite + "#startupopts")
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Default language
|
# Default language
|
||||||
|
|
6
qt/ftl/addons.ftl
Normal file
6
qt/ftl/addons.ftl
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
addons-possibly-involved = Add-ons possibly involved: { $addons }
|
||||||
|
addons-failed-to-load =
|
||||||
|
An add-on you installed failed to load. If problems persist, please go to the Tools>Add-ons menu, and disable or delete the add-on.
|
||||||
|
|
||||||
|
When loading '{$name}':
|
||||||
|
{$traceback}
|
|
@ -36,4 +36,7 @@ errors-accessing-db =
|
||||||
- Your hard disk may have errors.
|
- Your hard disk may have errors.
|
||||||
|
|
||||||
It's a good idea to run Tools>Check Database to ensure your collection is not corrupt.
|
It's a good idea to run Tools>Check Database to ensure your collection is not corrupt.
|
||||||
|
errors-unable-open-collection =
|
||||||
|
Anki was unable to open your collection file. If problems persist after restarting your computer, please use the Open Backup button in the profile manager.
|
||||||
|
|
||||||
|
Debug info:
|
||||||
|
|
6
qt/ftl/profiles.ftl
Normal file
6
qt/ftl/profiles.ftl
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
profiles-folder-readme =
|
||||||
|
This folder stores all of your Anki data in a single location,
|
||||||
|
to make backups easy. To tell Anki to use a different location,
|
||||||
|
please see:
|
||||||
|
|
||||||
|
{$link}
|
3
rslib/ftl/empty-cards.ftl
Normal file
3
rslib/ftl/empty-cards.ftl
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
empty-cards-card-line =
|
||||||
|
Empty card numbers: {$card-numbers}
|
||||||
|
Fields: {$fields}
|
1
rslib/ftl/importing.ftl
Normal file
1
rslib/ftl/importing.ftl
Normal file
|
@ -0,0 +1 @@
|
||||||
|
importing-failed-debug-info = Import failed. Debugging info:
|
Loading…
Reference in a new issue