Repository navigation
fix: translate dropdown options in the language chosen at startup - #1569
Closed
kratos0718 wants to merge 1 commit into
Closed
kratos0718 wants to merge 1 commit into
kratos0718 wants to merge 1 commit into
Conversation
The thumbnail size, settings (file path, tag click action, theme and splash) and field type options were translated in class bodies, which run when the module is imported, before the language from the settings is applied. They always showed English. Store the translation keys and look them up when the comboboxes are filled.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1289. Covers the dropdown part of #1316: thumbnail size, file path visibility, tag click action, theme and splash screen options, plus the field type options in the field template editor, which have the same cause.
These option labels were looked up with
Translations[...]in class bodies (MainWindow.THUMB_SIZES, theSettingsPanelmaps,EditFieldTemplateModal.field_type_map). Class bodies run when the module is imported, andQtDriverapplies the language from the settings later, so these labels were always English even though the keys are translated. The maps now hold translation keys, and the labels are looked up when each combobox is filled. Nothing else reads the map values.The other items in #1316 (dialog buttons, "All Tags", the colour placeholder, the trash dialog keys) are hard-coded strings or wrong keys rather than this import-time lookup, so I've left them for a separate change.
Tasks Completed
tests/qt/test_translated_options.pyswitches to French after import, as the app does at startup, and checks that the settings panel and field type comboboxes show the French labels. Both tests fail onmain(the comboboxes showSystem,Dark,Light) and pass with this change.pytest tests/qtpasses (69 tests);ruff formatandruff checkare clean.