diff --git a/qt/aqt/forms/about.ui b/qt/aqt/forms/about.ui
index b736a4b86..755c4e299 100644
--- a/qt/aqt/forms/about.ui
+++ b/qt/aqt/forms/about.ui
@@ -17,7 +17,7 @@
- About Anki
+ ABOUT_ABOUT_ANKI
@@ -36,7 +36,7 @@
- about:blank
+ about:blank
diff --git a/qt/aqt/forms/addcards.ui b/qt/aqt/forms/addcards.ui
index fa98b4769..f34ec6003 100644
--- a/qt/aqt/forms/addcards.ui
+++ b/qt/aqt/forms/addcards.ui
@@ -11,7 +11,7 @@
- Add
+ ACTIONS_ADD
diff --git a/qt/aqt/forms/addfield.ui b/qt/aqt/forms/addfield.ui
index 7ce5e13be..525828aab 100644
--- a/qt/aqt/forms/addfield.ui
+++ b/qt/aqt/forms/addfield.ui
@@ -11,7 +11,7 @@
- Add Field
+ FIELDS_ADD_FIELD
-
@@ -19,14 +19,14 @@
-
- Field:
+ FIELDS_FIELD
-
- Size:
+ FIELDS_SIZE
@@ -49,7 +49,7 @@
-
- Font:
+ FIELDS_FONT
diff --git a/qt/aqt/forms/addmodel.ui b/qt/aqt/forms/addmodel.ui
index 8a82c480f..f7d8bd68c 100644
--- a/qt/aqt/forms/addmodel.ui
+++ b/qt/aqt/forms/addmodel.ui
@@ -11,7 +11,7 @@
- Add Note Type
+ NOTETYPES_ADD_NOTE_TYPE
-
diff --git a/qt/aqt/forms/addonconf.ui b/qt/aqt/forms/addonconf.ui
index 8bc59e2ca..f2e73c091 100644
--- a/qt/aqt/forms/addonconf.ui
+++ b/qt/aqt/forms/addonconf.ui
@@ -14,7 +14,7 @@
- Configuration
+ ADDONS_CONFIGURATION
-
diff --git a/qt/aqt/forms/addons.ui b/qt/aqt/forms/addons.ui
index 770426846..1e93f1c0d 100644
--- a/qt/aqt/forms/addons.ui
+++ b/qt/aqt/forms/addons.ui
@@ -25,7 +25,7 @@
-
- Changes will take effect when Anki is restarted.
+ ADDONS_CHANGES_WILL_TAKE_EFFECT_WHEN_ANKI
@@ -43,21 +43,21 @@
-
- Get Add-ons...
+ ADDONS_GET_ADDONS
-
- Install from file...
+ ADDONS_INSTALL_FROM_FILE
-
- Check for Updates
+ ADDONS_CHECK_FOR_UPDATES
@@ -77,35 +77,35 @@
-
- View Add-on Page
+ ADDONS_VIEW_ADDON_PAGE
-
- Config
+ ADDONS_CONFIG
-
- View Files
+ ADDONS_VIEW_FILES
-
- Toggle Enabled
+ ADDONS_TOGGLE_ENABLED
-
- Delete
+ ACTIONS_DELETE
diff --git a/qt/aqt/forms/browser.ui b/qt/aqt/forms/browser.ui
index 16ccf808f..575371cb1 100644
--- a/qt/aqt/forms/browser.ui
+++ b/qt/aqt/forms/browser.ui
@@ -110,14 +110,14 @@
-
- Search
+ ACTIONS_SEARCH
-
- Preview
+ ACTIONS_PREVIEW
Ctrl+Shift+P
@@ -130,7 +130,7 @@
-
- Filter...
+ BROWSING_FILTER
@@ -241,7 +241,7 @@
diff --git a/qt/aqt/forms/browserdisp.ui b/qt/aqt/forms/browserdisp.ui
index 3a8118255..36874f74c 100644
--- a/qt/aqt/forms/browserdisp.ui
+++ b/qt/aqt/forms/browserdisp.ui
@@ -11,13 +11,13 @@
- Browser Appearance
+ BROWSING_BROWSER_APPEARANCE
-
- Override front template:
+ BROWSING_OVERRIDE_FRONT_TEMPLATE
@@ -27,7 +27,7 @@
-
- Override back template:
+ BROWSING_OVERRIDE_BACK_TEMPLATE
@@ -37,7 +37,7 @@
-
- Override font:
+ BROWSING_OVERRIDE_FONT
diff --git a/qt/aqt/forms/browseropts.ui b/qt/aqt/forms/browseropts.ui
index e139ff035..ec721b220 100644
--- a/qt/aqt/forms/browseropts.ui
+++ b/qt/aqt/forms/browseropts.ui
@@ -11,7 +11,7 @@
- Browser Options
+ BROWSING_BROWSER_OPTIONS
-
@@ -19,7 +19,7 @@
-
- <b>Font</b>:
+ BROWSING_FONT
@@ -33,7 +33,7 @@
-
- <b>Font Size</b>:
+ BROWSING_FONT_SIZE
@@ -50,7 +50,7 @@
-
- <b>Line Size</b>:
+ BROWSING_LINE_SIZE
@@ -75,7 +75,7 @@
-
- Search within formatting (slow)
+ BROWSING_SEARCH_WITHIN_FORMATTING_SLOW
diff --git a/qt/aqt/forms/build_ui.py b/qt/aqt/forms/build_ui.py
index 65c2cfb29..9eca6b164 100644
--- a/qt/aqt/forms/build_ui.py
+++ b/qt/aqt/forms/build_ui.py
@@ -9,9 +9,12 @@ buf = io.StringIO()
compileUi(open(ui_file), buf, from_imports=True)
outdata = buf.getvalue()
-outdata = outdata.replace("# -*- coding: utf-8 -*-", "# -*- coding: utf-8 -*-\nfrom anki.lang import _\n")
-outdata = re.sub(r'(QtGui\.QApplication\.)?_?translate\(".*?", ', '_(', outdata)
-outdata = re.sub(r', None.*', '))', outdata)
+outdata = outdata.replace(
+ "# -*- coding: utf-8 -*-", "# -*- coding: utf-8 -*-\nfrom aqt.utils import tr, TR\n"
+)
+outdata = re.sub(
+ r'(?:QtGui\.QApplication\.)?_?translate\(".*?", "(.*?)"', "tr(TR.\\1", outdata
+)
with open(py_file, "w") as file:
file.write(outdata)
diff --git a/qt/aqt/forms/changemap.ui b/qt/aqt/forms/changemap.ui
index a8a784a45..9278c21d1 100644
--- a/qt/aqt/forms/changemap.ui
+++ b/qt/aqt/forms/changemap.ui
@@ -11,13 +11,13 @@
- Import
+ ACTIONS_IMPORT
-
- Target field:
+ BROWSING_TARGET_FIELD
true
diff --git a/qt/aqt/forms/changemodel.ui b/qt/aqt/forms/changemodel.ui
index 80f54ca5e..20a3247ce 100644
--- a/qt/aqt/forms/changemodel.ui
+++ b/qt/aqt/forms/changemodel.ui
@@ -11,7 +11,7 @@
- Change Note Type
+ BROWSING_CHANGE_NOTE_TYPE
@@ -25,7 +25,7 @@
-
- Current note type:
+ BROWSING_CURRENT_NOTE_TYPE
@@ -48,7 +48,7 @@
-
- New note type:
+ BROWSING_NEW_NOTE_TYPE
@@ -73,7 +73,7 @@
- Cards
+ EDITING_CARDS
@@ -114,7 +114,7 @@
- Fields
+ EDITING_FIELDS
diff --git a/qt/aqt/forms/clayout_top.ui b/qt/aqt/forms/clayout_top.ui
index 8787a6fec..3ae1cc194 100644
--- a/qt/aqt/forms/clayout_top.ui
+++ b/qt/aqt/forms/clayout_top.ui
@@ -11,7 +11,7 @@
- Form
+ CARD_TEMPLATES_FORM
diff --git a/qt/aqt/forms/customstudy.ui b/qt/aqt/forms/customstudy.ui
index e2fae9dc9..187143cd0 100644
--- a/qt/aqt/forms/customstudy.ui
+++ b/qt/aqt/forms/customstudy.ui
@@ -11,7 +11,7 @@
- Custom Study
+ ACTIONS_CUSTOM_STUDY
-
@@ -19,42 +19,42 @@
-
- Review ahead
+ CUSTOM_STUDY_REVIEW_AHEAD
-
- Review forgotten cards
+ CUSTOM_STUDY_REVIEW_FORGOTTEN_CARDS
-
- Increase today's new card limit
+ CUSTOM_STUDY_INCREASE_TODAYS_NEW_CARD_LIMIT
-
- Increase today's review card limit
+ CUSTOM_STUDY_INCREASE_TODAYS_REVIEW_CARD_LIMIT
-
- Study by card state or tag
+ CUSTOM_STUDY_STUDY_BY_CARD_STATE_OR_TAG
-
- Preview new cards
+ CUSTOM_STUDY_PREVIEW_NEW_CARDS
@@ -114,22 +114,22 @@
-
- New cards only
+ CUSTOM_STUDY_NEW_CARDS_ONLY
-
- Due cards only
+ CUSTOM_STUDY_DUE_CARDS_ONLY
-
- All review cards in random order
+ CUSTOM_STUDY_ALL_REVIEW_CARDS_IN_RANDOM_ORDER
-
- All cards in random order (don't reschedule)
+ CUSTOM_STUDY_ALL_CARDS_IN_RANDOM_ORDER_DONT
diff --git a/qt/aqt/forms/dconf.ui b/qt/aqt/forms/dconf.ui
index e47833362..08f6754db 100644
--- a/qt/aqt/forms/dconf.ui
+++ b/qt/aqt/forms/dconf.ui
@@ -6,7 +6,7 @@
0
0
- 587
+ 623
514
@@ -16,7 +16,7 @@
-
- Options group:
+ SCHEDULING_OPTIONS_GROUP
@@ -39,7 +39,7 @@
- Manage...
+ ACTIONS_MANAGE
Qt::ToolButtonTextBesideIcon
@@ -74,7 +74,7 @@
- New Cards
+ SCHEDULING_NEW_CARDS
@@ -97,14 +97,14 @@
-
- Starting ease
+ SCHEDULING_STARTING_EASE
-
- %
+ %
130
@@ -117,7 +117,7 @@
-
- Order
+ SCHEDULING_ORDER
@@ -145,14 +145,14 @@
-
- Easy interval
+ SCHEDULING_EASY_INTERVAL
-
- Graduating interval
+ SCHEDULING_GRADUATING_INTERVAL
@@ -166,7 +166,7 @@
-
- New cards/day
+ SCHEDULING_NEW_CARDSDAY
@@ -176,7 +176,7 @@
-
- Steps (in minutes)
+ SCHEDULING_STEPS_IN_MINUTES
@@ -186,14 +186,14 @@
-
- Bury related new cards until the next day
+ SCHEDULING_BURY_RELATED_NEW_CARDS_UNTIL_THE
-
- days
+ SCHEDULING_DAYS
@@ -206,7 +206,7 @@
- days
+ SCHEDULING_DAYS
@@ -229,7 +229,7 @@
- Reviews
+ SCHEDULING_REVIEWS
@@ -252,14 +252,14 @@
-
- Easy bonus
+ SCHEDULING_EASY_BONUS
-
- %
+ %
100
@@ -285,21 +285,21 @@
-
- Interval modifier
+ SCHEDULING_INTERVAL_MODIFIER
-
- Maximum reviews/day
+ SCHEDULING_MAXIMUM_REVIEWSDAY
-
- Maximum interval
+ SCHEDULING_MAXIMUM_INTERVAL
@@ -319,7 +319,7 @@
-
- days
+ SCHEDULING_DAYS
@@ -333,7 +333,7 @@
-
- %
+ %
0
@@ -355,21 +355,21 @@
-
- Bury related reviews until the next day
+ SCHEDULING_BURY_RELATED_REVIEWS_UNTIL_THE_NEXT
-
- Hard interval
+ SCHEDULING_HARD_INTERVAL
-
- %
+ %
5
@@ -398,7 +398,7 @@
- Lapses
+ SCHEDULING_LAPSES
@@ -421,7 +421,7 @@
-
- Steps (in minutes)
+ SCHEDULING_STEPS_IN_MINUTES
@@ -431,14 +431,14 @@
-
- New interval
+ SCHEDULING_NEW_INTERVAL
-
- Leech threshold
+ SCHEDULING_LEECH_THRESHOLD
@@ -454,14 +454,14 @@
- lapses
+ SCHEDULING_LAPSES2
-
- Leech action
+ SCHEDULING_LEECH_ACTION
@@ -478,14 +478,14 @@
-
- Minimum interval
+ SCHEDULING_MINIMUM_INTERVAL
-
- days
+ SCHEDULING_DAYS
@@ -495,12 +495,12 @@
-
- Suspend Card
+ ACTIONS_SUSPEND_CARD
-
- Tag Only
+ SCHEDULING_TAG_ONLY
@@ -523,7 +523,7 @@
-
- %
+ %
100
@@ -552,7 +552,7 @@
- General
+ SCHEDULING_GENERAL
@@ -575,7 +575,7 @@
-
- Ignore answer times longer than
+ SCHEDULING_IGNORE_ANSWER_TIMES_LONGER_THAN
@@ -595,7 +595,7 @@
-
- seconds
+ SCHEDULING_SECONDS
@@ -604,21 +604,21 @@
-
- Show answer timer
+ SCHEDULING_SHOW_ANSWER_TIMER
-
- Automatically play audio
+ SCHEDULING_AUTOMATICALLY_PLAY_AUDIO
-
- Always include question side when replaying audio
+ SCHEDULING_ALWAYS_INCLUDE_QUESTION_SIDE_WHEN_REPLAYING
false
@@ -642,7 +642,7 @@
- Description
+ SCHEDULING_DESCRIPTION
@@ -663,7 +663,7 @@
-
- Description to show on overview screen, for current deck:
+ SCHEDULING_DESCRIPTION_TO_SHOW_ON_OVERVIEW_SCREEN
diff --git a/qt/aqt/forms/debug.ui b/qt/aqt/forms/debug.ui
index ac0bd7721..0e8bec8cb 100644
--- a/qt/aqt/forms/debug.ui
+++ b/qt/aqt/forms/debug.ui
@@ -11,7 +11,7 @@
- Debug Console
+ QT_MISC_DEBUG_CONSOLE
diff --git a/qt/aqt/forms/dyndconf.ui b/qt/aqt/forms/dyndconf.ui
index 5c5443f16..163fd84b1 100644
--- a/qt/aqt/forms/dyndconf.ui
+++ b/qt/aqt/forms/dyndconf.ui
@@ -11,26 +11,26 @@
- Dialog
+ Dialog
-
- Filter
+ ACTIONS_FILTER
-
- Limit to
+ DECKS_LIMIT_TO
-
- Search
+ ACTIONS_SEARCH
@@ -53,7 +53,7 @@
-
- cards selected by
+ DECKS_CARDS_SELECTED_BY
@@ -69,13 +69,13 @@
-
- Filter 2
+ DECKS_FILTER_2
-
- Limit to
+ DECKS_LIMIT_TO
@@ -88,7 +88,7 @@
-
- Search
+ ACTIONS_SEARCH
@@ -111,7 +111,7 @@
-
- cards selected by
+ DECKS_CARDS_SELECTED_BY
@@ -121,13 +121,13 @@
-
- Options
+ ACTIONS_OPTIONS
-
- Reschedule cards based on my answers in this deck
+ DECKS_RESCHEDULE_CARDS_BASED_ON_MY_ANSWERS
true
@@ -137,7 +137,7 @@
-
- Enable second filter
+ DECKS_ENABLE_SECOND_FILTER
@@ -147,7 +147,7 @@
-
- Repeat failed cards after
+ DECKS_REPEAT_FAILED_CARDS_AFTER
@@ -157,7 +157,7 @@
-
- minutes
+ DECKS_MINUTES
@@ -177,7 +177,7 @@
-
- Custom steps (in minutes)
+ DECKS_CUSTOM_STEPS_IN_MINUTES
diff --git a/qt/aqt/forms/editaddon.ui b/qt/aqt/forms/editaddon.ui
index 68c2cbfd2..75eb94473 100644
--- a/qt/aqt/forms/editaddon.ui
+++ b/qt/aqt/forms/editaddon.ui
@@ -11,7 +11,7 @@
- Dialog
+ Dialog
-
diff --git a/qt/aqt/forms/editcurrent.ui b/qt/aqt/forms/editcurrent.ui
index 66b920fcd..d65a3da6a 100644
--- a/qt/aqt/forms/editcurrent.ui
+++ b/qt/aqt/forms/editcurrent.ui
@@ -11,7 +11,7 @@
- Dialog
+ Dialog
diff --git a/qt/aqt/forms/edithtml.ui b/qt/aqt/forms/edithtml.ui
index 5586ec2f9..0b29039f9 100644
--- a/qt/aqt/forms/edithtml.ui
+++ b/qt/aqt/forms/edithtml.ui
@@ -10,7 +10,7 @@
- HTML Editor
+ EDITING_HTML_EDITOR
-
diff --git a/qt/aqt/forms/emptycards.ui b/qt/aqt/forms/emptycards.ui
index a9b7700c9..317261610 100644
--- a/qt/aqt/forms/emptycards.ui
+++ b/qt/aqt/forms/emptycards.ui
@@ -33,7 +33,7 @@
- about:blank
+ about:blank
diff --git a/qt/aqt/forms/exporting.ui b/qt/aqt/forms/exporting.ui
index a6793edb8..c108c3682 100644
--- a/qt/aqt/forms/exporting.ui
+++ b/qt/aqt/forms/exporting.ui
@@ -11,7 +11,7 @@
- Export
+ ACTIONS_EXPORT
-
@@ -25,7 +25,7 @@
- <b>Export format</b>:
+ EXPORTING_EXPORT_FORMAT
@@ -35,7 +35,7 @@
-
- <b>Include</b>:
+ EXPORTING_INCLUDE
@@ -49,7 +49,7 @@
-
- Include scheduling information
+ EXPORTING_INCLUDE_SCHEDULING_INFORMATION
true
@@ -59,7 +59,7 @@
-
- Include media
+ EXPORTING_INCLUDE_MEDIA
true
@@ -69,7 +69,7 @@
-
- Include tags
+ EXPORTING_INCLUDE_TAGS
true
@@ -79,7 +79,7 @@
-
- Include HTML and media references
+ EXPORTING_INCLUDE_HTML_AND_MEDIA_REFERENCES
diff --git a/qt/aqt/forms/fields.ui b/qt/aqt/forms/fields.ui
index c0dc3bfc3..bb823b3da 100644
--- a/qt/aqt/forms/fields.ui
+++ b/qt/aqt/forms/fields.ui
@@ -11,7 +11,7 @@
- Fields
+ EDITING_FIELDS
true
@@ -40,28 +40,28 @@
-
- Add
+ ACTIONS_ADD
-
- Delete
+ ACTIONS_DELETE
-
- Rename
+ ACTIONS_RENAME
-
- Reposition
+ ACTIONS_REPOSITION
@@ -87,7 +87,7 @@
-
- Editing Font
+ FIELDS_EDITING_FONT
@@ -104,7 +104,7 @@
-
- Reverse text direction (RTL)
+ FIELDS_REVERSE_TEXT_DIRECTION_RTL
@@ -121,21 +121,21 @@
-
- Remember last input when adding
+ FIELDS_REMEMBER_LAST_INPUT_WHEN_ADDING
-
- Options
+ ACTIONS_OPTIONS
-
- Sort by this field in the browser
+ FIELDS_SORT_BY_THIS_FIELD_IN_THE
diff --git a/qt/aqt/forms/finddupes.ui b/qt/aqt/forms/finddupes.ui
index 2884364c5..6ef6c2fc4 100644
--- a/qt/aqt/forms/finddupes.ui
+++ b/qt/aqt/forms/finddupes.ui
@@ -11,7 +11,7 @@
- Find Duplicates
+ BROWSING_FIND_DUPLICATES
-
@@ -22,14 +22,14 @@
-
- Optional filter:
+ BROWSING_OPTIONAL_FILTER
-
- Search in:
+ BROWSING_SEARCH_IN
@@ -76,7 +76,7 @@
- about:blank
+ about:blank
diff --git a/qt/aqt/forms/findreplace.ui b/qt/aqt/forms/findreplace.ui
index ab0913096..8c5745e82 100644
--- a/qt/aqt/forms/findreplace.ui
+++ b/qt/aqt/forms/findreplace.ui
@@ -11,7 +11,7 @@
- Find and Replace
+ BROWSING_FIND_AND_REPLACE
-
@@ -19,7 +19,7 @@
-
- <b>Find</b>:
+ BROWSING_FIND
@@ -45,7 +45,7 @@
-
- <b>Replace With</b>:
+ BROWSING_REPLACE_WITH
@@ -71,7 +71,7 @@
-
- <b>In</b>:
+ BROWSING_IN
@@ -85,14 +85,14 @@
-
- Treat input as regular expression
+ BROWSING_TREAT_INPUT_AS_REGULAR_EXPRESSION
-
- Ignore case
+ BROWSING_IGNORE_CASE
true
diff --git a/qt/aqt/forms/getaddons.ui b/qt/aqt/forms/getaddons.ui
index c0fbb068a..ece079e39 100644
--- a/qt/aqt/forms/getaddons.ui
+++ b/qt/aqt/forms/getaddons.ui
@@ -11,13 +11,13 @@
- Install Add-on
+ ADDONS_INSTALL_ADDON
-
- To browse add-ons, please click the browse button below.<br><br>When you've found an add-on you like, please paste its code below. You can paste multiple codes, separated by spaces.
+ ADDONS_TO_BROWSE_ADDONS_PLEASE_CLICK_THE
true
@@ -42,7 +42,7 @@
-
- Code:
+ ADDONS_CODE
diff --git a/qt/aqt/forms/importing.ui b/qt/aqt/forms/importing.ui
index e63ee22b7..5a1bd1281 100644
--- a/qt/aqt/forms/importing.ui
+++ b/qt/aqt/forms/importing.ui
@@ -11,13 +11,13 @@
- Import
+ ACTIONS_IMPORT
-
- Import options
+ IMPORTING_IMPORT_OPTIONS
-
@@ -31,14 +31,14 @@
-
- Type
+ NOTETYPES_TYPE
-
- Deck
+ DECKS_DECK
@@ -55,17 +55,17 @@
-
- Update existing notes when first field matches
+ IMPORTING_UPDATE_EXISTING_NOTES_WHEN_FIRST_FIELD
-
- Ignore lines where first field matches existing note
+ IMPORTING_IGNORE_LINES_WHERE_FIRST_FIELD_MATCHES
-
- Import even if existing note has same first field
+ IMPORTING_IMPORT_EVEN_IF_EXISTING_NOTE_HAS
@@ -73,7 +73,7 @@
-
- Allow HTML in fields
+ IMPORTING_ALLOW_HTML_IN_FIELDS
@@ -82,7 +82,7 @@
-
- Tag modified notes:
+ IMPORTING_TAG_MODIFIED_NOTES
@@ -103,7 +103,7 @@
- Field mapping
+ IMPORTING_FIELD_MAPPING
-
diff --git a/qt/aqt/forms/main.ui b/qt/aqt/forms/main.ui
index ab4fcc56e..fd8a57476 100644
--- a/qt/aqt/forms/main.ui
+++ b/qt/aqt/forms/main.ui
@@ -23,7 +23,7 @@
- Anki
+ Anki
@@ -51,7 +51,7 @@
- E&xit
+ QT_ACCEL_EXIT
Ctrl+Q
@@ -106,10 +106,10 @@
- &Preferences...
+ QT_ACCEL_PREFERENCES
- Configure interface language and options
+ QT_MISC_CONFIGURE_INTERFACE_LANGUAGE_AND_OPTIONS
Ctrl+P
@@ -120,7 +120,7 @@
- &About...
+ QT_ACCEL_ABOUT
QAction::AboutRole
@@ -131,7 +131,7 @@
false
- &Undo
+ QT_ACCEL_UNDO
Ctrl+Z
@@ -139,25 +139,25 @@
- Check &Media...
+ QT_ACCEL_CHECK_MEDIA
- Check the files in the media directory
+ QT_MISC_CHECK_THE_FILES_IN_THE_MEDIA
- &Open Add-ons Folder...
+ QT_ACCEL_OPEN_ADDONS_FOLDER
- &Support Anki...
+ QT_ACCEL_SUPPORT_ANKI
- &Browse and Install...
+ QT_ACCEL_BROWSE_AND_INSTALL
@@ -165,12 +165,12 @@
- &Check Database
+ QT_ACCEL_CHECK_DATABASE
- &Guide...
+ QT_ACCEL_GUIDE
F1
@@ -178,7 +178,7 @@
- &Switch Profile
+ QT_ACCEL_SWITCH_PROFILE
Ctrl+Shift+P
@@ -186,7 +186,7 @@
- &Export...
+ QT_ACCEL_EXPORT
Ctrl+E
@@ -194,7 +194,7 @@
- &Import...
+ QT_ACCEL_IMPORT
Ctrl+Shift+I
@@ -202,7 +202,7 @@
- Study Deck...
+ QT_MISC_STUDY_DECK
/
@@ -210,12 +210,12 @@
- Empty Cards...
+ QT_MISC_EMPTY_CARDS
- Create Filtered Deck...
+ QT_MISC_CREATE_FILTERED_DECK
F
@@ -223,7 +223,7 @@
- Manage Note Types
+ QT_MISC_MANAGE_NOTE_TYPES
Ctrl+Shift+N
@@ -231,7 +231,7 @@
- Add-ons
+ QT_MISC_ADDONS
Ctrl+Shift+A
diff --git a/qt/aqt/forms/modelopts.ui b/qt/aqt/forms/modelopts.ui
index 60c09ca50..a16239ed5 100644
--- a/qt/aqt/forms/modelopts.ui
+++ b/qt/aqt/forms/modelopts.ui
@@ -24,20 +24,20 @@
- LaTeX
+ EDITING_LATEX
-
- Create scalable images with dvisvgm
+ NOTETYPES_CREATE_SCALABLE_IMAGES_WITH_DVISVGM
-
- Header
+ NOTETYPES_HEADER
@@ -51,7 +51,7 @@
-
- Footer
+ NOTETYPES_FOOTER
diff --git a/qt/aqt/forms/models.ui b/qt/aqt/forms/models.ui
index 9e9158d61..12d745187 100644
--- a/qt/aqt/forms/models.ui
+++ b/qt/aqt/forms/models.ui
@@ -14,7 +14,7 @@
- Note Types
+ NOTETYPES_NOTE_TYPES
diff --git a/qt/aqt/forms/preferences.ui b/qt/aqt/forms/preferences.ui
index 8eee4485b..d5afcb135 100644
--- a/qt/aqt/forms/preferences.ui
+++ b/qt/aqt/forms/preferences.ui
@@ -6,12 +6,12 @@
0
0
- 424
+ 632
374
- Preferences
+ PREFERENCES_PREFERENCES
-
@@ -24,7 +24,7 @@
- Basic
+ PREFERENCES_BASIC
@@ -58,42 +58,42 @@
-
- Hardware acceleration (faster, may cause display issues)
+ PREFERENCES_HARDWARE_ACCELERATION_FASTER_MAY_CAUSE_DISPLAY
-
- Show play buttons on cards with audio
+ PREFERENCES_SHOW_PLAY_BUTTONS_ON_CARDS_WITH
-
- Interrupt current audio when answering
+ PREFERENCES_INTERRUPT_CURRENT_AUDIO_WHEN_ANSWERING
-
- Paste clipboard images as PNG
+ PREFERENCES_PASTE_CLIPBOARD_IMAGES_AS_PNG
-
- Paste without shift key strips formatting
+ PREFERENCES_PASTE_WITHOUT_SHIFT_KEY_STRIPS_FORMATTING
-
- Night mode
+ PREFERENCES_NIGHT_MODE
@@ -101,12 +101,12 @@
-
- When adding, default to current deck
+ PREFERENCES_WHEN_ADDING_DEFAULT_TO_CURRENT_DECK
-
- Change deck depending on note type
+ PREFERENCES_CHANGE_DECK_DEPENDING_ON_NOTE_TYPE
@@ -116,14 +116,14 @@
-
- User interface size
+ PREFERENCES_USER_INTERFACE_SIZE
-
- %
+ %
100
@@ -171,34 +171,34 @@
- Scheduling
+ PREFERENCES_SCHEDULING
-
- Show next review time above answer buttons
+ PREFERENCES_SHOW_NEXT_REVIEW_TIME_ABOVE_ANSWER
-
- Show remaining card count during review
+ PREFERENCES_SHOW_REMAINING_CARD_COUNT_DURING_REVIEW
-
- Show learning cards with larger steps before reviews
+ PREFERENCES_SHOW_LEARNING_CARDS_WITH_LARGER_STEPS
-
- Anki 2.1 scheduler (beta)
+ PREFERENCES_ANKI_21_SCHEDULER_BETA
@@ -220,7 +220,7 @@
-
- mins
+ PREFERENCES_MINS
@@ -247,28 +247,28 @@
-
- Timebox time limit
+ PREFERENCES_TIMEBOX_TIME_LIMIT
-
- hours past midnight
+ PREFERENCES_HOURS_PAST_MIDNIGHT
-
- Learn ahead limit
+ PREFERENCES_LEARN_AHEAD_LIMIT
-
- mins
+ PREFERENCES_MINS
@@ -288,7 +288,7 @@
-
- Next day starts at
+ PREFERENCES_NEXT_DAY_STARTS_AT
@@ -311,7 +311,7 @@
- Network
+ PREFERENCES_NETWORK
@@ -339,7 +339,7 @@
-
- <b>Synchronisation</b>
+ PREFERENCES_SYNCHRONISATION
true
@@ -352,28 +352,28 @@
-
- Synchronize audio and images too
+ PREFERENCES_SYNCHRONIZE_AUDIO_AND_IMAGES_TOO
-
- Automatically sync on profile open/close
+ PREFERENCES_AUTOMATICALLY_SYNC_ON_PROFILE_OPENCLOSE
-
- Periodically sync media
+ PREFERENCES_PERIODICALLY_SYNC_MEDIA
-
- On next sync, force changes in one direction
+ PREFERENCES_ON_NEXT_SYNC_FORCE_CHANGES_IN
@@ -456,7 +456,7 @@
- Backups
+ PREFERENCES_BACKUPS
@@ -477,7 +477,7 @@
-
- <html><head/><body><p><span style=" font-weight:600;">Backups</span><br/>Anki will create a backup of your collection each time it is closed.</p></body></html>
+ PREFERENCES_BACKUPSANKI_WILL_CREATE_A_BACKUP_OF
true
@@ -489,7 +489,7 @@
-
- Keep
+ PREFERENCES_KEEP
@@ -512,7 +512,7 @@
-
- backups
+ PREFERENCES_BACKUPS2
@@ -534,14 +534,14 @@
-
- You can restore backups via File>Switch Profile.
+ PREFERENCES_YOU_CAN_RESTORE_BACKUPS_VIA_FILESWITCH
-
- Note: Media is not backed up. Please create a periodic backup of your Anki folder to be safe.
+ PREFERENCES_NOTE_MEDIA_IS_NOT_BACKED_UP
true
@@ -564,7 +564,7 @@
-
- Some settings will take effect after you restart Anki.
+ PREFERENCES_SOME_SETTINGS_WILL_TAKE_EFFECT_AFTER
Qt::AlignCenter
diff --git a/qt/aqt/forms/profiles.ui b/qt/aqt/forms/profiles.ui
index 064302bd1..760dbf4f1 100644
--- a/qt/aqt/forms/profiles.ui
+++ b/qt/aqt/forms/profiles.ui
@@ -11,7 +11,7 @@
- Profiles
+ PROFILES_PROFILES
@@ -33,7 +33,7 @@
-
- Open
+ PROFILES_OPEN
true
@@ -43,28 +43,28 @@
-
- Add
+ ACTIONS_ADD
-
- Rename
+ ACTIONS_RENAME
-
- Delete
+ ACTIONS_DELETE
-
- Quit
+ PROFILES_QUIT
@@ -84,7 +84,7 @@
-
- Open Backup...
+ PROFILES_OPEN_BACKUP
diff --git a/qt/aqt/forms/progress.ui b/qt/aqt/forms/progress.ui
index 5dbfdbbc7..2b575b398 100644
--- a/qt/aqt/forms/progress.ui
+++ b/qt/aqt/forms/progress.ui
@@ -11,7 +11,7 @@
- Dialog
+ Dialog
diff --git a/qt/aqt/forms/reposition.ui b/qt/aqt/forms/reposition.ui
index cba8bb861..1310badc9 100644
--- a/qt/aqt/forms/reposition.ui
+++ b/qt/aqt/forms/reposition.ui
@@ -11,7 +11,7 @@
- Reposition New Cards
+ BROWSING_REPOSITION_NEW_CARDS
-
@@ -26,7 +26,7 @@
-
- Start position:
+ BROWSING_START_POSITION
@@ -46,7 +46,7 @@
-
- Step:
+ BROWSING_STEP
@@ -65,14 +65,14 @@
-
- Randomize order
+ BROWSING_RANDOMIZE_ORDER
-
- Shift position of existing cards
+ BROWSING_SHIFT_POSITION_OF_EXISTING_CARDS
true
diff --git a/qt/aqt/forms/reschedule.ui b/qt/aqt/forms/reschedule.ui
index 26e9d9cfb..e67d4b67e 100644
--- a/qt/aqt/forms/reschedule.ui
+++ b/qt/aqt/forms/reschedule.ui
@@ -11,13 +11,13 @@
- Reschedule
+ BROWSING_RESCHEDULE
-
- Place at end of new card queue
+ BROWSING_PLACE_AT_END_OF_NEW_CARD
true
@@ -27,7 +27,7 @@
-
- Place in review queue with interval between:
+ BROWSING_PLACE_IN_REVIEW_QUEUE_WITH_INTERVAL
@@ -54,7 +54,7 @@
-
- ~
+ ~
@@ -75,7 +75,7 @@
-
- days
+ SCHEDULING_DAYS
diff --git a/qt/aqt/forms/setgroup.ui b/qt/aqt/forms/setgroup.ui
index 151517058..22d9eb888 100644
--- a/qt/aqt/forms/setgroup.ui
+++ b/qt/aqt/forms/setgroup.ui
@@ -11,13 +11,13 @@
- Anki
+ Anki
-
- Move cards to deck:
+ BROWSING_MOVE_CARDS_TO_DECK
diff --git a/qt/aqt/forms/setlang.ui b/qt/aqt/forms/setlang.ui
index 44503186f..3b3467c80 100644
--- a/qt/aqt/forms/setlang.ui
+++ b/qt/aqt/forms/setlang.ui
@@ -11,13 +11,13 @@
- Anki
+ Anki
-
- Interface language:
+ PREFERENCES_INTERFACE_LANGUAGE
diff --git a/qt/aqt/forms/stats.ui b/qt/aqt/forms/stats.ui
index 7642c135d..07cc79f64 100644
--- a/qt/aqt/forms/stats.ui
+++ b/qt/aqt/forms/stats.ui
@@ -11,7 +11,7 @@
- Statistics
+ Statistics
@@ -33,7 +33,7 @@
- about:blank
+ about:blank
@@ -77,7 +77,7 @@
-
- deck
+ deck
true
@@ -87,7 +87,7 @@
-
- collection
+ collection
@@ -103,7 +103,7 @@
-
- 1 month
+ 1 month
true
@@ -113,14 +113,14 @@
-
- 1 year
+ 1 year
-
- deck life
+ deck life
diff --git a/qt/aqt/forms/studydeck.ui b/qt/aqt/forms/studydeck.ui
index 3f9a88168..59b146fe9 100644
--- a/qt/aqt/forms/studydeck.ui
+++ b/qt/aqt/forms/studydeck.ui
@@ -11,7 +11,7 @@
- Study Deck
+ DECKS_STUDY_DECK
-
@@ -19,7 +19,7 @@
-
- Filter:
+ DECKS_FILTER
diff --git a/qt/aqt/forms/taglimit.ui b/qt/aqt/forms/taglimit.ui
index 43e23dc3f..88376c74c 100644
--- a/qt/aqt/forms/taglimit.ui
+++ b/qt/aqt/forms/taglimit.ui
@@ -11,13 +11,13 @@
- Selective Study
+ CUSTOM_STUDY_SELECTIVE_STUDY
-
- Require one or more of these tags:
+ CUSTOM_STUDY_REQUIRE_ONE_OR_MORE_OF_THESE
@@ -40,7 +40,7 @@
-
- Select tags to exclude:
+ CUSTOM_STUDY_SELECT_TAGS_TO_EXCLUDE
diff --git a/qt/aqt/forms/template.ui b/qt/aqt/forms/template.ui
index afc4264b8..9913a9926 100644
--- a/qt/aqt/forms/template.ui
+++ b/qt/aqt/forms/template.ui
@@ -17,7 +17,7 @@
- Form
+ CARD_TEMPLATES_FORM
diff --git a/qt/po/scripts/rewrite-refs.py b/qt/po/scripts/rewrite-refs.py
index 9f9c1a721..b6ac9d545 100644
--- a/qt/po/scripts/rewrite-refs.py
+++ b/qt/po/scripts/rewrite-refs.py
@@ -3,10 +3,11 @@
import glob, re, json, stringcase
files = (
- glob.glob("../../pylib/**/*.py", recursive=True)
+ # glob.glob("../../pylib/**/*.py", recursive=True)
# glob.glob("../../qt/**/*.py", recursive=True)
+ glob.glob("../../qt/**/forms/*.ui", recursive=True)
)
-string_re = re.compile(r'_\(\s*(".*?")\s*\)')
+string_re = re.compile(r"(.*?)")
map = json.load(open("keys_by_text.json"))
@@ -16,16 +17,43 @@ blacklist = {
"After pressing OK, you can choose which tags to include.",
"Filter/Cram",
"Show %s",
+ "~",
+ "about:blank",
# previewer.py needs updating to fix these
"Shortcut key: R",
"Shortcut key: B",
}
+from html.entities import name2codepoint
+
+reEnts = re.compile(r"?\w+;")
+
+
+def decode_ents(html):
+ def fixup(m):
+ text = m.group(0)
+ if text[:2] == "":
+ # character reference
+ try:
+ if text[:3] == "":
+ return chr(int(text[3:-1], 16))
+ else:
+ return chr(int(text[2:-1]))
+ except ValueError:
+ pass
+ else:
+ # named entity
+ try:
+ text = chr(name2codepoint[text[1:-1]])
+ except KeyError:
+ pass
+ return text # leave as is
+
+ return reEnts.sub(fixup, html)
+
def repl(m):
- # the argument may consistent of multiple strings that need merging together
- text = eval(m.group(1))
-
+ text = decode_ents(m.group(1))
if text in blacklist:
return m.group(0)
@@ -33,11 +61,7 @@ def repl(m):
screaming = stringcase.constcase(key)
print(screaming)
- if "%d" in text or "%s" in text:
- # replace { $val } with %s for compat with old code
- return f'tr_legacyglobal(TR.{screaming}, val="%s")'
-
- return f"tr_legacyglobal(TR.{screaming})"
+ return f"{screaming}"
for file in files:
@@ -46,8 +70,4 @@ for file in files:
buf = open(file).read()
buf2 = string_re.sub(repl, buf)
if buf != buf2:
- lines = buf2.split("\n")
- lines.insert(3, "from anki.rsbackend import TR")
- lines.insert(3, "from anki.lang import tr_legacyglobal")
- buf2 = "\n".join(lines)
open(file, "w").write(buf2)