mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
fix missing translations in export screen
https://forums.ankiweb.net/t/untranslated-strings/1623
This commit is contained in:
parent
469272659f
commit
2bcf9a82d1
1 changed files with 12 additions and 8 deletions
|
@ -8,7 +8,7 @@ import shutil
|
||||||
import unicodedata
|
import unicodedata
|
||||||
import zipfile
|
import zipfile
|
||||||
from io import BufferedWriter
|
from io import BufferedWriter
|
||||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
|
||||||
from zipfile import ZipFile
|
from zipfile import ZipFile
|
||||||
|
|
||||||
from anki import hooks
|
from anki import hooks
|
||||||
|
@ -20,7 +20,7 @@ from anki.utils import ids2str, namedtmp, splitFields, stripHTML
|
||||||
class Exporter:
|
class Exporter:
|
||||||
includeHTML: Union[bool, None] = None
|
includeHTML: Union[bool, None] = None
|
||||||
ext: Optional[str] = None
|
ext: Optional[str] = None
|
||||||
key: Optional[str] = None
|
key: Union[str, Callable, None] = None
|
||||||
includeTags: Optional[bool] = None
|
includeTags: Optional[bool] = None
|
||||||
includeSched: Optional[bool] = None
|
includeSched: Optional[bool] = None
|
||||||
includeMedia: Optional[bool] = None
|
includeMedia: Optional[bool] = None
|
||||||
|
@ -92,7 +92,7 @@ class Exporter:
|
||||||
|
|
||||||
class TextCardExporter(Exporter):
|
class TextCardExporter(Exporter):
|
||||||
|
|
||||||
key = _("Cards in Plain Text")
|
key = lambda: _("Cards in Plain Text")
|
||||||
ext = ".txt"
|
ext = ".txt"
|
||||||
includeHTML = True
|
includeHTML = True
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ class TextCardExporter(Exporter):
|
||||||
|
|
||||||
class TextNoteExporter(Exporter):
|
class TextNoteExporter(Exporter):
|
||||||
|
|
||||||
key = _("Notes in Plain Text")
|
key = lambda: _("Notes in Plain Text")
|
||||||
ext = ".txt"
|
ext = ".txt"
|
||||||
includeTags = True
|
includeTags = True
|
||||||
includeHTML = True
|
includeHTML = True
|
||||||
|
@ -164,7 +164,7 @@ where cards.id in %s)"""
|
||||||
|
|
||||||
class AnkiExporter(Exporter):
|
class AnkiExporter(Exporter):
|
||||||
|
|
||||||
key = _("Anki 2.0 Deck")
|
key = lambda: _("Anki 2.0 Deck")
|
||||||
ext = ".anki2"
|
ext = ".anki2"
|
||||||
includeSched: Union[bool, None] = False
|
includeSched: Union[bool, None] = False
|
||||||
includeMedia = True
|
includeMedia = True
|
||||||
|
@ -313,7 +313,7 @@ class AnkiExporter(Exporter):
|
||||||
|
|
||||||
class AnkiPackageExporter(AnkiExporter):
|
class AnkiPackageExporter(AnkiExporter):
|
||||||
|
|
||||||
key = _("Anki Deck Package")
|
key = lambda: _("Anki Deck Package")
|
||||||
ext = ".apkg"
|
ext = ".apkg"
|
||||||
|
|
||||||
def __init__(self, col: Collection) -> None:
|
def __init__(self, col: Collection) -> None:
|
||||||
|
@ -394,7 +394,7 @@ class AnkiPackageExporter(AnkiExporter):
|
||||||
|
|
||||||
class AnkiCollectionPackageExporter(AnkiPackageExporter):
|
class AnkiCollectionPackageExporter(AnkiPackageExporter):
|
||||||
|
|
||||||
key = _("Anki Collection Package")
|
key = lambda: _("Anki Collection Package")
|
||||||
ext = ".colpkg"
|
ext = ".colpkg"
|
||||||
verbatim = True
|
verbatim = True
|
||||||
includeSched = None
|
includeSched = None
|
||||||
|
@ -426,7 +426,11 @@ class AnkiCollectionPackageExporter(AnkiPackageExporter):
|
||||||
|
|
||||||
def exporters() -> List[Tuple[str, Any]]:
|
def exporters() -> List[Tuple[str, Any]]:
|
||||||
def id(obj):
|
def id(obj):
|
||||||
return ("%s (*%s)" % (obj.key, obj.ext), obj)
|
if callable(obj.key):
|
||||||
|
key_str = obj.key()
|
||||||
|
else:
|
||||||
|
key_str = obj.key
|
||||||
|
return ("%s (*%s)" % (key_str, obj.ext), obj)
|
||||||
|
|
||||||
exps = [
|
exps = [
|
||||||
id(AnkiCollectionPackageExporter),
|
id(AnkiCollectionPackageExporter),
|
||||||
|
|
Loading…
Reference in a new issue