-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Fix system language autodetection on MacOS #22957
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 system language autodetection on MacOS #22957
Conversation
src/app/CMakeLists.txt
Outdated
@@ -100,6 +156,62 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") | |||
${qBittorrent_SOURCE_DIR}/dist/mac/qt.conf | |||
${qBittorrent_SOURCE_DIR}/dist/mac/qBitTorrentDocument.icns | |||
${qBittorrent_SOURCE_DIR}/dist/mac/qbittorrent_mac.icns | |||
${qBittorrent_SOURCE_DIR}/dist/mac/lproj/ar.lproj |
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 believe there should be a way to make it in a single entry using some wildcard.
Moreover, there may even be a way to create all these folders without storing empty folders in the resources.
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 have changed it so that the whole resources folder gets copied all at once so only one command is needed in the cmake file.
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 have changed it so that the whole resources folder gets copied all at once so only one command is needed in the cmake file.
I didn't mean it to be changed so much. Moreover there is another place where the files listed too.
I meant to use something like the one used in another similar case:
file(GLOB QBT_TS_FILES "${qBittorrent_SOURCE_DIR}/src/lang/*.ts")
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.
Now the names of the lproj folders are generated from the language codes of the .ts files in "${qBittorrent_SOURCE_DIR}/src/lang/*.ts") because of this the folders should automatically be added when new translations are added and there are no empty folders in the project directories.
Can't test - no access to mac, but seems to work from screenshots... |
Look at the top of |
The variable from the globbed ts files is now reused and the code is more at the top now. However the code only works if inserted after the |
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.
one last comment
@Ryu481 |
This needs to be backported or change it's milestone. |
Due to a change in MacOS Qlocale returns always english, when there are no language lproj folders in the app bundle. So the program would always start in english no matter what your system language is. This pr adds this folders so Qlocale returns the correct system language. Because of this change the program can detect the system language and, when a translation is available, the program starts in the correct language. The lproj folders are added to the Ressources folder in the app bundle. If new translations are added the corresponding lproj folders should be added for the new languages so that autodetection works for the new translations too. Bugreports in qt about this issue:
https://bugreports.qt.io/browse/QTBUG-72491
https://bugreports.qt.io/browse/QTBUG-63324
legalnotice in different languages on the first start so autodetection works now
German:

Japanese:

English:
