diff --git a/src/core/application.cpp b/src/core/application.cpp index d910eedf1..b01cf5450 100644 --- a/src/core/application.cpp +++ b/src/core/application.cpp @@ -157,6 +157,14 @@ void Application::AddError(const QString& message) { emit ErrorAdded(message); } +QString Application::language_without_region() const { + const int underscore = language_name_.indexOf('_'); + if (underscore != -1) { + return language_name_.left(underscore); + } + return language_name_; +} + LibraryBackend* Application::library_backend() const { return library()->backend(); } diff --git a/src/core/application.h b/src/core/application.h index 6c703a789..d5f471158 100644 --- a/src/core/application.h +++ b/src/core/application.h @@ -55,7 +55,9 @@ public: Application(QObject* parent = NULL); ~Application(); - QString language_name() const { return language_name_; } + const QString& language_name() const { return language_name_; } + // Same as language_name, but remove the region code at the end if there is one + QString language_without_region() const; void set_language_name(const QString& name) { language_name_ = name; } TagReaderClient* tag_reader_client() const { return tag_reader_client_; } diff --git a/src/ui/networkremotesettingspage.cpp b/src/ui/networkremotesettingspage.cpp index d4f6dc759..f08729ffb 100644 --- a/src/ui/networkremotesettingspage.cpp +++ b/src/ui/networkremotesettingspage.cpp @@ -89,11 +89,7 @@ void NetworkRemoteSettingsPage::Load() { ui_->ip_address->setText(ip_addresses); // Get the right play store badge for this language. - QString language = dialog()->app()->language_name(); - const int underscore = language.indexOf('_'); - if (underscore != -1) { - language = language.left(underscore); - } + QString language = dialog()->app()->language_without_region(); QString badge_filename = ":/playstore/" + language + "_generic_rgb_wo_45.png"; if (!QFile::exists(badge_filename)) {