Skip to content
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

datetime display fixed for OSs with non-English localization #3204

Merged

Conversation

Vafthrudnir
Copy link
Contributor

Related Ticket(s)

Short roundup of the initial problem

Time of last spoiler update was not displayed on OS-s where the localization was set to other than English.

QDateTime::fromString() method tries to parse the given string based on the OS's default localization setting, which caused an invalid date, since the string was in English. Setting QLocale default to English and using it to parse dates instead of QDateTime solved the problem.

Screenshots

image

@@ -165,11 +166,11 @@ bool SpoilerBackgroundUpdater::saveDownloadedFile(QByteArray data)
QList<QByteArray> lines = data.split('\n');

foreach (QByteArray line, lines) {
if (line.indexOf("created:") > -1) {
if (line.contains("created:")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Vafthrudnir
Copy link
Contributor Author

Vafthrudnir commented Apr 16, 2018

Added the localization settings and cockatrice language to the logs. Localization is only checked on startup, and language is logged with every change.

Client Version: 2.5.0-custom(cc2a0fa) (2018-04-10)
Client Operating System: Windows 10
Build Architecture: 32-bit
Qt Version: 5.7.1
System Locale: hu_HU
Theme name not set, setting default value
Theme changed: "Default"
Sounds theme name not set, setting default value
SoundEngine: disabling sound
Sound theme changed: "Default"
SoundEngine: disabling sound
Language changed:  "en@pirate"
main(): starting main program

@tooomm
Copy link
Member

tooomm commented Apr 16, 2018

Client Version: 2.5.0-custom(e00467c) (2018-04-16)
Client Operating System: Windows 10 (10.0)
Build Architecture: 64-bit
Qt Version: 5.9.4
System Locale: de_DE
Theme changed: "Magic The Gathering"
SoundEngine: disabling sound
Sound theme changed: "Default"
SoundEngine: disabling sound
Language changed:  "en"
main(): starting main program
main(): MainWindow constructor finished
CardDatabase::loadCardDatabases start
main(): ui.show() finished

There is a double space between Language changed: and "en", same in your example @Vafthrudnir.

Otherwise it works for me and the date is correctly shown again! Awesome 👍

@ZeldaZach ZeldaZach merged commit 67a2a8c into Cockatrice:master Apr 17, 2018
@Vafthrudnir Vafthrudnir deleted the hotfix/3140_spoiler_pop_up_timedate branch May 9, 2018 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants