Skip to content
This repository has been archived by the owner on Nov 21, 2019. It is now read-only.

Support importing Mnemonic Phrase in multiple languages #1705

Open
wants to merge 2 commits into
base: mercury
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion app/scripts/controllers/decryptWalletCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,33 @@ var decryptWalletCtrl = function($scope, $sce, walletService) {
};
$scope.onMnemonicChange = function() {
$scope.showAOnly = false;
$scope.showMDecrypt = hd.bip39.validateMnemonic($scope.manualmnemonic);
var lang = hd.bip39.wordlists.english;
switch(globalFuncs.curMnemonicLang){
case 'zhcn':
lang = hd.bip39.wordlists.chinese_simplified;
break
case 'zhtw':
lang = hd.bip39.wordlists.chinese_traditional;
break
case 'ja':
lang = hd.bip39.wordlists.japanese;
break
case 'ko':
lang = hd.bip39.wordlists.korean;
break
case 'es':
lang = hd.bip39.wordlists.spanish;
break
case 'it':
lang = hd.bip39.wordlists.italian;
break
case 'fr':
lang = hd.bip39.wordlists.french;
break
default:
break
}
$scope.showMDecrypt = hd.bip39.validateMnemonic($scope.manualmnemonic, lang);
};
$scope.onParityPhraseChange = function() {
if ($scope.parityPhrase) $scope.showParityDecrypt = true;
Expand Down
8 changes: 8 additions & 0 deletions app/scripts/controllers/tabsCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var tabsCtrl = function($scope, globalService, $translate, $sce) {
$scope.gService = globalService;
$scope.tabNames = $scope.gService.tabs;
$scope.curLang = 'English';
$scope.curMnemonicLang = 'English';
$scope.customNodeModal = document.getElementById('customNodeModal') ? new Modal(document.getElementById('customNodeModal')) : null;
$scope.Validator = Validator;
$scope.nodeList = nodes.nodeList;
Expand Down Expand Up @@ -257,6 +258,13 @@ var tabsCtrl = function($scope, globalService, $translate, $sce) {
}
}

$scope.changeMnemonic = function(key,value) {
$scope.curMnemonicLang = value;
$scope.dropdownMnemonic = false;
globalFuncs.curMnemonicLang = key;
$scope.onMnemonicChange();
}

$scope.changeLanguage = function(key, value) {
$translate.use(key);
$scope.setErrorMsgLanguage();
Expand Down
17 changes: 17 additions & 0 deletions app/scripts/directives/walletDecryptDrtv.html
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,23 @@ <h5>
If you must, please <u>double-check the URL &amp; SSL cert</u>. It should say <code>https://www.myetherwallet.com</code> &amp; <code>MYETHERWALLET LLC</code> in your URL bar.
</div>
<br />
<div class="form-group">
<span class="dropdown dropdown-lang" ng-cloak ng-controller='tabsCtrl'>
<span>Select your mnemonic phrase language:</span>
<br />
<a tabindex="0" aria-haspopup="true" aria-expanded="false" aria-label="change language. current language {{curMnemonicLang}}" class="dropdown-toggle btn btn-white" ng-click="dropdownMnemonic = !dropdownMnemonic;onMnemonicChange()">{{curMnemonicLang}}<i class="caret"></i></a>
<ul class="dropdown-menu" ng-show="dropdownMnemonic">
<li><a ng-class="{true:'active'}[curMnemonicLang=='English']" ng-click="changeMnemonic('en','English')"> English </a></li>
<li><a ng-class="{true:'active'}[curMnemonicLang=='简体中文']" ng-click="changeMnemonic('zhcn','简体中文')"> 简体中文 </a></li>
<li><a ng-class="{true:'active'}[curMnemonicLang=='繁體中文']" ng-click="changeMnemonic('zhtw','繁體中文')"> 繁體中文 </a></li>
<li><a ng-class="{true:'active'}[curMnemonicLang=='日本語']" ng-click="changeMnemonic('ja','日本語')"> 日本語 </a></li>
<li><a ng-class="{true:'active'}[curMnemonicLang=='한국어']" ng-click="changeMnemonic('ko','한국어')"> 한국어 </a></li>
<li><a ng-class="{true:'active'}[curMnemonicLang=='Español']" ng-click="changeMnemonic('es','Español')"> Español </a></li>
<li><a ng-class="{true:'active'}[curMnemonicLang=='Italiano']" ng-click="changeMnemonic('it','Italiano')"> Italiano </a></li>
<li><a ng-class="{true:'active'}[curMnemonicLang=='Français']" ng-click="changeMnemonic('fr','Français')"> Français </a></li>
</ul>
</span>
</div>
<div class="form-group">
<textarea id="aria4"
class="form-control"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.1",
"bignumber.js": "^4.0.2",
"bip39": "^2.3.1",
"bip39": "^2.5.0",
"browserify": "^14.3.0",
"detect-browser": "^1.7.0",
"ethereum-bip44": "^2.1.3",
Expand Down