Skip to content

Commit

Permalink
i18nized
Browse files Browse the repository at this point in the history
  • Loading branch information
hackmod committed Apr 20, 2018
1 parent fce7676 commit bd505b0
Show file tree
Hide file tree
Showing 24 changed files with 677 additions and 149 deletions.
15 changes: 15 additions & 0 deletions www/app/controllers/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Ember from 'ember';
import config from '../config/environment';

export default Ember.Controller.extend({
intl: Ember.inject.service(),
get config() {
return config.APP;
},
Expand Down Expand Up @@ -65,6 +66,20 @@ export default Ember.Controller.extend({
}
}),

// FIXME
languages: Ember.computed({
get() {
let intl = this.get('intl');
return [ { name: intl.t('lang.korean'), value: 'ko'}, { name: intl.t('lang.english'), value: 'en-us'} ];
}
}),

selectedLanguage: Ember.computed({
get() {
return Ember.$.cookie('lang');
}
}),

roundVariance: Ember.computed('model', {
get() {
var percent = this.get('model.stats.roundShares') / this.get('difficulty');
Expand Down
2 changes: 2 additions & 0 deletions www/app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ Router.map(function() {
});

this.route('help');
this.route('help-ko');
this.route('payments');
this.route('miners');
this.route('about');
this.route('about-ko');
});

export default Router;
53 changes: 52 additions & 1 deletion www/app/routes/application.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,62 @@
import Ember from 'ember';
import config from '../config/environment';

function selectLocale(selected) {
// FIXME
let supported = ['en', 'ko', 'en-us'];
const language = navigator.languages[0] || navigator.language || navigator.userLanguage;

let locale = selected;

if (locale == null) {
// default locale
locale = language;
if (supported.indexOf(locale) < 0) {
locale = locale.replace(/\-[a-zA-Z]*$/, '');
}
}
if (supported.indexOf(locale) >= 0) {
if (locale === 'en') {
locale = 'en-us';
}
} else {
locale = 'en-us';
}
return locale;
}

export default Ember.Route.extend({
intl: Ember.inject.service(),
selectedLanguage: null,

beforeModel() {
this.get('intl').setLocale('en-us');
let locale = this.get('selectedLanguage');
if (!locale) {
// read cookie
locale = Ember.$.cookie('lang');
// pick a locale
locale = selectLocale(locale);

this.get('intl').setLocale(locale);
Ember.$.cookie('lang', locale);
console.log('INFO: locale selected - ' + locale);
this.set('selectedLanguage', locale);
}
},

actions: {
selectLanguage: function() {
let selected = Ember.$('option:selected').attr('value');
if (typeof selected === 'undefined') {
return true;
}
let locale = selectLocale(selected);
this.get('intl').setLocale(locale);
this.set('selectedLanguage', locale);
Ember.$.cookie('lang', locale);

return true;
}
},

model: function() {
Expand Down
22 changes: 22 additions & 0 deletions www/app/templates/about-ko.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<div class="container">
<div class="page-header">
<h1>이곳에 대하여</h1>
</div>
<h3>이용약관</h3>
<p>이곳에서 사용하고 있는 자유 소프트웨어 때문에 발생가능할 수 있는 문제에 대해서 보증하지 않습니다.<br/>
이 풀을 이용하는 사용자는 이로 인하여 발생할 수 있는 문제에 대하여 인정하는 것으로 간주합니다.<br/>
풀 운영자는 되돌릴 수 없는 손실에 대해 보상할 수 없습니다만, 그렇지 않은 경우에 대해서는 최악의 상황을 막기 위해서 최선을 다하고 있습니다.
</p>

<h3>풀의 지원 사항</h3>
<p>
<ul>
<li>Go 언어로 작성되어 매우 빠른 동시처리와 낮은 메모리 사용률을 가집니다</li>
<li>최상의 성능의 프록시</li>
<li>출금 및 블럭 unlocking 모듈 지원</li>
<li>100% 분산 환경으로 디자인 됨</li>
<li>Strict policy 정책 모듈 지원</li>
<li>아름다운 현대적 Ember.js 프론트엔드 사용</li>
</ul>
</p>
</div>
34 changes: 17 additions & 17 deletions www/app/templates/account.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,40 @@
<div class="row">
<div class="col-md-4 stats">
<div style="display: block;">
<i class="fa fa-cloud"></i> Immature Balance: <span>{{format-balance model.stats.immature}}</span><br>
<small>Preliminary balance awaiting blocks to mature.</small>
<i class="fa fa-cloud"></i> {{t "account.immature.balance"}}: <span>{{format-balance model.stats.immature}}</span><br>
<small>{{t "account.immature.description"}}</small>
</div>
<div style="display: block;">
<i class="fa fa-bank"></i> Pending Balance: <span>{{format-balance model.stats.balance}}</span><br>
<small>Credited coins awaiting payout.</small>
<i class="fa fa-bank"></i> {{t "account.pending.balance"}}: <span>{{format-balance model.stats.balance}}</span><br>
<small>{{t "account.pending.description"}}</small>
</div>
{{#if model.stats.pending}}
<div style="display: block;">
<i class="fa fa-clock-o"></i> Current Payment: <span>{{format-balance model.stats.pending}}</span><br>
<i class="fa fa-clock-o"></i> {{t "account.current"}}: <span>{{format-balance model.stats.pending}}</span><br>
</div>
{{/if}}
<div style="display: block;"><i class="fa fa-money"></i> Total Paid: <span>{{format-balance model.stats.paid}}</span></div>
<div style="display: block;"><i class="fa fa-money"></i> {{t "account.total.paid"}}: <span>{{format-balance model.stats.paid}}</span></div>
</div>
<div class="col-md-4 stats">
{{#if model.stats.lastShare}}
<div style="display: block;"><i class="fa fa-clock-o"></i>
Last Share Submitted: <span>{{format-relative (seconds-to-ms (string-to-int model.stats.lastShare))}}</span>
{{t "account.last_share_submitted"}}: <span>{{format-relative (seconds-to-ms (string-to-int model.stats.lastShare))}}</span>
</div>
{{/if}}
<div style="display: block;"><i class="fa fa-gears"></i> Workers Online: <span>{{format-number model.workersOnline}}</span></div>
<div style="display: block;"><i class="fa fa-tachometer"></i> Hashrate (30m): <span>{{format-hashrate model.currentHashrate}}</span></div>
<div style="display: block;"><i class="fa fa-tachometer"></i> Hashrate (3h): <span>{{format-hashrate model.hashrate}}</span></div>
<div style="display: block;"><i class="fa fa-gears"></i> {{t "account.online"}}: <span>{{format-number model.workersOnline}}</span></div>
<div style="display: block;"><i class="fa fa-tachometer"></i> {{t "account.hashrate"}} (30m): <span>{{format-hashrate model.currentHashrate}}</span></div>
<div style="display: block;"><i class="fa fa-tachometer"></i> {{t "account.hashrate"}} (3h): <span>{{format-hashrate model.hashrate}}</span></div>
</div>
<div class="col-md-4 stats">
<div style="display: block;"><i class="fa fa-tachometer"></i> Blocks Found: <span>{{format-number model.stats.blocksFound fallback='0'}}</span></div>
<div style="display: block;"><i class="fa fa-paper-plane-o"></i> Total Payments: <span>{{format-number model.paymentsTotal}}</span></div>
<div style="display: block;"><i class="fa fa-tachometer"></i> {{t "account.blocks.found"}}: <span>{{format-number model.stats.blocksFound fallback='0'}}</span></div>
<div style="display: block;"><i class="fa fa-paper-plane-o"></i> {{t "account.total.payments"}}: <span>{{format-number model.paymentsTotal}}</span></div>
<div style="display: block;">
<i class="fa fa-gears"></i> Your Round Share: <span>{{format-number roundPercent style='percent' maximumFractionDigits='6'}}</span><br/>
<small>Percent of your contribution to current round.</small>
<i class="fa fa-gears"></i> {{t "account.round_share"}}: <span>{{format-number roundPercent style='percent' maximumFractionDigits='6'}}</span><br/>
<small>{{t "account.round_share_description"}}</small>
</div>
<div style="display: block;">
<i class="fa fa-clock-o"></i>
Epoch Switch: <span>{{format-relative applicationController.nextEpoch units="hour"}}</span>
{{t "account.epoch_switch"}}: <span>{{format-relative applicationController.nextEpoch units="hour"}}</span>
</div>
</div>
</div>
Expand All @@ -47,10 +47,10 @@
<div class="container">
<ul class="nav nav-tabs">
{{#active-li currentWhen='account.index' role='presentation'}}
{{#link-to 'account.index'}}Workers <span class="badge alert-danger">{{model.workersOffline}}</span>{{/link-to}}
{{#link-to 'account.index'}}{{t "account.workers"}} <span class="badge alert-danger">{{model.workersOffline}}</span>{{/link-to}}
{{/active-li}}
{{#active-li currentWhen='account.payouts' role='presentation'}}
{{#link-to 'account.payouts'}}Payouts{{/link-to}}
{{#link-to 'account.payouts'}}{{t "account.payouts"}}{{/link-to}}
{{/active-li}}
</ul>
</div>
Expand Down
19 changes: 8 additions & 11 deletions www/app/templates/account/index.hbs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<div class="container">
{{#if model.workers}}
<h4>Your Workers</h4>
<h3>{{t "account.your_workers"}}</h3>
<div class="table-responsive">
<table class="table table-condensed table-striped">
<thead>
<tr>
<th>ID</th>
<th>Hashrate (rough, short average)</th>
<th>Hashrate (accurate, long average)</th>
<th>Last Share</th>
<th>{{t "account.hashrate"}} ({{t "account.short_average"}})</th>
<th>{{t "account.hashrate"}} ({{t "account.long_average"}})</th>
<th>{{t "account.last_share"}}</th>
</tr>
</thead>
<tbody>
Expand All @@ -24,16 +24,13 @@
</table>
</div>
{{else}}
<h3>No workers online</h3>
<h3>{{t "account.no_workers_online"}}</h3>
{{/if}}
<div class="alert alert-info" role="alert">
<span class="sr-only">Notice:</span>
Your average hashrate will be smoothly adjusted until you have shares to fullfill estimation window.<br/>
There are two windows, long and short, first is equal to about 30 minutes and long window is usually equal to 3 hours.<br/>
Dead (sick) workers will be highlighted in a table of workers if they didn't submit a share for 1/2 of short window,
so you can perform maintenance of your rigs.
<span class="sr-only">{{t "account.notice"}}:</span>
{{format-html-message "account.notice_html"}}
</div>
<div class="alert alert-info" role="alert">
<strong>Your bulk stats JSON API URL:</strong> <a href="/api/accounts/{{model.login}}">/api/accounts/{{model.login}}</a>
<strong>{{t "account.json_api_url"}}:</strong> <a href="/api/accounts/{{model.login}}">/api/accounts/{{model.login}}</a>
</div>
</div>
12 changes: 6 additions & 6 deletions www/app/templates/account/payouts.hbs
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<div class="container">
{{#if model.payments}}
<h4>Your Latest Payouts</h4>
<h3>{{t "payout.latest_payouts"}}</h3>
<div class="table-responsive">
<table class="table table-condensed table-striped">
<thead>
<tr>
<th>Time</th>
<th>Tx ID</th>
<th>Amount</th>
<th>{{t "payout.time"}}</th>
<th>{{t "payout.txid"}}</th>
<th>{{t "payout.amount"}}</th>
</tr>
</thead>
<tbody>
{{#each model.payments as |tx|}}
<tr>
<td>{{format-date-locale tx.timestamp}}</td>
<td>
<a href="https://etherscan.io/tx/{{tx.tx}}" class="hash" rel="nofollow" target="_blank">{{tx.tx}}</a>
<a href="{{config.BlockExplorerLink}}/tx/{{tx.tx}}" class="hash" rel="nofollow" target="_blank">{{tx.tx}}</a>
</td>
<td>{{format-balance tx.amount}}</td>
</tr>
Expand All @@ -24,6 +24,6 @@
</table>
</div>
{{else}}
<h3>No payouts yet</h3>
<h3>{{t "payout.no_payouts_yet"}}</h3>
{{/if}}
</div>
29 changes: 20 additions & 9 deletions www/app/templates/application.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,44 +8,55 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand"><span class="logo-1">Ξthereum</span><span class="logo-2">Pool</span></a>
<a class="navbar-brand"><span class="logo-1">{{config.PoolName}}</span> <span class="logo-2">Pool</span></a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
{{#active-li currentWhen='index'}}
{{#link-to 'index'}}
<i class="fa fa-home"></i> Home
<i class="fa fa-home"></i> {{t 'menu.home'}}
{{/link-to}}
{{/active-li}}
{{#active-li currentWhen='help'}}
{{#link-to 'help'}}
<i class="fa fa-rocket"></i> Help
{{#link-to (t 'menu.i18n.help')}}
<i class="fa fa-rocket"></i> {{t 'menu.help'}}
{{/link-to}}
{{/active-li}}
{{#active-li currentWhen='blocks'}}
{{#link-to 'blocks'}}
<i class="fa fa-cubes"></i> Pool Blocks
<i class="fa fa-cubes"></i> {{t 'menu.pool_blocks'}}
{{#if immatureTotal}}
<span class="badge alert-success">{{immatureTotal}}</span>
{{/if}}
{{/link-to}}
{{/active-li}}
{{#active-li currentWhen='payments'}}
{{#link-to 'payments'}}
<i class="fa fa-paper-plane-o"></i> Payments
<i class="fa fa-paper-plane-o"></i> {{t 'menu.payments'}}
{{/link-to}}
{{/active-li}}
{{#active-li currentWhen='miners'}}
{{#link-to 'miners'}}
<i class="fa fa-users"></i> Miners
<i class="fa fa-users"></i> {{t 'menu.miners'}}
{{/link-to}}
{{/active-li}}
{{#active-li currentWhen='about'}}
{{#link-to 'about'}}
<i class="fa fa-comments"></i> About <span class="badge alert-success">&#x2713;</span>
{{#link-to (t 'menu.i18n.about')}}
<i class="fa fa-comments"></i> {{t 'menu.about'}} <span class="badge alert-success">&#x2713;</span>
{{/link-to}}
{{/active-li}}
</ul>

<form class="navbar-form navbar-right">
<div class="form-group">
<select id="selected-language" {{action 'selectLanguage' on='change'}} class="form-control" style="width: 120px;">
<option hidden>{{t "menu.language"}}</option>
{{#each languages as |lang|}}
<option value='{{lang.value}}' selected={{eq selectedLanguage lang.value}}>{{lang.name}}</option>
{{/each}}
</select>
</div>
</form>
</div>
</div>
</div>
Expand Down
15 changes: 7 additions & 8 deletions www/app/templates/blocks.hbs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<div class="jumbotron">
<div class="container">
<p class="lead">Pool always pay full block reward including TX fees and uncle rewards.</p>
<strong>
Block maturity requires <u>up to</u> </strong> <span class="label label-success">520</span> <strong>blocks.
Usually it's less indeed.
</strong>
<p class="lead">{{t "block.pool_rewards"}}</p>
<span>
{{format-html-message "block.pool_notice.html" success=520}}
</span>
</div>
</div>
<div class="container">
Expand All @@ -13,13 +12,13 @@
{{/if}}
<ul class="nav nav-tabs">
{{#active-li currentWhen='blocks.index' role='presentation'}}
{{#link-to 'blocks.index'}}Blocks <span class="badge alert-success">{{format-number model.maturedTotal}}</span>{{/link-to}}
{{#link-to 'blocks.index'}}{{t "block.blocks"}} <span class="badge alert-success">{{format-number model.maturedTotal}}</span>{{/link-to}}
{{/active-li}}
{{#active-li currentWhen='blocks.immature' role='presentation'}}
{{#link-to 'blocks.immature'}}Immature <span class="badge alert-success">{{format-number model.immatureTotal}}</span>{{/link-to}}
{{#link-to 'blocks.immature'}}{{t "block.immature"}} <span class="badge alert-success">{{format-number model.immatureTotal}}</span>{{/link-to}}
{{/active-li}}
{{#active-li currentWhen='blocks.pending' role='presentation'}}
{{#link-to 'blocks.pending'}}New Blocks <span class="badge alert-info">{{format-number model.candidatesTotal}}</span>{{/link-to}}
{{#link-to 'blocks.pending'}}{{t "block.new"}} <span class="badge alert-info">{{format-number model.candidatesTotal}}</span>{{/link-to}}
{{/active-li}}
</ul>
{{outlet}}
Expand Down
10 changes: 5 additions & 5 deletions www/app/templates/blocks/block.hbs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<tr>
<td>
{{#if block.uncle}}
<a href="https://etherscan.io/uncle/{{block.uncleHeight}}" rel="nofollow" target="_blank">{{format-number block.height}}</a>
<a href="{{config.BlockExplorerLink}}/uncle/{{block.uncleHeight}}" rel="nofollow">{{format-number block.height}}</a>
{{else}}
<a href="https://etherscan.io/block/{{block.height}}" rel="nofollow" target="_blank">{{format-number block.height}}</a>
<a href="{{config.BlockExplorerLink}}/block/{{block.height}}" rel="nofollow">{{format-number block.height}}</a>
{{/if}}
</td>
<td>
{{#if block.uncle}}
<a href="https://etherscan.io/uncle/{{block.hash}}" class="hash" rel="nofollow" target="_blank">{{block.hash}}</a>
<a href="{{config.BlockExplorerLink}}/uncle/{{block.hash}}" class="hash" rel="nofollow">{{block.hash}}</a>
{{else if block.orphan}}
<span class="label label-danger">Orphan</span>
<span class="label label-danger">{{t "block.orphan"}}</span>
{{else}}
<a href="https://etherscan.io/block/{{block.hash}}" class="hash" rel="nofollow" target="_blank">{{block.hash}}</a>
<a href="{{config.BlockExplorerLink}}/block/{{block.hash}}" class="hash" rel="nofollow">{{block.hash}}</a>
{{/if}}
</td>
<td>{{format-date-locale block.timestamp}}</td>
Expand Down
Loading

1 comment on commit bd505b0

@mo9a7i
Copy link

@mo9a7i mo9a7i commented on bd505b0 Jun 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for this effort

Please sign in to comment.