diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-03-17 22:46:41 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-03-17 22:46:41 +0000 |
commit | 8ea3c4d54429976e9001b8cc4868b721e6747e3c (patch) | |
tree | 6c40d6a2d08336a9a57edcc143da028e6642dd97 /src/mnemonics/electrum-words.cpp | |
parent | Merge pull request #3421 (diff) | |
download | monero-8ea3c4d54429976e9001b8cc4868b721e6747e3c.tar.xz |
simplewallet: new --use-english-language-names flag
On some Windows systems, displaying language names in their own
languages freezes the display.
Diffstat (limited to 'src/mnemonics/electrum-words.cpp')
-rw-r--r-- | src/mnemonics/electrum-words.cpp | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/src/mnemonics/electrum-words.cpp b/src/mnemonics/electrum-words.cpp index f1fef2426..6a2a3e0c4 100644 --- a/src/mnemonics/electrum-words.cpp +++ b/src/mnemonics/electrum-words.cpp @@ -445,13 +445,9 @@ namespace crypto return bytes_to_words(src.data, sizeof(src), words, language_name); } - /*! - * \brief Gets a list of seed languages that are supported. - * \param languages The vector is set to the list of languages. - */ - void get_language_list(std::vector<std::string> &languages) + std::vector<const Language::Base*> get_language_list() { - std::vector<Language::Base*> language_instances({ + static const std::vector<const Language::Base*> language_instances({ Language::Singleton<Language::German>::instance(), Language::Singleton<Language::English>::instance(), Language::Singleton<Language::Spanish>::instance(), @@ -465,10 +461,20 @@ namespace crypto Language::Singleton<Language::Esperanto>::instance(), Language::Singleton<Language::Lojban>::instance() }); - for (std::vector<Language::Base*>::iterator it = language_instances.begin(); + return language_instances; + } + + /*! + * \brief Gets a list of seed languages that are supported. + * \param languages The vector is set to the list of languages. + */ + void get_language_list(std::vector<std::string> &languages, bool english) + { + const std::vector<const Language::Base*> language_instances = get_language_list(); + for (std::vector<const Language::Base*>::const_iterator it = language_instances.begin(); it != language_instances.end(); it++) { - languages.push_back((*it)->get_language_name()); + languages.push_back(english ? (*it)->get_english_language_name() : (*it)->get_language_name()); } } @@ -485,6 +491,18 @@ namespace crypto return word_list.size() != (seed_length + 1); } + std::string get_english_name_for(const std::string &name) + { + const std::vector<const Language::Base*> language_instances = get_language_list(); + for (std::vector<const Language::Base*>::const_iterator it = language_instances.begin(); + it != language_instances.end(); it++) + { + if ((*it)->get_language_name() == name) + return (*it)->get_english_language_name(); + } + return "<language not found>"; + } + } } |