Localization improvements and fixes #956
Loading…
Reference in a new issue
No description provided.
Delete branch "i18n-fixes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR aims to fix several issues in UI localization that I've found while working to update the Italian translation to the latest version.
The issues I've fixed can be roughly divided in the following categories:
Overall, there is a fair amount of different changes in this PR, but they should be fairly quick and easy to review commit by commit.
Looks good!
Just one nitpick:
We have specific wrappers for string conversation to guaranteed that all
std::string
are utf8. For wxString <-> std::string there is to_wxstring/from_wxstring. Always use this over e.g..ToStdString()
Thanks for letting me know!
I noticed that wxWidgets actually has a
.utf8_string()
method that does the same thing, so I used that instead.At that point I admit I got a bit sidetracked and took the opportunity to use
.utf8_string()
everywhere in place ofToStdString
andfrom_wxstring
.But not only that: when I saw the helper
wxStringFormat2
I thought "why not use it instead of repeatingfmt::format(fmt:::runtime([].utf8_string())
all the time?", and that's what I did. I also renamed it intoformatWxString
because thewx
prefix initially misled me into thinking that it was a method coming from wxWidgets.And that's how this PR became way bigger than I anticipated 😅
Hope it won't be much of a hassle reviewing the 3 commits I added following your comment.
FYI Using wxWidgets functions in the emulation core (or really anything outside of
src/gui
subdirectory) is something we ideally want to avoid. The goal is to fully decouple UI code from the core eventually to make it possible to introduce other UI libraries. Hence it is preferable to usestd::format
overformatWxString
in the core. Of course there are other existing issues too like direct calls towxMessageBox
and various wx dialogs but let that be a problem for another day.At any rate this PR looks good as-is. Thanks!
Yeah makes a lot of sense. But as you've already pointed out, the real problem here is calling
wxMessageBox
outside the GUI code... unless we move those calls outside the core, we have no choice but to deal withwxString
s in one way or another 🤷♂️