From 01cb3f583ee7f32231f5bf9af551c424b722581a Mon Sep 17 00:00:00 2001 From: Mayesters Date: Fri, 26 May 2017 22:26:06 +0200 Subject: [PATCH] lots of stuff translated --- app/locales/en.json | 74 +++++++++++++++++++++++++- ui/js/component/upgradeModal/view.jsx | 8 +-- ui/js/component/video/view.jsx | 16 +++--- ui/js/component/walletAddress/view.jsx | 8 +-- ui/js/component/walletSend/view.jsx | 20 +++---- ui/js/jsonrpc.js | 4 +- ui/js/lbry.js | 4 +- ui/js/lbryio.js | 12 ++--- ui/js/lbryuri.js | 28 +++++----- ui/js/lighthouse.js | 2 +- ui/js/page/developer.js | 2 +- ui/js/page/rewards.js | 6 +-- ui/js/rewards.js | 24 ++++----- 13 files changed, 140 insertions(+), 68 deletions(-) diff --git a/app/locales/en.json b/app/locales/en.json index 04947c1b9..acf9f743f 100644 --- a/app/locales/en.json +++ b/app/locales/en.json @@ -233,5 +233,77 @@ "Loading transactions": "Loading transactions", "Amount": "Amount", "Time": "Time", - "Transaction": "Transaction" + "Transaction": "Transaction", + "You earned %s for registering as a new developer.": "You earned %s for registering as a new developer.", + "You earned %s LBC new user reward.": "You earned %s LBC new user reward.", + "You earned %s LBC for verifying your email address.": "You earned %s LBC for verifying your email address.", + "You earned %s LBC for creating a publisher identity.": "You earned %s LBC for creating a publisher identity.", + "You earned %s LBC for streaming your first video.": "You earned %s LBC for streaming your first video.", + "You earned %s LBC for downloading some of the things.": "You earned %s LBC for downloading some of the things.", + "You earned %s LBC for making your first publication.": "You earned %s LBC for making your first publication.", + "Your First Nickel": "Your First Nickel", + "First Publish": "First Publish", + "We're Going Streaming": "We're Going Streaming", + "Channel Surfing": "Channel Surfing", + "Many Views": "Many Views", + "Hot Right Now": "Hot Right Now", + "A welcome bonus for being at the vanguard of content freedom.": "A welcome bonus for being at the vanguard of content freedom.", + "The first view is on us.": "The first view is on us.", + "Up the quad, and to the gymanasium. Press play. Everybody's doing it.": "Up the quad, and to the gymanasium. Press play. Everybody's doing it.", + "Claim your channel! Create an identity used to securely publish content.": "Claim your channel! Create an identity used to securely publish content.", + "Watch a bunch of stuff... who knows how much?": "Watch a bunch of stuff... who knows how much?", + "Watch the latest featured content.": "Watch the latest featured content.", + "Rewards are not enabled.": "Rewards are not enabled.", + "Failed to load rewards.": "Failed to load rewards.", + "Reward claimed.": "Reward claimed.", + "Show All": "Show All", + "Please create a channel identity first.": "Please create a channel identity first.", + "Please publish something and wait for confirmation by the network to claim this reward.": "Please publish something and wait for confirmation by the network to claim this reward.", + "Please publish something to claim this reward.": "Please publish something to claim this reward.", + "Could not connect to Lighthouse server. Last server attempted: %s": "Could not connect to Lighthouse server. Last server attempted: %s", + "LBRY URIs must include a protocol prefix (lbry://).": "LBRY URIs must include a protocol prefix (lbry://).", + "URI does not include name.": "URI does not include name.", + "No channel name after @.": "No channel name after @.", + "Channel names must be at least %s characters.": "Channel names must be at least %s characters.", + "Invalid character %s in name: %s.": "Invalid character %s in name: %s.", + "No modifier provided after separator %s.": "No modifier provided after separator %s.", + "Invalid claim ID %s.": "Invalid claim ID %s.", + "Claim sequence must be a number.": "Claim sequence must be a number.", + "Bid position must be a number.": "Bid position must be a number.", + "Only channel URIs may have a path.": "Only channel URIs may have a path.", + "Invalid character %s in path: %s": "Invalid character %s in path: %s", + "No path provided after /": "No path provided after /", + "Received a channel content URI, but name and channelName do not match. \"name\" represents the value in the name position of the URI (lbry://name...), which for channel content will be the channel name. In most cases, to construct a channel URI you should just pass channelName and contentName.": "Received a channel content URI, but name and channelName do not match. \"name\" represents the value in the name position of the URI (lbry://name...), which for channel content will be the channel name. In most cases, to construct a channel URI you should just pass channelName and contentName.", + "Path and contentName do not match. Only one is required; most likely you wanted contentName.": "Path and contentName do not match. Only one is required; most likely you wanted contentName.", + "Internal API disabled": "Internal API disabled", + "LBRY internal API is disabled": "LBRY internal API is disabled", + "Something went wrong making an internal API call.": "Something went wrong making an internal API call.", + "XMLHttpRequest connection timed out": "XMLHttpRequest connection timed out", + "Invalid method": "Invalid method", + "Received invalid authentication response.": "Received invalid authentication response.", + "Unable to connect to LBRY": "Unable to connect to LBRY", + "Resolve has hacked cache on top of it that requires a URI": "Resolve has hacked cache on top of it that requires a URI", + "Connection to API server failed": "Connection to API server failed", + "Please select a file to upgrade from": "Please select a file to upgrade from", + "Update available": "Update available", + "Upgrade": "Upgrade", + "Skip": "Skip", + "Your version of LBRY is out of date and may be unreliable or insecure.": "Your version of LBRY is out of date and may be unreliable or insecure.", + "Sorry, your download timed out :(": "Sorry, your download timed out :(", + "Requesting stream... it may sit here for like 15-20 seconds in a really awkward way... we're working on it": "Requesting stream... it may sit here for like 15-20 seconds in a really awkward way... we're working on it", + "Downloading stream... not long left now!": "Downloading stream... not long left now!", + "this is the world's worst loading screen and we shipped our software with it anyway...": "this is the world's worst loading screen and we shipped our software with it anyway...", + "Wallet Address": "Wallet Address", + "Get New Address": "Get New Address", + "Other LBRY users may send credits to you by entering this address on the \"Send\" page.": "Other LBRY users may send credits to you by entering this address on the \"Send\" page.", + "You can generate a new address at any time, and any previous addresses will continue to work. Using multiple addresses can be helpful for keeping track of incoming payments from multiple sources.": "You can generate a new address at any time, and any previous addresses will continue to work. Using multiple addresses can be helpful for keeping track of incoming payments from multiple sources.", + "Send Credits": "Send Credits", + "Recipient Address": "Recipient Address", + "Insufficient balance": "Insufficient balance", + "Insufficient balance: after this transaction you would have less than 1 LBC in your wallet.": "Insufficient balance: after this transaction you would have less than 1 LBC in your wallet.", + "Transaction successful": "Transaction successful", + "Your transaction was successfully placed in the queue.": "Your transaction was successfully placed in the queue.", + "Transaction failed": "Transaction failed", + "Something went wrong": "Something went wrong", + "Find movies, music, games, and more": "Find movies, music, games, and more" } \ No newline at end of file diff --git a/ui/js/component/upgradeModal/view.jsx b/ui/js/component/upgradeModal/view.jsx index a2a181c79..cd18253b2 100644 --- a/ui/js/component/upgradeModal/view.jsx +++ b/ui/js/component/upgradeModal/view.jsx @@ -17,13 +17,13 @@ class UpgradeModal extends React.Component { return ( - Your version of LBRY is out of date and may be unreliable or insecure. + {__("Your version of LBRY is out of date and may be unreliable or insecure.")} ) } diff --git a/ui/js/component/video/view.jsx b/ui/js/component/video/view.jsx index 081396cab..2ff93b9bc 100644 --- a/ui/js/component/video/view.jsx +++ b/ui/js/component/video/view.jsx @@ -51,20 +51,20 @@ class VideoPlayButton extends React.Component { icon="icon-play" onClick={this.onWatchClick.bind(this)} /> {modal} - { this.closeModal() }}> - You don't have enough LBRY credits to pay for this stream. + { this.closeModal() }}> + {__("You don't have enough LBRY credits to pay for this stream.")} - This will purchase {title} for credits. + {__("This will purchase")} {title} {__("for")} {__("credits")}. { this.closeModal() }} contentLabel="Timed Out"> - Sorry, your download timed out :( + {__("Sorry, your download timed out :(")} ); } @@ -100,16 +100,16 @@ class Video extends React.Component { let loadStatusMessage = '' if (isLoading) { - loadStatusMessage = "Requesting stream... it may sit here for like 15-20 seconds in a really awkward way... we're working on it" + loadStatusMessage = __("Requesting stream... it may sit here for like 15-20 seconds in a really awkward way... we're working on it") } else if (isDownloading) { - loadStatusMessage = "Downloading stream... not long left now!" + loadStatusMessage = __("Downloading stream... not long left now!") } return (
{ isPlaying || isLoading ? (!isReadyToPlay ? - this is the world's worst loading screen and we shipped our software with it anyway...

{loadStatusMessage}
: + {__("this is the world's worst loading screen and we shipped our software with it anyway...")}

{loadStatusMessage}
: ) :
diff --git a/ui/js/component/walletAddress/view.jsx b/ui/js/component/walletAddress/view.jsx index 76227786a..464ee037f 100644 --- a/ui/js/component/walletAddress/view.jsx +++ b/ui/js/component/walletAddress/view.jsx @@ -19,18 +19,18 @@ class WalletAddress extends React.Component { return (
-

Wallet Address

+

{__("Wallet Address")}

- +
-

Other LBRY users may send credits to you by entering this address on the "Send" page.

-

You can generate a new address at any time, and any previous addresses will continue to work. Using multiple addresses can be helpful for keeping track of incoming payments from multiple sources.

+

{__("Other LBRY users may send credits to you by entering this address on the \"Send\" page.")}

+

{__("You can generate a new address at any time, and any previous addresses will continue to work. Using multiple addresses can be helpful for keeping track of incoming payments from multiple sources.")}

diff --git a/ui/js/component/walletSend/view.jsx b/ui/js/component/walletSend/view.jsx index 60e7c6126..5e05a946e 100644 --- a/ui/js/component/walletSend/view.jsx +++ b/ui/js/component/walletSend/view.jsx @@ -20,27 +20,27 @@ const WalletSend = (props) => {
-

Send Credits

+

{__("Send Credits")}

- +
- +
- 0.0) || !address} /> + 0.0) || !address} />
- {modal == 'insufficientBalance' && - Insufficient balance: after this transaction you would have less than 1 LBC in your wallet. + {modal == 'insufficientBalance' && + {__("Insufficient balance: after this transaction you would have less than 1 LBC in your wallet.")} } - {modal == 'transactionSuccessful' && - Your transaction was successfully placed in the queue. + {modal == 'transactionSuccessful' && + {__("Your transaction was successfully placed in the queue.")} } - {modal == 'transactionFailed' && - Something went wrong: + {modal == 'transactionFailed' && + {__("Something went wrong")}: }
) diff --git a/ui/js/jsonrpc.js b/ui/js/jsonrpc.js index 378e850a2..d4822fa46 100644 --- a/ui/js/jsonrpc.js +++ b/ui/js/jsonrpc.js @@ -11,7 +11,7 @@ jsonrpc.call = function (connectionString, method, params, callback, errorCallba connectFailedCallback(e); }); xhr.addEventListener('timeout', function() { - connectFailedCallback(new Error('XMLHttpRequest connection timed out')); + connectFailedCallback(new Error(__('XMLHttpRequest connection timed out'))); }) } xhr.addEventListener('load', function() { @@ -50,7 +50,7 @@ jsonrpc.call = function (connectionString, method, params, callback, errorCallba method: method, params: params, code: xhr.status, - message: 'Connection to API server failed' + message: __('Connection to API server failed') } }); document.dispatchEvent(errorEvent); diff --git a/ui/js/lbry.js b/ui/js/lbry.js index b9230ce16..0be9f5ef1 100644 --- a/ui/js/lbry.js +++ b/ui/js/lbry.js @@ -111,7 +111,7 @@ lbry.connect = function() { }, tryNum < 100 ? 200 : 1000); } else { - reject(new Error("Unable to connect to LBRY")); + reject(new Error(__("Unable to connect to LBRY"))); } } }); @@ -422,7 +422,7 @@ lbry._resolveXhrs = {} lbry.resolve = function(params={}) { return new Promise((resolve, reject) => { if (!params.uri) { - throw "Resolve has hacked cache on top of it that requires a URI" + throw __("Resolve has hacked cache on top of it that requires a URI") } if (params.uri && lbry._claimCache[params.uri] !== undefined) { resolve(lbry._claimCache[params.uri]); diff --git a/ui/js/lbryio.js b/ui/js/lbryio.js index 9d78cfb82..c00252921 100644 --- a/ui/js/lbryio.js +++ b/ui/js/lbryio.js @@ -34,20 +34,20 @@ lbryio.getExchangeRates = function() { lbryio.call = function(resource, action, params={}, method='get', evenIfDisabled=false) { // evenIfDisabled is just for development, when we may have some calls working and some not return new Promise((resolve, reject) => { if (!lbryio.enabled && !evenIfDisabled && (resource != 'discover' || action != 'list')) { - console.log("Internal API disabled"); - reject(new Error("LBRY internal API is disabled")) + console.log(__("Internal API disabled")); + reject(new Error(__("LBRY internal API is disabled"))) return } const xhr = new XMLHttpRequest; xhr.addEventListener('error', function (event) { - reject(new Error("Something went wrong making an internal API call.")); + reject(new Error(__("Something went wrong making an internal API call."))); }); xhr.addEventListener('timeout', function() { - reject(new Error('XMLHttpRequest connection timed out')); + reject(new Error(__('XMLHttpRequest connection timed out'))); }); xhr.addEventListener('load', function() { @@ -89,7 +89,7 @@ lbryio.call = function(resource, action, params={}, method='get', evenIfDisabled xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhr.send(querystring.stringify(fullParams)); } else { - reject(new Error("Invalid method")); + reject(new Error(__("Invalid method"))); } }); }; @@ -138,7 +138,7 @@ lbryio.authenticate = function() { app_id: installation_id, }, 'post').then(function(responseData) { if (!responseData.id) { - reject(new Error("Received invalid authentication response.")); + reject(new Error(__("Received invalid authentication response."))); } lbryio.setAccessToken(installation_id) setCurrentUser() diff --git a/ui/js/lbryuri.js b/ui/js/lbryuri.js index 680c42d65..bc1749b71 100644 --- a/ui/js/lbryuri.js +++ b/ui/js/lbryuri.js @@ -39,12 +39,12 @@ lbryuri.parse = function(uri, requireProto=false) { // Validate protocol if (requireProto && !proto) { - throw new Error('LBRY URIs must include a protocol prefix (lbry://).'); + throw new Error(__('LBRY URIs must include a protocol prefix (lbry://).')); } // Validate and process name if (!name) { - throw new Error('URI does not include name.'); + throw new Error(__('URI does not include name.')); } const isChannel = name.startsWith('@'); @@ -52,11 +52,11 @@ lbryuri.parse = function(uri, requireProto=false) { if (isChannel) { if (!channelName) { - throw new Error('No channel name after @.'); + throw new Error(__('No channel name after @.')); } if (channelName.length < CHANNEL_NAME_MIN_LEN) { - throw new Error(`Channel names must be at least ${CHANNEL_NAME_MIN_LEN} characters.`); + throw new Error(__(`Channel names must be at least %s characters.`, CHANNEL_NAME_MIN_LEN)); } contentName = path; @@ -64,14 +64,14 @@ lbryuri.parse = function(uri, requireProto=false) { const nameBadChars = (channelName || name).match(/[^A-Za-z0-9-]/g); if (nameBadChars) { - throw new Error(`Invalid character${nameBadChars.length == 1 ? '' : 's'} in name: ${nameBadChars.join(', ')}.`); + throw new Error(__(`Invalid character %s in name: %s.`, nameBadChars.length == 1 ? '' : 's', nameBadChars.join(', ') )); } // Validate and process modifier (claim ID, bid position or claim sequence) let claimId, claimSequence, bidPosition; if (modSep) { if (!modVal) { - throw new Error(`No modifier provided after separator ${modSep}.`); + throw new Error(__(`No modifier provided after separator %s.`, modSep)); } if (modSep == '#') { @@ -84,31 +84,31 @@ lbryuri.parse = function(uri, requireProto=false) { } if (claimId && (claimId.length > CLAIM_ID_MAX_LEN || !claimId.match(/^[0-9a-f]+$/))) { - throw new Error(`Invalid claim ID ${claimId}.`); + throw new Error(__(`Invalid claim ID %s.`, claimId)); } if (claimSequence && !claimSequence.match(/^-?[1-9][0-9]*$/)) { - throw new Error('Claim sequence must be a number.'); + throw new Error(__('Claim sequence must be a number.')); } if (bidPosition && !bidPosition.match(/^-?[1-9][0-9]*$/)) { - throw new Error('Bid position must be a number.'); + throw new Error(__('Bid position must be a number.')); } // Validate and process path if (path) { if (!isChannel) { - throw new Error('Only channel URIs may have a path.'); + throw new Error(__('Only channel URIs may have a path.')); } const pathBadChars = path.match(/[^A-Za-z0-9-]/g); if (pathBadChars) { - throw new Error(`Invalid character${count == 1 ? '' : 's'} in path: ${nameBadChars.join(', ')}`); + throw new Error(__(`Invalid character %s in path: %s`,count == 1 ? '' : 's',nameBadChars.join(', '))); } contentName = path; } else if (pathSep) { - throw new Error('No path provided after /'); + throw new Error(__('No path provided after /')); } return { @@ -135,7 +135,7 @@ lbryuri.build = function(uriObj, includeProto=true, allowExtraProps=false) { if (!name) { name = channelNameFormatted; } else if (name !== channelNameFormatted) { - throw new Error('Received a channel content URI, but name and channelName do not match. "name" represents the value in the name position of the URI (lbry://name...), which for channel content will be the channel name. In most cases, to construct a channel URI you should just pass channelName and contentName.'); + throw new Error(__('Received a channel content URI, but name and channelName do not match. \"name\" represents the value in the name position of the URI (lbry://name...), which for channel content will be the channel name. In most cases, to construct a channel URI you should just pass channelName and contentName.')); } } @@ -146,7 +146,7 @@ lbryuri.build = function(uriObj, includeProto=true, allowExtraProps=false) { path = contentName; } if (path && path !== contentName) { - throw new Error('path and contentName do not match. Only one is required; most likely you wanted contentName.'); + throw new Error(__('Path and contentName do not match. Only one is required; most likely you wanted contentName.')); } } diff --git a/ui/js/lighthouse.js b/ui/js/lighthouse.js index 5ca4ef038..c72338d64 100644 --- a/ui/js/lighthouse.js +++ b/ui/js/lighthouse.js @@ -21,7 +21,7 @@ function getServers() { function call(method, params, callback, errorCallback) { if (connectTryNum >= maxQueryTries) { - errorCallback(new Error(`Could not connect to Lighthouse server. Last server attempted: ${server}`)); + errorCallback(new Error(__(`Could not connect to Lighthouse server. Last server attempted: %s`, server))); return; } diff --git a/ui/js/page/developer.js b/ui/js/page/developer.js index 4ac1a133b..ec41baeb7 100644 --- a/ui/js/page/developer.js +++ b/ui/js/page/developer.js @@ -42,7 +42,7 @@ class DeveloperPage extends React.Component { handleForceUpgradeClick() { let upgradeSent = false; if (!this.state.upgradePath) { - alert('Please select a file to upgrade from'); + alert(__('Please select a file to upgrade from')); } else { try { const stats = fs.lstatSync(this.state.upgradePath); diff --git a/ui/js/page/rewards.js b/ui/js/page/rewards.js index 9c0e9ad8f..41645dd15 100644 --- a/ui/js/page/rewards.js +++ b/ui/js/page/rewards.js @@ -24,7 +24,7 @@ export class RewardTile extends React.Component {
{this.props.claimed - ? Reward claimed. + ? {__("Reward claimed.")} : }
{this.props.description}
@@ -64,9 +64,9 @@ export class RewardsPage extends React.Component {
{!this.state.userRewards - ? (this.state.failed ?
Failed to load rewards.
: '') + ? (this.state.failed ?
{__("Failed to load rewards.")}
: '') : this.state.userRewards.map(({reward_type, reward_title, reward_description, transaction_id, reward_amount}) => { - return ; + return ; })}
diff --git a/ui/js/rewards.js b/ui/js/rewards.js index a77ccde01..6e08ca11d 100644 --- a/ui/js/rewards.js +++ b/ui/js/rewards.js @@ -7,13 +7,13 @@ import { function rewardMessage(type, amount) { return { - new_developer: `You earned ${amount} for registering as a new developer.`, - new_user: `You earned ${amount} LBC new user reward.`, - confirm_email: `You earned ${amount} LBC for verifying your email address.`, - new_channel: `You earned ${amount} LBC for creating a publisher identity.`, - first_stream: `You earned ${amount} LBC for streaming your first video.`, - many_downloads: `You earned ${amount} LBC for downloading some of the things.`, - first_publish: `You earned ${amount} LBC for making your first publication.`, + new_developer: __(`You earned %s for registering as a new developer.`, amount), + new_user: __(`You earned %s LBC new user reward.`, amount), + confirm_email: __(`You earned %s LBC for verifying your email address.`, amount), + new_channel: __(`You earned %s LBC for creating a publisher identity.`, amount), + first_stream: __(`You earned %s LBC for streaming your first video.`, amount), + many_downloads: __(`You earned %s LBC for downloading some of the things.`, amount), + first_publish: __(`You earned %s LBC for making your first publication.`, amount), }[type]; } @@ -81,7 +81,7 @@ rewards.claimReward = function (type) { function requestReward(resolve, reject, params) { if (!lbryio.enabled) { - reject(new Error("Rewards are not enabled.")) + reject(new Error(__("Rewards are not enabled."))) return; } lbryio.call('reward', 'new', params, 'post').then(({reward_amount}) => { @@ -96,7 +96,7 @@ rewards.claimReward = function (type) { // Display global notice const action = doShowSnackBar({ message, - linkText: "Show All", + linkText: __("Show All"), linkTarget: "/rewards", isError: false, }) @@ -125,7 +125,7 @@ rewards.claimReward = function (type) { params.transaction_id = claim.txid; requestReward(resolve, reject, params) } else { - reject(new Error("Please create a channel identity first.")) + reject(new Error(__("Please create a channel identity first."))) } }).catch(reject) break; @@ -140,8 +140,8 @@ rewards.claimReward = function (type) { requestReward(resolve, reject, params) } else { reject(claims.length ? - new Error("Please publish something and wait for confirmation by the network to claim this reward.") : - new Error("Please publish something to claim this reward.")) + new Error(__("Please publish something and wait for confirmation by the network to claim this reward.")) : + new Error(__("Please publish something to claim this reward."))) } }).catch(reject) break;