From 48f205dc3d1ce558e0f95aca928a62431d4d5692 Mon Sep 17 00:00:00 2001 From: Steven Schmid Date: Wed, 27 Dec 2017 16:18:29 +0100 Subject: [PATCH] Fallback to enUS for enGB --- src/HearthstoneCardDB.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/HearthstoneCardDB.cpp b/src/HearthstoneCardDB.cpp index f8685fa..3a2cdeb 100644 --- a/src/HearthstoneCardDB.cpp +++ b/src/HearthstoneCardDB.cpp @@ -32,16 +32,24 @@ QString HearthstoneCardDB::Type( const QString& id ) const { return mCards[ id ][ "type" ].toString(); } +QString LocaleForCardDB() { + QString locale = Hearthstone::Instance()->DetectLocale(); + if( locale == "enGB" ) { + locale = "enUS"; + } + return locale; +} + QString HearthstoneCardDB::CardsJsonLocalPath() { int build = Hearthstone::Instance()->DetectBuild(); - QString locale = Hearthstone::Instance()->DetectLocale(); + QString locale = LocaleForCardDB(); QString appDataLocation = QStandardPaths::standardLocations( QStandardPaths::AppDataLocation ).first(); return QString( "%1/cards_%2_%3.json" ).arg( appDataLocation ).arg( build ).arg( locale ); } QString HearthstoneCardDB::CardsJsonRemoteUrl() { int build = Hearthstone::Instance()->DetectBuild(); - QString locale = Hearthstone::Instance()->DetectLocale(); + QString locale = LocaleForCardDB(); return QString( "%1/%2/%3/cards.json" ).arg( HEARTHSTONE_JSON_API_URL ).arg( build ).arg( locale ); }