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
DolphinQt: Enable RTL layout #8006
Conversation
QStringLiteral("Syrj"), QStringLiteral("Syrn"), | ||
}; | ||
|
||
for (int i = 1; i < components.size(); ++i) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think theres a reason why this cannot be a range-based for-loop, can it?
Also, I wouldn't be surprised if there was an algorithm for this (altho I can't recall one from the top of my head)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It starts at 1 instead of 0 because I wanted to skip the main language code, so making it into a range-based for loop would be awkward.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main language code should never actually be 4 in size, though...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, kinda missed that :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of making this so hard on yourself you could just use
QStringList::takeFirst()
to take away the first component which you can then use in line 205
.
Now you would be able to use a for-range loop or better yet just turn your QStringList
into a QSet<QString>
and use
QSet::intersects
(which will return true if at least one item matches the other)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made it use QStringList::takeFirst
and a range-based for loop now.
However, I can't just use QSet::intersects
, because I want to return either true or false as soon as I find a script code (four-letter component). QSet::intersects
only lets me find matching script codes, not non-matching script codes.
Hmm, any thoughts on using the QT_LAYOUT_DIRECTION trick (where translators translate QT_LAYOUT_DIRECTION as either LTR or RTL themselves)? That'd remove the need for a hardcoded list of locales and scripts for which RTL is enabled. |
Does that work for Qt Widgets? I only found it in the documentation for Qt Quick. |
Yeah, I think it should. It's in the QGuiApplication code: https://github.com/qt/qtbase/blob/ef3daddae1720956e746142ac7ee54a27b9299d7/src/gui/kernel/qguiapplication.cpp#L1590 |
That's probably the way to go, then. I'll look into it. |
Any updates on this? |
No, I've been busy with other things. But I'm still planning to get around to it at some point. The reason this isn't a trivial change is because I believe I have to add some missing features to our translations loading code. |
Needed for the next commit. Downloaded from https://mlocati.github.io/articles/gettext-iconv-windows.html
Done. As part of making this change, I had to update msgfmt.exe in Externals. However, I can't find where we keep the source code for this executable. We do need to have the source code of it somewhere in order to comply with the GPL, right...? |
|
Fixes https://bugs.dolphin-emu.org/issues/11508