mirror of
https://github.com/monero-project/monero.git
synced 2024-11-18 00:37:43 +00:00
simplewallet: fix language detection when using --use-english-language-names
This commit is contained in:
parent
702a41034d
commit
5e675de7c2
2 changed files with 20 additions and 52 deletions
|
@ -70,6 +70,14 @@
|
|||
#undef MONERO_DEFAULT_LOG_CATEGORY
|
||||
#define MONERO_DEFAULT_LOG_CATEGORY "mnemonic"
|
||||
|
||||
namespace crypto
|
||||
{
|
||||
namespace ElectrumWords
|
||||
{
|
||||
std::vector<const Language::Base*> get_language_list();
|
||||
}
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
uint32_t create_checksum_index(const std::vector<std::string> &word_list,
|
||||
|
@ -376,56 +384,14 @@ namespace crypto
|
|||
|
||||
if (len % 4 != 0 || len == 0) return false;
|
||||
|
||||
Language::Base *language;
|
||||
if (language_name == "English")
|
||||
const Language::Base *language = NULL;
|
||||
const std::vector<const Language::Base*> language_list = crypto::ElectrumWords::get_language_list();
|
||||
for (const Language::Base *l: language_list)
|
||||
{
|
||||
language = Language::Singleton<Language::English>::instance();
|
||||
if (language_name == l->get_language_name() || language_name == l->get_english_language_name())
|
||||
language = l;
|
||||
}
|
||||
else if (language_name == "Nederlands")
|
||||
{
|
||||
language = Language::Singleton<Language::Dutch>::instance();
|
||||
}
|
||||
else if (language_name == "Français")
|
||||
{
|
||||
language = Language::Singleton<Language::French>::instance();
|
||||
}
|
||||
else if (language_name == "Español")
|
||||
{
|
||||
language = Language::Singleton<Language::Spanish>::instance();
|
||||
}
|
||||
else if (language_name == "Português")
|
||||
{
|
||||
language = Language::Singleton<Language::Portuguese>::instance();
|
||||
}
|
||||
else if (language_name == "日本語")
|
||||
{
|
||||
language = Language::Singleton<Language::Japanese>::instance();
|
||||
}
|
||||
else if (language_name == "Italiano")
|
||||
{
|
||||
language = Language::Singleton<Language::Italian>::instance();
|
||||
}
|
||||
else if (language_name == "Deutsch")
|
||||
{
|
||||
language = Language::Singleton<Language::German>::instance();
|
||||
}
|
||||
else if (language_name == "русский язык")
|
||||
{
|
||||
language = Language::Singleton<Language::Russian>::instance();
|
||||
}
|
||||
else if (language_name == "简体中文 (中国)")
|
||||
{
|
||||
language = Language::Singleton<Language::Chinese_Simplified>::instance();
|
||||
}
|
||||
else if (language_name == "Esperanto")
|
||||
{
|
||||
language = Language::Singleton<Language::Esperanto>::instance();
|
||||
}
|
||||
else if (language_name == "Lojban")
|
||||
{
|
||||
language = Language::Singleton<Language::Lojban>::instance();
|
||||
}
|
||||
else
|
||||
if (!language)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -3344,14 +3344,16 @@ bool simple_wallet::try_connect_to_daemon(bool silent, uint32_t* version)
|
|||
*/
|
||||
std::string simple_wallet::get_mnemonic_language()
|
||||
{
|
||||
std::vector<std::string> language_list;
|
||||
std::vector<std::string> language_list_self, language_list_english;
|
||||
const std::vector<std::string> &language_list = m_use_english_language_names ? language_list_english : language_list_self;
|
||||
std::string language_choice;
|
||||
int language_number = -1;
|
||||
crypto::ElectrumWords::get_language_list(language_list, m_use_english_language_names);
|
||||
crypto::ElectrumWords::get_language_list(language_list_self, false);
|
||||
crypto::ElectrumWords::get_language_list(language_list_english, true);
|
||||
std::cout << tr("List of available languages for your wallet's seed:") << std::endl;
|
||||
std::cout << tr("If your display freezes, exit blind with ^C, then run again with --use-english-language-names") << std::endl;
|
||||
int ii;
|
||||
std::vector<std::string>::iterator it;
|
||||
std::vector<std::string>::const_iterator it;
|
||||
for (it = language_list.begin(), ii = 0; it != language_list.end(); it++, ii++)
|
||||
{
|
||||
std::cout << ii << " : " << *it << std::endl;
|
||||
|
@ -3375,7 +3377,7 @@ std::string simple_wallet::get_mnemonic_language()
|
|||
fail_msg_writer() << tr("invalid language choice entered. Please try again.\n");
|
||||
}
|
||||
}
|
||||
return language_list[language_number];
|
||||
return language_list_self[language_number];
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
boost::optional<tools::password_container> simple_wallet::get_and_verify_password() const
|
||||
|
|
Loading…
Reference in a new issue