Skip to content

Commit

Permalink
Merge pull request #1 from FidelVe/master
Browse files Browse the repository at this point in the history
Language support
  • Loading branch information
Spl3en authored May 18, 2019
2 parents ddb7e02 + 800c3ac commit 4b38add
Show file tree
Hide file tree
Showing 23 changed files with 1,179 additions and 137 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ bin/*
resources
Svalinn-win32-x64
Svalinn-win32-x64.*
yarn.lock
TODO
31 changes: 28 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { app, Tray, Menu } = require('electron');
const { app, Tray, Menu, MenuItem, ipcMain, BrowserWindow } = require('electron');
const path = require('path');
const fs = require('fs');
const url = require('url');
Expand All @@ -20,9 +20,12 @@ const DEFAULT_SETTINGS = {
tray_close: false,
darkmode: false,
};
const DEFAULT_SIZE = { width: 840, height: 840 };
const DEFAULT_SIZE = { width: 840, height: 840 };
const WIN_TITLE = `${config.appName} ${SVALINN_VERSION} - ${config.appDescription}`;

// language list in order
const LOCALE_LIST = require("./src/js/i18n/lang-config.json").order;

app.prompExit = true;
app.prompShown = false;
app.needToExit = false;
Expand Down Expand Up @@ -195,6 +198,9 @@ function createWindow()
});

win.setMenu(null);

//i18n menu
i18nMenu(LOCALE_LIST);

// misc handler
win.webContents.on('crashed', () => {
Expand Down Expand Up @@ -274,4 +280,23 @@ app.on('ready', () => {
if (tx > 0 && ty > 0) {
try { win.setPosition(parseInt(tx, 10), parseInt(ty, 10)); } catch (_e) { }
}
});
});

function i18nMenu(locales) {
//contextual menu for when clicking on the language button
const _langContext = new Menu();
for (let each of locales) {
_langContext.append(new MenuItem({label: each, click: changeAppLanguage}));
};

ipcMain.on('select-lang', (event) => {
const win = BrowserWindow.fromWebContents(event.sender);
_langContext.popup(win);
});
}

function changeAppLanguage(selectedLang) {
//Sends a message from the main process to the renderer process with the language that the user selected
let lang = selectedLang.label;
win.webContents.send('change-lang', lang);
}
8 changes: 4 additions & 4 deletions src/html/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<img src="../assets/splash_logo.png" class="ab" />
</div>
</div>
<div class="about-content-text">
<div class="about-content-text" data-i18n="about-text-1">
<p>This is a GUI front-end to manage ICX assets (ICX).</p>
<p>You can use this software to create and import new ICX wallets, or open existing wallets.
Then you can manage your wallet, such as viewing your balance and transactions history,
Expand All @@ -20,8 +20,8 @@

<div class="splitted-area splitted-2">
<div class="splitted-content first">
<p class="small-space">Donate to: <strong>ICONation</strong></p>
<input data-cplabel="ICONation's wallet address" tabindex="0" data-noclear="1" title="Click to copy" type="text" class="text-block small-space ctcl" value="cx87fda925272496ae3f0bdeb551dad8fd29e0c7cf" readonly="readonly" />
<p class="small-space" data-i18n="about-text-2">Donate to: <strong>ICONation</strong></p>
<input data-cplabel="ICONation's wallet address" tabindex="0" data-noclear="1" title="Click to copy" type="text" class="text-block small-space ctcl" value="cx87fda925272496ae3f0bdeb551dad8fd29e0c7cf" readonly="readonly" data-i18n="about-text-3"/>
</div>
</div>

Expand Down Expand Up @@ -204,7 +204,7 @@
</div>
</div>

<p class="text-center">
<p class="text-center" data-i18n="about-text-4">
Source codes, release notes, documentations & bugs tracker can be found at our Github repo:<br>
<a tabindex="0" class="external" href="https://github.com/ICONation/svalinn">https://github.com/ICONation/svalinn</a>
</p>
Expand Down
18 changes: 9 additions & 9 deletions src/html/address_book.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
<section class="section" id="section-addressbook">
<div class="section-contents">
<div class="div-title">
<h2 class="title">Address Book</h2>
<h2 class="title" data-i18n="address-book-text-1">Address Book</h2>
</div>
<div class="div-addressbook-input default-inputs">
<div class="splitted-area splitted-2 ab-tools">
<div class="splitted-content first">
<div class="input-wrap">
<h4 class="text-spaced input-required">Search</h4>
<input tabindex="0" id="ab-search" class="text-block search noenter" placeholder="Search by name or wallet address" />
<h4 class="text-spaced input-required" data-i18n="address-book-text-2">Search</h4>
<input tabindex="0" id="ab-search" class="text-block search noenter" data-i18n="address-book-text-3" placeholder="Search by name or wallet address" />
</div>
</div>
<div class="splitted-content last">
<div class="input-wrap">
<h4 class="text-spaced input-required">Select address book</h4>
<h4 class="text-spaced input-required" data-i18n="address-book-text-4">Select address book</h4>
<select id="addressBookSelector" name="loadedAddressBook" class="text-block wtl">
<option value="default">Default/Built-in Address Book</option>
<option value="default" data-i18n="address-book-text-5">Default/Built-in Address Book</option>
</select>
<a href="#" tabindex="0" id="addAddressBook" class="input-extra-link" title="Create new address book">
<a href="#" tabindex="0" id="addAddressBook" data-i18n="address-book-text-6" class="input-extra-link" title="Create new address book">
<i class="fas fa-plus-circle"></i>
</a>
</div>
Expand All @@ -31,10 +31,10 @@ <h4 class="text-spaced input-required">Select address book</h4>
</div>
<!-- <div class="input-wrap button-wrap" style="margin-top: 0;"> -->
<div class="action-buttons">
<button type="button" class="form-bt button-green" data-section="section-addressbook-add">Add New Entry</button>
<button type="button" class="form-bt button-red" data-section="section-overview">Back</button>
<button type="button" class="form-bt button-green" data-section="section-addressbook-add" data-i18n="address-book-text-7">Add New Entry</button>
<button type="button" class="form-bt button-red" data-section="section-overview" data-i18n="address-book-text-8">Back</button>
</div>

</div>
</section>
</template>
</template>
14 changes: 7 additions & 7 deletions src/html/address_book_add.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
<section class="section" id="section-addressbook-add">
<div class="section-contents darkened">
<div class="div-title">
<h2 class="title">Add Address Book Entry</h2>
<h2 class="title" data-i18n="address-add-text-1">Add Address Book Entry</h2>
</div>
<div class="div-addressbook-input default-inputs">
<div class="input-wrap">
<h4 class="text-spaced input-required">Name</h4>
<input required="required" class="text-block" id="input-addressbook-name"
<h4 class="text-spaced input-required" data-i18n="address-add-text-2">Name</h4>
<input required="required" class="text-block" id="input-addressbook-name" data-i18n="address-add-text-3"
placeholder="Required, give a unique name/label to make it easy to identify..."
/>
</div>

<div class="input-wrap">
<h4 class="text-spaced input-required">Wallet Address</h4>
<input required="required" class="text-block" id="input-addressbook-wallet"
<h4 class="text-spaced input-required" data-i18n="address-add-text-4">Wallet Address</h4>
<input required="required" class="text-block" id="input-addressbook-wallet" data-i18n="address-add-text-5"
placeholder="Required, a valid ICX address, non unique address is allow as long as it have different payment id..."
/>
</div>
Expand All @@ -29,8 +29,8 @@ <h4 class="text-spaced input-required">Wallet Address</h4>
</div>
</div>
<div class="action-buttons">
<button type="button" class="form-bt button-green" id="button-addressbook-save">Save</button>
<button type="button" class="form-bt button-red" data-section="section-addressbook" id="button-addressbook-back">Back</button>
<button type="button" class="form-bt button-green" id="button-addressbook-save" data-i18n="address-add-text-6">Save</button>
<button type="button" class="form-bt button-red" data-section="section-addressbook" id="button-addressbook-back" data-i18n="address-add-text-7">Back</button>
</div>
</div>
</section>
Expand Down
55 changes: 28 additions & 27 deletions src/html/create_transaction.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,64 @@
<div class="section-contents darkened">

<div class="div-title">
<h2 class="title">Create ICX transaction</h2>
<h2 class="title" data-i18n="create-text-1">Create ICX transaction</h2>
</div>

<div class="div-input">

<div class="input-wrap">
<h4 class="text-spaced input-required">Wallet password</h4>
<h4 class="text-spaced input-required" data-i18n="create-text-2">Wallet password</h4>
<input required="required" autofocus="true" tabindex="0" type="password"
class="text-block" id="create-transaction-wallet-password"
class="text-block" id="create-transaction-wallet-password" data-i18n="create-text-3"
placeholder="Password to open this wallet..."
/>
<button tabindex="-1" class="togpass notabindex" data-pf="create-transaction-wallet-password"><i class="fas fa-eye"></i></button>
</div>

<div class="input-wrap">
<h4 class="text-spaced input-required">Recipient Address</h4>
<input tabindex="0" required="required" class="text-block" id="create-transaction-recipient-address"
<h4 class="text-spaced input-required" data-i18n="create-text-4">Recipient Address</h4>
<input tabindex="0" required="required" class="text-block" id="create-transaction-recipient-address" data-i18n="create-text-5"
placeholder="Required, a valid ICX address..."
/>
<span class="form-help">Type one or more characters to search from address book, or type new address.</span>
</div>
<span class="form-help" data-i18n="create-text-6">Type one or more characters to search from address book, or type new address.</span>
</div>

<div class="input-wrap">
<div class="div-send-amount inline-block-div half-width">
<h4 class="text-spaced input-required">Amount (ICX)</h4>
<input tabindex="0" title="Required, amount of ICX you want to send."
data-noclear="1" value="0" required="required" type="number" step="0.1"
min="0" class="text-block" id="create-transaction-icx-amount"
placeholder="0"
/>
</div>
<div class="div-send-fee inline-block-div half-width half-width-end">
<h4 class="text-spaced input-required">Step Limit (step)</h4>
<div class="input-wrap">
<div class="div-send-amount inline-block-div half-width">
<h4 class="text-spaced input-required" data-i18n="create-text-7">Amount (ICX)</h4>
<input tabindex="0" title="Required, amount of ICX you want to send."
data-noclear="1" value="0" required="required" type="number" step="0.1"
min="0" class="text-block" id="create-transaction-icx-amount" data-i18n="create-text-8"
placeholder="0"
/>
</div>
<div class="div-send-fee inline-block-div half-width half-width-end">
<h4 class="text-spaced input-required" data-i18n="create-text-9">Step Limit (step)</h4>
<!--The following input element has 2 "required='required'" tags. Can 1 be deleted? -->
<input tabindex="0" title="Required, Step price is paid in loop and 1 loop is fixed to 0.000000000000000001 (10^18) ICX. ICON transaction fee is imposed according to various factors such as the number of smart contract usage, the amount of blockchain database used and the size of transaction data, etc."
required="required" data-noclear="1" value="100000" required="required" type="number" step="10000" min="100000"
class="text-block" id="create-transaction-step-limit" placeholder="100000"
class="text-block" id="create-transaction-step-limit" data-i18n="create-text-10" placeholder="100000"
/>
</div>
</div>

<div class="input-wrap">
<h4 class="text-spaced input-required">Select where the transaction file will be stored</h4>
<h4 class="text-spaced input-required" data-i18n="create-text-11">Select where the transaction file will be stored</h4>
<input required="required" data-fileobj="transaction file" data-extension="tx" data-object="Transactions"
data-selection="saveFile" data-targetinput="create-transaction-txfile"
readonly="readonly" class="text-block path-input-button" id="create-transaction-txfile"
readonly="readonly" class="text-block path-input-button" id="create-transaction-txfile" data-i18n="create-text-12"
placeholder="Required, full path to store this transaction..."
/>
<button data-fileobj="transaction file" data-extension="tx" data-object="Transactions" data-selection="saveFile" data-targetinput="create-transaction-txfile" type="button" class="button-green path-input-button notabindex" id="button-create-browse"><i class="fas fa-folder-open"></i></button>
</div>

<div class="input-wrap">
<h4 class="text-spaced input-required">Select network</h4>
<h4 class="text-spaced input-required" data-i18n="create-text-13">Select network</h4>
<label class="select-label">
<select required="required" tabindex="0" name="node-address" id="create-transaction-node-network" class="text-block">
<option value="1">Mainnet</option>
<option value="2">Testnet for Exchanges (Euljiro)</option>
<option value="3">Testnet for DApps (Yeouido)</option>
<option value="1" data-i18n="create-text-14">Mainnet</option>
<option value="2" data-i18n="create-text-15">Testnet for Exchanges (Euljiro)</option>
<option value="3" data-i18n="create-text-16">Testnet for DApps (Yeouido)</option>
</select>
</label>
</div>
Expand All @@ -72,8 +73,8 @@ <h4 class="text-spaced input-required">Select network</h4>
</div>

<div class="action-buttons">
<button type="button" class="form-bt button-green" id="button-create-transaction-create">Create</button>
<button type="button" class="form-bt button-red" data-section="section-overview" id="button-create-transaction-back">Back</button>
<button type="button" class="form-bt button-green" id="button-create-transaction-create" data-i18n="create-text-17">Create</button>
<button type="button" class="form-bt button-red" data-section="section-overview" id="button-create-transaction-back" data-i18n="create-text-18">Back</button>
</div>
</div>
</section>
Expand Down
Loading

0 comments on commit 4b38add

Please sign in to comment.