mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-30 04:20:23 +00:00
Select "English" if the current language is not found in Preferences
If the user preferences file (aseprite.ini) contained a non-existent language, the first option of the languages combo box was selected, which might lead to a confusing situation where just opening the preferences dialog will change from English to other language (non-English, the first language in the combobox).
This commit is contained in:
parent
4d5bf53be8
commit
6a12c7014d
@ -1317,9 +1317,20 @@ private:
|
||||
if (language()->getItemCount() > 0)
|
||||
return;
|
||||
|
||||
// Select current language by lang ID
|
||||
// Check if the current language exists, in other case select English.
|
||||
Strings* strings = Strings::instance();
|
||||
std::string curLang = strings->currentLanguage();
|
||||
bool found = false;
|
||||
for (const LangInfo& lang : strings->availableLanguages()) {
|
||||
if (lang.id == curLang) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
curLang = Strings::kDefLanguage;
|
||||
|
||||
// Select current language by lang ID
|
||||
for (const LangInfo& lang : strings->availableLanguages()) {
|
||||
int i = language()->addItem(new LangItem(lang));
|
||||
if (lang.id == curLang)
|
||||
|
@ -25,7 +25,8 @@
|
||||
namespace app {
|
||||
|
||||
static Strings* singleton = nullptr;
|
||||
static const char* kDefLanguage = "en";
|
||||
|
||||
const char* Strings::kDefLanguage = "en";
|
||||
|
||||
// static
|
||||
void Strings::createInstance(Preferences& pref,
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2023 Igara Studio S.A.
|
||||
// Copyright (C) 2023-2024 Igara Studio S.A.
|
||||
// Copyright (C) 2016-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -25,6 +25,8 @@ namespace app {
|
||||
// Singleton class to load and access "strings/en.ini" file.
|
||||
class Strings : public app::gen::Strings<app::Strings> {
|
||||
public:
|
||||
static const char* kDefLanguage;
|
||||
|
||||
static void createInstance(Preferences& pref,
|
||||
Extensions& exts);
|
||||
static Strings* instance();
|
||||
|
Loading…
x
Reference in New Issue
Block a user