-
Notifications
You must be signed in to change notification settings - Fork 386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: resouce leak in translate_with_setter
by deleting the offending code
#817
base: main
Are you sure you want to change the base?
fix: resouce leak in translate_with_setter
by deleting the offending code
#817
Conversation
Actually I see that part of your solution is to create wrapper classes for a lot of the QWidgets. At that point is it worth trying to save the translations updating without a restart? Besides the issues with this chain of bugs, there's already some related Qt issues involving trying to update widgets that have been garbage collected that prevented me from even being able to leverage the benefits of the setter translators when working on #803 (sorry for not opening a related issue for it), and instead I've just had to prompt the user to restart until or even if we can prevent the need for it. While not having to restart to change the on-screen language is would be nice, I feel like it may just not be worth the time and work on our side for the benefit of saving people a likely one-time restart to apply these changes to the program. Especially when it's not all too common for other applications to update the language without requiring restarting either the program or OS. I'd like to hear more of your thoughts on it, though. |
The wrapper classes aren't strictly necessary for this fix, however I think that using them will ultimately lead to both a simpler design on the translations infrastructure side and for nicer usage, because the translation keys can then be used just like the hard coded text would usually be used.
Honestly my reasons for wanting the live retranslation are mostly that there shouldn't be any technical problem with doing so and that it would be reeeeeally clean. Not the best of reasons all in all, but as long as it doesn't turn out to be too much of a hassle they are good enough for me to waste my own time on. |
I'd really like to avoid wrapper classes if possible since they add a lot of confusion to the codebase. Case and point there's already a wrapper class for the
I agree that it would be very nice to leverage Qt in a way that lets us re-translate widgets on the fly, which is why I was excited about your initial implementation. But even besides the issues currently being faced, there can always be UI edge cases that we don't account for or that this system corners us in. For example I'm not sure how well this would play with a situation where we had a layout such as a flowlayout that uses the initial text size to calculate the width of the widgets before performing the layout operation. My assumption is that any text that gets updated in such a layout would not automatically prompt the layout operation again, and we'd instead need to add additional manual code to anticipate the unlikely event that a re-translation would occur. |
👍
Yeah that is fair enough. In that case I think I will strip out the remains of the live retranslation and also remove the
|
…format and remove some unused code
This is now ready for review. |
translate_with_setter
translate_with_setter
by deleting the offending code
Aims to fix #750 by removing the offending methods along with the remains of the live retranslation and applying necessary refactors along the way.
If this PR is merged using translations would look like this in the future:
Note: I am kind of busy with other things at the moment so progress will be slow and halting. Also no worries if this takes a while to merge once it is done, since I just started working on this with communicating on that front first, my bad!