Browse Source

use language in config to choose wordlist

283
ThomasV 10 years ago
parent
commit
a2065eff72
  1. 9
      lib/mnemonic.py
  2. 3
      lib/wallet.py

9
lib/mnemonic.py

@ -34,8 +34,13 @@ class Mnemonic(object):
def __init__(self, lang=None): def __init__(self, lang=None):
if lang is None: if lang is None:
lang = 'english' filename = 'english.txt'
path = os.path.join(os.path.dirname(__file__), 'wordlist', lang + '.txt') elif lang[0:2] == 'pt':
filename = 'portuguese.txt'
else:
filename = 'english.txt'
path = os.path.join(os.path.dirname(__file__), 'wordlist', filename)
lines = open(path,'r').read().strip().split('\n') lines = open(path,'r').read().strip().split('\n')
self.wordlist = [] self.wordlist = []
for line in lines: for line in lines:

3
lib/wallet.py

@ -1298,7 +1298,8 @@ class BIP32_Wallet(Deterministic_Wallet):
return Mnemonic.mnemonic_to_seed(seed, password) return Mnemonic.mnemonic_to_seed(seed, password)
def make_seed(self): def make_seed(self):
return Mnemonic('english').make_seed() lang = self.storage.config.get('language')
return Mnemonic(lang).make_seed()
def prepare_seed(self, seed): def prepare_seed(self, seed):
return NEW_SEED_VERSION, Mnemonic.prepare_seed(seed) return NEW_SEED_VERSION, Mnemonic.prepare_seed(seed)

Loading…
Cancel
Save