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" ) ;
2023-10-27 18:33:52 -06:00
// global
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 . total _top _100 = "Top 1-100 Total" ,
exports . bits = "Bits" ,
exports . nonce = "Nonce" ,
exports . new _coins = "New Coins" ,
exports . proof _of _stake = "PoS" ,
exports . hidden _address = "Hidden Address" ,
exports . hidden _sender = "Hidden Sender" ,
exports . hidden _recipient = "Hidden Recipient" ,
exports . unknown _address = "Unknown Address" ,
exports . unknown _sender = "Unknown Sender" ,
exports . unknown _recipient = "Unknown Recipient" ,
exports . last _updated = "Last Updated" ,
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." ,
// menu items
2019-05-27 10:33:22 -07:00
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" ,
2023-05-06 12:36:35 -06:00
exports . menu _orphans = "Orphaned Blocks" ,
2019-05-27 10:33:22 -07:00
2023-10-27 18:33:52 -06:00
// explorer view
2021-04-10 22:22:46 -06:00
exports . ex _title = "{1} Block Explorer" ,
exports . ex _description = "A listing of all verified {1} transactions" ,
2019-05-27 10:33:22 -07:00
exports . ex _search _title = "Search" ,
exports . ex _search _button = "Search" ,
2021-04-05 12:24:48 -06:00
exports . ex _search _message = "Search by block height, block hash, tx hash or address" ,
2023-10-27 18:33:52 -06:00
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" ,
2021-04-10 22:22:46 -06:00
2023-10-27 18:33:52 -06:00
// transaction view
2021-04-10 22:22:46 -06:00
exports . tx _title = "{1} Transaction Details" ,
exports . tx _description = "Viewing tx data from {1} block # {2}" ,
2019-05-27 10:33:22 -07:00
exports . tx _block _hash = "Block Hash" ,
exports . tx _recipients = "Recipients" ,
exports . tx _contributors = "Contributor(s)" ,
2022-07-09 16:23:57 -06:00
exports . tx _hash = "Tx Hash" ,
2019-05-27 10:33:22 -07:00
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
2023-10-27 18:33:52 -06:00
// block view
2021-04-10 22:22:46 -06:00
exports . block _title = "{1} Block Details" ,
exports . block _description = "Viewing block data from {1} block # {2}" ,
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
2023-10-27 18:33:52 -06:00
// error view
2021-04-10 22:22:46 -06:00
exports . error _title = "{1} Block Explorer Error" ,
exports . error _description = "The page you are looking for cannot be found" ,
exports . error _description _alt = "An error occurred which prevented the page from loading correctly" ,
2023-10-27 18:33:52 -06:00
// address view
2021-04-10 22:22:46 -06:00
exports . a _title = "{1} Wallet Address Details" ,
exports . a _description = "Viewing balance and transaction data from {1} address {2}" ,
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
2023-10-27 18:33:52 -06:00
// masternode view
2021-04-10 22:22:46 -06:00
exports . mn _title = "{1} Masternodes" ,
exports . mn _description = "A listing of all masternodes known to be active on the {1} network" ,
exports . mn _masternode _list = "Masternode List" ,
2023-10-27 18:33:52 -06:00
// movement view
2021-04-10 22:22:46 -06:00
exports . move _title = "{1} Coin Movements" ,
exports . move _description = "A listing of larger movements where {1} or more {2} coins were sent in a single transaction" ,
2023-10-27 18:33:52 -06:00
// richlist view
2021-04-10 22:22:46 -06:00
exports . rl _title = "Top {1} Coin Holders" ,
exports . rl _description = "A listing of the richest {1} wallet addresses and breakdown of the current coin distribution" ,
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+" ,
2023-10-27 18:33:52 -06:00
// network view
2021-04-10 22:22:46 -06:00
exports . net _title = "{1} Network Peers" ,
exports . net _description = "A listing of {1} network peers that have connected to the explorer node in the last 24 hours" ,
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" ,
2023-10-27 18:33:52 -06:00
// api view
2021-04-10 22:22:46 -06:00
exports . api _title = "{1} Public API" ,
exports . api _description = "A listing of public API endpoints for retrieving {1} coin data from the network without the need for a local wallet" ,
exports . api _documentation = "API Documentation" ,
2019-05-27 10:33:22 -07:00
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." ,
2021-01-22 15:04:32 -07:00
exports . api _getblockhash = "Returns the hash of the block at [index]; index 0 is the genesis block." ,
2019-05-27 10:33:22 -07:00
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.' ,
2021-01-22 15:04:32 -07:00
exports . api _getnextrewardwhenstr = 'Returns a string describing how long until the votes are tallied and the next block reward is computed.' ,
2019-05-27 10:33:22 -07:00
2023-10-27 18:33:52 -06:00
// markets view
2021-04-10 22:22:46 -06:00
exports . mkt _title = "{1} Market Details" ,
exports . mkt _description = "Viewing {1} market data for the {2} exchange" ,
2019-05-27 10:33:22 -07:00
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" ,
2023-10-27 18:33:52 -06:00
exports . mkt _unexpected _api _data = "Received unexpected API data response" ,
2019-05-27 10:33:22 -07:00
2023-10-27 18:33:52 -06:00
// claim address view
2021-04-10 22:22:46 -06:00
exports . claim _title = "{1} Wallet Address Claim" ,
exports . claim _description = "Verify ownership of your {1} wallet address and set a custom display name in the explorer" ,
2023-10-27 18:33:52 -06:00
// orphans view
2023-05-06 12:36:35 -06:00
exports . orphan _title = "{1} Orphaned Blocks" ,
exports . orphan _description = "A listing of valid blocks that have been orphaned and do not belong to the main blockchain" ,
exports . orphan _block _list = "Orphaned Block List" ,
exports . orphan _block _hash = "Orphaned Block Hash" ,
exports . orphan _actual _block = "Actual Block" ,
exports . orphan _prev _block = "Previous Block" ,
exports . orphan _next _block = "Next Block" ,
exports . view _orphan = "View Orphaned Block" ,
2023-10-27 18:33:52 -06:00
// heavycoin rewards view
2021-04-10 22:22:46 -06:00
exports . heavy _title = "{1} Reward/Voting Details" ,
exports . heavy _description = "Viewing {1} voting data and coin reward change details" ,
exports . heavy _reward _voting _info = "Reward/voting information" ,
2023-10-27 18:33:52 -06:00
exports . heavy _vote = "Vote" ,
2019-05-27 10:33:22 -07:00
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 ) {
2021-03-17 17:54:09 -06:00
// discover where the locale file lives
var localeFilename = "./" + locale ;
2019-05-27 10:33:22 -07:00
var localeStr ;
2021-03-17 17:54:09 -06:00
try {
// read the settings sync
2019-05-27 10:33:22 -07:00
localeStr = fs . readFileSync ( localeFilename ) . toString ( ) ;
2021-03-17 17:54:09 -06:00
} catch ( e ) {
2019-05-27 10:33:22 -07:00
console . warn ( 'Locale file not found. Continuing using defaults!' ) ;
}
var lsettings ;
2021-03-17 17:54:09 -06:00
// try to parse the settings
2019-05-27 10:33:22 -07:00
try {
2021-03-17 17:54:09 -06:00
if ( localeStr ) {
2019-05-27 10:33:22 -07:00
localeStr = jsonminify ( localeStr ) . replace ( ",]" , "]" ) . replace ( ",}" , "}" ) ;
lsettings = JSON . parse ( localeStr ) ;
}
2021-03-17 17:54:09 -06:00
} catch ( e ) {
2019-05-27 10:33:22 -07:00
console . error ( 'There was an error processing your locale file: ' + e . message ) ;
process . exit ( 1 ) ;
}
2021-03-17 17:54:09 -06:00
// loop through the settings
for ( var i in lsettings ) {
// test if the setting start with a low character
if ( i . charAt ( 0 ) . search ( "[a-z]" ) !== 0 )
2019-05-27 10:33:22 -07:00
console . warn ( "Settings should start with a low character: '" + i + "'" ) ;
2021-03-17 17:54:09 -06:00
if ( exports [ i ] !== undefined ) {
// we know this setting, so we overwrite it
2019-05-27 10:33:22 -07:00
exports [ i ] = lsettings [ i ] ;
2021-03-17 17:54:09 -06:00
} else {
// this setting is unkown, output a warning and throw it away
2019-05-27 10:33:22 -07:00
console . warn ( "Unknown Setting: '" + i + "'. This setting doesn't exist or it was removed" ) ;
}
}
} ;
// initially load settings
2021-03-17 17:54:09 -06:00
exports . reloadLocale ( settings . locale ) ;