glutanimate / highlight-search-results

Highlight Search Results in the Browser add-on for Anki
https://ankiweb.net/shared/info/225180905
Other
13 stars 5 forks source link

[Highlight Search Results in the Browser] anki.lang will break - 2.1.20 #2

Closed omega3 closed 4 years ago

omega3 commented 4 years ago

Prerequisite checklist

[ Please enter an [ x ] character to confirm the points below: ]

How can we reproduce the problem?

Open anki in terminal

Reproducible?:

Always.

Version information

Newest

Anki

Version 2.1.20 (47a1bf8b) Python 3.8.1 Qt 5.14.1 PyQt 5.14.1

System

Operating System: Manjaro Linux KDE Plasma Version: 5.17.5 KDE Frameworks Version: 5.66.0 Qt Version: 5.14.1 Kernel Version: 5.4.18-1-MANJARO OS Type: 64-bit

accessing _ without importing from anki.lang will break in the future
  File "/home/user/.local/share/Anki2/addons21/225180905/browser_search_highlight_results.py", line 120, in onSetupSearch
    s = QShortcut(QKeySequence(_("Shift+Return")), self.form.searchEdit)

accessing _ without importing from anki.lang will break in the future
  File "/home/user/.local/share/Anki2/addons21/225180905/browser_search_highlight_results.py", line 122, in onSetupSearch
    s = QShortcut(QKeySequence(_("Ctrl+Return")), self.form.searchEdit)

By the way, it also affects another add-on Search and Replace Tags https://ankiweb.net/shared/info/138501288

accessing _ without importing from anki.lang will break in the future
  File "/home/user/.local/share/Anki2/addons21/138501288/browser_replace_tag.py", line 68, in setupMenu
    self.menuTags = QMenu(_("Tags"))
mathemaat commented 4 years ago

Simply adding from anki.lang import _ somewhere at the top should fix the issue.

See also: https://github.com/matthayes/anki_progress_stats/commit/8416ba2a1bf207fa3b896c0cca31090d2b9692f0

glutanimate commented 4 years ago

Thanks for the reports, guys. This is fixed in master and will land as part of the next release.