2019-05-27 10:33:22 -07:00
/**
* The Locale Module reads the locale settings and provides
* this information to the other modules
*/
var fs = require ( "fs" ) ;
var jsonminify = require ( "jsonminify" ) ;
var settings = require ( "./settings" ) ;
exports . menu _explorer = "Explorer" ,
exports . menu _api = "API" ,
exports . menu _markets = "Markets" ,
exports . menu _richlist = "Rich List" ,
exports . menu _reward = "Reward" ,
exports . menu _movement = "Movement" ,
exports . menu _node = "Nodes" ,
2020-12-26 22:01:36 -07:00
exports . menu _network = "Network" ,
exports . menu _claim _address = "Claim Address" ,
2019-05-27 10:33:22 -07:00
exports . ex _title = "Block Explorer" ,
exports . ex _search _title = "Search" ,
exports . ex _search _button = "Search" ,
exports . ex _search _message = "You may enter a block height, block hash ,tx hash or address." ,
exports . ex _error = "Error!" ,
2020-12-05 12:39:36 -07:00
exports . ex _warning = "Warning" ,
2019-05-27 10:33:22 -07:00
exports . ex _search _error = "Search found no results." ,
exports . ex _latest _transactions = "Latest Transactions" ,
exports . ex _summary = "Block Summary" ,
exports . ex _supply = "Coin Supply" ,
exports . ex _block = "Block" ,
exports . tx _title = "Transaction Details" ,
exports . tx _block _hash = "Block Hash" ,
exports . tx _recipients = "Recipients" ,
exports . tx _contributors = "Contributor(s)" ,
exports . tx _hash = "Hash" ,
exports . tx _address = "Address" ,
exports . tx _nonstandard = "NONSTANDARD TX" ,
2020-12-22 15:57:19 -07:00
exports . view _raw _tx _data = "View Raw Transaction Data" ,
exports . view _block = "View Block" ,
2019-05-27 10:33:22 -07:00
exports . block _title = "Block Details" ,
2020-12-22 15:57:19 -07:00
exports . block _previous = "Previous Block" ,
exports . block _next = "Next Block" ,
2019-05-27 10:33:22 -07:00
exports . block _genesis = "GENESIS" ,
2020-12-22 15:57:19 -07:00
exports . view _raw _block _data = "View Raw Block Data" ,
exports . view _tx = "View Transaction" ,
2019-05-27 10:33:22 -07:00
exports . difficulty = "Difficulty" ,
exports . network = "Network" ,
exports . masternodecount = "Masternodes" ,
exports . height = "Height" ,
exports . timestamp = "Timestamp" ,
exports . size = "Size" ,
exports . transactions = "Transactions" ,
exports . total _sent = "Total Sent" ,
exports . total _received = "Total Received" ,
exports . confirmations = "Confirmations" ,
exports . total = "Total" ,
exports . bits = "Bits" ,
exports . nonce = "Nonce" ,
exports . new _coins = "New Coins" ,
exports . proof _of _stake = "PoS" ,
2019-10-17 22:06:30 -06:00
exports . hidden _sender = "Hidden Sender" ,
exports . hidden _recipient = "Hidden Recipient" ,
2020-12-05 12:39:36 -07:00
exports . initial _index _alert = "Blockchain data is currently being synchronized. You may browse the site during this time, but keep in mind that data may not yet be fully accurate and some functionality may not work until synchronization is complete." ,
2019-05-27 10:33:22 -07:00
exports . a _menu _showing = "Showing" ,
exports . a _menu _txs = "transactions" ,
exports . a _menu _all = "All" ,
2020-11-20 17:44:51 -07:00
exports . a _qr = "QR Code" ,
2019-05-27 10:33:22 -07:00
exports . rl _received _coins = "Top 100 - Received Coins" ,
exports . rl _current _balance = "Top 100 - Current Balance" ,
exports . rl _received = "Received" ,
exports . rl _balance = "Balance" ,
exports . rl _wealth = "Wealth Distribution" ,
exports . rl _top25 = "Top 1-25" ,
exports . rl _top50 = "Top 26-50" ,
exports . rl _top75 = "Top 51-75" ,
exports . rl _top100 = "Top 76-100" ,
exports . rl _hundredplus = "101+" ,
2020-11-20 17:57:50 -07:00
exports . net _addnodes = "Add Nodes" ,
2019-05-27 10:33:22 -07:00
exports . net _connections = "Connections" ,
exports . net _address = "Address" ,
exports . net _protocol = "Protocol" ,
exports . net _subversion = "Sub-version" ,
exports . net _country = "Country" ,
exports . net _warning = "This is simply a sub sample of the network based on wallets connected to this node." ,
exports . api _title = "API Documentation" ,
exports . api _message = "The block explorer provides an API allowing users and/or applications to retrieve information from the network without the need for a local wallet." ,
exports . api _calls = "API Calls" ,
exports . api _getnetworkhashps = "Returns the current network hashrate. (hash/s)" ,
exports . api _getdifficulty = "Returns the current difficulty." ,
exports . api _getconnectioncount = "Returns the number of connections the block explorer has to other nodes." ,
2020-12-07 21:32:43 -07:00
exports . api _getmasternodelist = "Returns the complete list of masternodes on the network." ,
2019-05-27 10:33:22 -07:00
exports . api _getmasternodecount = "Returns the total number of masternodes on the network." ,
exports . api _getvotelist = "Returns the current vote list." ,
exports . api _getblockcount = "Returns the number of blocks currently in the block chain." ,
exports . api _getblockhash = "Returns the hash of the block at ; index 0 is the genesis block." ,
exports . api _getblock = "Returns information about the block with the given hash." ,
exports . api _getrawtransaction = "Returns raw transaction representation for given transaction id. decrypt can be set to 0(false) or 1(true)." ,
exports . api _getmaxmoney = 'Returns the maximum possible money supply.' ,
exports . api _getmaxvote = 'Returns the maximum allowed vote for the current phase of voting.' ,
exports . api _getvote = 'Returns the current block reward vote setting.' ,
exports . api _getphase = 'Returns the current voting phase (\'Mint\', \'Limit\' or \'Sustain\').' ,
exports . api _getreward = 'Returns the current block reward, which has been decided democratically in the previous round of block reward voting.' ,
exports . api _getsupply = 'Returns the current money supply.' ,
exports . api _getnextrewardestimate = 'Returns an estimate for the next block reward based on the current state of decentralized voting.' ,
exports . api _getnextrewardwhenstr = 'Returns string describing how long until the votes are tallied and the next block reward is computed.' ,
// Markets view
exports . mkt _hours = "24 hours" ,
exports . mkt _view _chart = "View 24 hour summary" ,
exports . mkt _view _summary = "View 24 hour chart" ,
2020-12-25 19:48:22 -07:00
exports . mkt _no _chart = "Chart data is not available via markets API" ,
2019-05-27 10:33:22 -07:00
exports . mkt _high = "High" ,
exports . mkt _low = "Low" ,
exports . mkt _volume = "Volume" ,
exports . mkt _top _bid = "Top Bid" ,
exports . mkt _top _ask = "Top Ask" ,
exports . mkt _last = "Last Price" ,
exports . mkt _yesterday = "Yesterday" ,
exports . mkt _change = "Change" ,
exports . mkt _sell _orders = "Sell Orders" ,
exports . mkt _buy _orders = "Buy Orders" ,
exports . mkt _price = "Price" ,
exports . mkt _amount = "Amount" ,
exports . mkt _total = "Total" ,
exports . mkt _trade _history = "Trade History" ,
exports . mkt _type = "Type" ,
exports . mkt _time _stamp = "Time Stamp" ,
2020-12-23 20:34:01 -07:00
exports . mkt _select = "Market Select" ,
2019-05-27 10:33:22 -07:00
// Heavy
exports . heavy _vote = "Vote" ,
// Heavy rewards view
exports . heavy _title = "Reward/voting information" ,
exports . heavy _cap = "Coin Cap" ,
exports . heavy _phase = "Phase" ,
exports . heavy _maxvote = "Max Vote" ,
exports . heavy _reward = "Reward" ,
exports . heavy _current = "Current Reward" ,
exports . heavy _estnext = "Est. Next" ,
exports . heavy _changein = "Reward change in approximately" ,
exports . heavy _key = "Key" ,
exports . heavy _lastxvotes = "Last 20 votes" ,
exports . reloadLocale = function reloadLocale ( locale ) {
// Discover where the locale file lives
var localeFilename = locale ;
//console.log(localeFilename);
localeFilename = "./" + localeFilename ;
//console.log('Loading locale: ' + localeFilename);
var localeStr ;
try {
//read the settings sync
localeStr = fs . readFileSync ( localeFilename ) . toString ( ) ;
} catch ( e ) {
console . warn ( 'Locale file not found. Continuing using defaults!' ) ;
}
// try to parse the settings
var lsettings ;
try {
if ( localeStr ) {
localeStr = jsonminify ( localeStr ) . replace ( ",]" , "]" ) . replace ( ",}" , "}" ) ;
lsettings = JSON . parse ( localeStr ) ;
}
} catch ( e ) {
console . error ( 'There was an error processing your locale file: ' + e . message ) ;
process . exit ( 1 ) ;
}
//loop trough the settings
for ( var i in lsettings )
{
//test if the setting start with a low character
if ( i . charAt ( 0 ) . search ( "[a-z]" ) !== 0 )
{
console . warn ( "Settings should start with a low character: '" + i + "'" ) ;
}
//we know this setting, so we overwrite it
if ( exports [ i ] !== undefined )
{
exports [ i ] = lsettings [ i ] ;
}
//this setting is unkown, output a warning and throw it away
else
{
console . warn ( "Unknown Setting: '" + i + "'. This setting doesn't exist or it was removed" ) ;
}
}
} ;
// initially load settings
exports . reloadLocale ( settings . locale ) ;