From c3df03d4fc844520f67fa565925efd783787cb97 Mon Sep 17 00:00:00 2001 From: Intnick Date: Thu, 25 May 2017 18:29:56 +0200 Subject: [PATCH 001/106] initial merge --- app/locales/en.json | 78 ++++++++++++++++++++++++++++++++++++ ui/js/main.js | 6 ++- ui/js/page/discover/view.jsx | 6 +-- 3 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 app/locales/en.json diff --git a/app/locales/en.json b/app/locales/en.json new file mode 100644 index 000000000..96527d026 --- /dev/null +++ b/app/locales/en.json @@ -0,0 +1,78 @@ +{ + "Edit": "Edit", + "Help": "Help", + "Developer": "Developer", + "Reload": "Reload", + "Toggle Developer Tools": "Toggle Developer Tools", + "Inspect Element": "Inspect Element", + "connectionString": "connectionString", + "Method": "Method", + "Parameters": "Parameters", + "Error code": "Error code", + "Error message": "Error message", + "Error data": "Error data", + "Home": "Home", + "Publish": "Publish", + "This LBC remains yours and the deposit can be undone at any time.": "This LBC remains yours and the deposit can be undone at any time.", + "Content": "Content", + "What are you publishing?": "What are you publishing?", + "Access": "Access", + "Select a URL for this publish.": "Select a URL for this publish.", + "How much does this content cost?": "How much does this content cost?", + "Price": "Price", + "Free": "Free", + "Choose price...": "Choose price...", + "US Dollars": "US Dollars", + "LBRY credits": "LBRY credits", + "Public Domain": "Public Domain", + "Creative Commons Attribution 4.0 International": "Creative Commons Attribution 4.0 International", + "Creative Commons Attribution-ShareAlike 4.0 International": "Creative Commons Attribution-ShareAlike 4.0 International", + "Creative Commons Attribution-NoDerivatives 4.0 International": "Creative Commons Attribution-NoDerivatives 4.0 International", + "Creative Commons Attribution-NonCommercial 4.0 International": "Creative Commons Attribution-NonCommercial 4.0 International", + "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International", + "Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International": "Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International", + "Copyrighted...": "Copyrighted...", + "Other...": "Other...", + "Identity": "Identity", + "Who created this content?": "Who created this content?", + "Anonymous": "Anonymous", + "New identity...": "New identity...", + "Address": "Address", + "Where should this content permanently reside?": "Where should this content permanently reside?", + "Read more": "Read more", + "Terms of Service": "Terms of Service", + "Deposit": "Deposit", + "This URL is unused.": "This URL is unused.", + "LBRY names must contain only letters, numbers and dashes.": "LBRY names must contain only letters, numbers and dashes.", + "Title": "Title", + "Thumbnail URL": "Thumbnail URL", + "Description": "Description", + "Description of your content": "Description of your content", + "Language": "Language", + "English": "English", + "Chinese": "Chinese", + "French": "French", + "German": "German", + "Japanese": "Japanese", + "Russian": "Russian", + "Spanish": "Spanish", + "Maturity": "Maturity", + "All Ages": "All Ages", + "Adults Only": "Adults Only", + "Cancel": "Cancel", + "File published": "File published", + "I agree to the": "I agree to the", + "LBRY terms of service": "LBRY terms of service", + "Your file has been published to LBRY at the address": "Your file has been published to LBRY at the address", + "The file will take a few minutes to appear for other LBRY users. Until then it will be listed as \"pending\" under your published files.": "The file will take a few minutes to appear for other LBRY users. Until then it will be listed as \"pending\" under your published files.", + "Error publishing file": "Error publishing file", + "The following error occurred when attempting to publish your file": "The following error occurred when attempting to publish your file", + "A deposit of at least \"%s\" credit is required to win \"%s\". However, you can still get a permanent URL for any amount.": { + "one": "A deposit of at least \"%s\" credit is required to win \"%s\". However, you can still get a permanent URL for any amount.", + "other": "A deposit of at least \"%s\" credits is required to win \"%s\". However, you can still get a permanent URL for any amount." + }, + "Connecting": "Connecting", + "Discover": "Discover", + "Fetching content": "Fetching content", + "What's this?": "What's this?" +} \ No newline at end of file diff --git a/ui/js/main.js b/ui/js/main.js index 454d6e5b5..13269ca8e 100644 --- a/ui/js/main.js +++ b/ui/js/main.js @@ -30,6 +30,10 @@ const {remote, ipcRenderer, shell} = require('electron'); const contextMenu = remote.require('./menu/context-menu'); const app = require('./app') +const i18n = require('y18n')({directory: 'app/locales'}); +window.__ = i18n.__; +window.__n = i18n.__n; + lbry.showMenuIfNeeded(); window.addEventListener('contextmenu', (event) => { @@ -93,7 +97,7 @@ var init = function() { if (window.sessionStorage.getItem('loaded') == 'y') { onDaemonReady(); } else { - ReactDOM.render(, canvas); + ReactDOM.render(, canvas); } }; diff --git a/ui/js/page/discover/view.jsx b/ui/js/page/discover/view.jsx index 91cdfafda..ba1b372e7 100644 --- a/ui/js/page/discover/view.jsx +++ b/ui/js/page/discover/view.jsx @@ -5,7 +5,7 @@ import FileCard from 'component/fileCard'; import {BusyMessage} from 'component/common.js'; import ToolTip from 'component/tooltip.js'; -const communityCategoryToolTipText = ('Community Content is a public space where anyone can share content with the ' + +const communityCategoryToolTipText = __('Community Content is a public space where anyone can share content with the ' + 'rest of the LBRY community. Bid on the names "one," "two," "three," "four" and ' + '"five" to put your content here!'); @@ -17,7 +17,7 @@ const FeaturedCategory = (props) => { return

{category} - {category && category.match(/^community/i) && } + {category && category.match(/^community/i) && }

{names && names.map(name => )}
@@ -55,4 +55,4 @@ class DiscoverPage extends React.Component{ } } -export default DiscoverPage; \ No newline at end of file +export default DiscoverPage; From d366b456343a22289922852d2a2431c564043ce4 Mon Sep 17 00:00:00 2001 From: Intnick Date: Mon, 22 May 2017 14:29:30 +0200 Subject: [PATCH 002/106] initial merge --- app/locales/en.json | 2 +- ui/js/page/publish/view.jsx | 137 ++++++++++++++++++------------------ 2 files changed, 71 insertions(+), 68 deletions(-) diff --git a/app/locales/en.json b/app/locales/en.json index 96527d026..8c63406bf 100644 --- a/app/locales/en.json +++ b/app/locales/en.json @@ -75,4 +75,4 @@ "Discover": "Discover", "Fetching content": "Fetching content", "What's this?": "What's this?" -} \ No newline at end of file +} diff --git a/ui/js/page/publish/view.jsx b/ui/js/page/publish/view.jsx index 0aa52c9b1..91b56d0cc 100644 --- a/ui/js/page/publish/view.jsx +++ b/ui/js/page/publish/view.jsx @@ -179,7 +179,7 @@ class PublishPage extends React.Component { } if (!lbryuri.isValidName(rawName, false)) { - this.refs.name.showError('LBRY names must contain only letters, numbers and dashes.'); + this.refs.name.showError(__("LBRY names must contain only letters, numbers and dashes.")); return; } @@ -266,7 +266,7 @@ class PublishPage extends React.Component { }; if (licenseType == 'copyright') { - newState.copyrightNotice = 'All rights reserved.' + newState.copyrightNotice = __("All rights reserved.") } this.setState(newState); @@ -302,7 +302,7 @@ class PublishPage extends React.Component { const newChannelName = (event.target.value.startsWith('@') ? event.target.value : '@' + event.target.value); if (newChannelName.length > 1 && !lbryuri.isValidName(newChannelName.substr(1), false)) { - this.refs.newChannelName.showError('LBRY channel names must contain only letters, numbers and dashes.'); + this.refs.newChannelName.showError(__("LBRY channel names must contain only letters, numbers and dashes.")); return; } else { this.refs.newChannelName.clearError() @@ -327,7 +327,7 @@ class PublishPage extends React.Component { handleCreateChannelClick(event) { if (this.state.newChannelName.length < 5) { - this.refs.newChannelName.showError('LBRY channel names must be at least 4 characters in length.'); + this.refs.newChannelName.showError(__("LBRY channel names must be at least 4 characters in length.")); return; } @@ -346,7 +346,7 @@ class PublishPage extends React.Component { }, 5000); }, (error) => { // TODO: better error handling - this.refs.newChannelName.showError('Unable to create channel due to an internal error.'); + this.refs.newChannelName.showError(__("Unable to create channel due to an internal error.")); this.setState({ creatingChannel: false, }); @@ -377,14 +377,17 @@ class PublishPage extends React.Component { getNameBidHelpText() { if (!this.state.name) { - return "Select a URL for this publish."; + return __("Select a URL for this publish."); } else if (this.state.nameResolved === false) { - return "This URL is unused."; + return __("This URL is unused."); } else if (this.state.myClaimExists) { - return "You have already used this URL. Publishing to it again will update your previous publish." + return __("You have already used this URL. Publishing to it again will update your previous publish.") } else if (this.state.topClaimValue) { - return A deposit of at least {this.state.topClaimValue} {this.state.topClaimValue == 1 ? 'credit ' : 'credits '} - is required to win {this.state.name}. However, you can still get a permanent URL for any amount. + return {__n("A deposit of at least \"%s\" credit is required to win \"%s\". However, you can still get a permanent URL for any amount." + , "A deposit of at least \"%s\" credits is required to win \"%s\". However, you can still get a permanent URL for any amount." + , this.state.topClaimValue /*pluralization param*/ + , this.state.topClaimValue, this.state.name /*regular params*/ + )} } else { return ''; } @@ -401,49 +404,49 @@ class PublishPage extends React.Component { return null; } - const lbcInputHelp = "This LBC remains yours and the deposit can be undone at any time." + const lbcInputHelp = __("This LBC remains yours and the deposit can be undone at any time."); return (
{ this.handleSubmit(event) }}>
-

Content

+

{__("Content")}

- What are you publishing? + {__("What are you publishing?")}
{ this.onFileChange(event) }} - helper={this.state.myClaimExists ? "If you don't choose a file, the file from your existing claim will be used." : null}/> + helper={this.state.myClaimExists ? __("If you don't choose a file, the file from your existing claim will be used.") : null}/>
{ !this.state.hasFile ? '' :
- +
- +
- +
- - - - - - - - + + + + + + + +
- + {/* */} - - + +
} @@ -451,73 +454,73 @@ class PublishPage extends React.Component {
-

Access

+

{__("Access")}

- How much does this content cost? + {__("How much does this content cost?")}
- +
- { this.handleFeePrefChange(false) } } defaultChecked={!this.state.isFee} /> - { this.handleFeePrefChange(false) } } defaultChecked={!this.state.isFee} /> + { this.handleFeePrefChange(true) } } defaultChecked={this.state.isFee} /> this.handleFeeAmountChange(event)} /> { this.handleFeeCurrencyChange(event) }}> - - + + { this.state.isFee ?
- If you choose to price this content in dollars, the number of credits charged will be adjusted based on the value of LBRY credits at the time of purchase. + {__("If you choose to price this content in dollars, the number of credits charged will be adjusted based on the value of LBRY credits at the time of purchase.")}
: '' } { this.handleLicenseChange(event) }}> - - - - - - - - - + + + + + + + + + {this.state.copyrightChosen - ? { this.handleCopyrightNoticeChange(event) }} /> : null} {this.state.otherLicenseChosen ? - { this.handleOtherLicenseDescriptionChange() }} /> + { this.handleOtherLicenseDescriptionChange() }} /> : null} {this.state.otherLicenseChosen ? - { this.handleOtherLicenseUrlChange(event) }} /> + { this.handleOtherLicenseUrlChange(event) }} /> : null}
-

Identity

+

{__("Identity")}

- Who created this content? + {__("Who created this content?")}
{ this.handleChannelChange(event) }} value={this.state.channel}> - + {this.state.channels.map(({name}) => )} - +
{this.state.channel == 'new' ?
- { this.handleNewChannelNameChange(event) }} ref={newChannelName => { this.refs.newChannelName = newChannelName }} + { this.handleNewChannelNameChange(event) }} ref={newChannelName => { this.refs.newChannelName = newChannelName }} value={this.state.newChannelName} /> - { this.handleNewChannelBidChange(event) }} value={this.state.newChannelBid} />
- { this.handleCreateChannelClick(event) }} disabled={this.state.creatingChannel} /> + { this.handleCreateChannelClick(event) }} disabled={this.state.creatingChannel} />
: null} @@ -534,8 +537,8 @@ class PublishPage extends React.Component {
-

Address

-
Where should this content permanently reside? .
+

{__("Address")}

+
{__("Where should this content permanently reside?")} .
{ this.handleNameChange(event) }} @@ -546,7 +549,7 @@ class PublishPage extends React.Component { { this.handleBidChange(event) }} value={this.state.bid} @@ -557,30 +560,30 @@ class PublishPage extends React.Component {
-

Terms of Service

+

{__("Terms of Service")}

I agree to the + {__("I agree to the")} } type="checkbox" name="tos_agree" ref={(field) => { this.refs.tos_agree = field }} onChange={(event) => { this.handleTOSChange(event)}} />
- { this.handleSubmit(event) }} disabled={this.state.submitting} /> - + { this.handleSubmit(event) }} disabled={this.state.submitting} /> +
- { this.handlePublishStartedConfirmed(event) }}> -

Your file has been published to LBRY at the address lbry://{this.state.name}!

-

The file will take a few minutes to appear for other LBRY users. Until then it will be listed as "pending" under your published files.

+

{__("Your file has been published to LBRY at the address")} lbry://{this.state.name}!

+

{__('The file will take a few minutes to appear for other LBRY users. Until then it will be listed as "pending" under your published files.')}

- { this.closeModal(event) }}> - The following error occurred when attempting to publish your file: {this.state.errorMessage} + {__("The following error occurred when attempting to publish your file")}: {this.state.errorMessage}
); From 936b56c4729d61258592f87e2c899c4f705973a2 Mon Sep 17 00:00:00 2001 From: Intnick Date: Mon, 22 May 2017 01:32:00 +0200 Subject: [PATCH 003/106] initial merge --- ui/js/page/start.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/js/page/start.js b/ui/js/page/start.js index 9a2b388b1..c3af27817 100644 --- a/ui/js/page/start.js +++ b/ui/js/page/start.js @@ -9,7 +9,7 @@ class StartPage extends React.Component { render() { return (
-

LBRY is Closed

+

__("LBRY is Closed")

); From df2192116cbbc09ecc3a02999dafd768a4f30c62 Mon Sep 17 00:00:00 2001 From: Intnick Date: Thu, 25 May 2017 19:31:10 +0200 Subject: [PATCH 004/106] finalization of i18n setup to i18n branch --- app/locales/en.json | 5 +++-- ui/js/page/discover/view.jsx | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/locales/en.json b/app/locales/en.json index 8c63406bf..c725e2624 100644 --- a/app/locales/en.json +++ b/app/locales/en.json @@ -74,5 +74,6 @@ "Connecting": "Connecting", "Discover": "Discover", "Fetching content": "Fetching content", - "What's this?": "What's this?" -} + "What's this?": "What's this?", + "Community Content is a public space where anyone can share content with the rest of the LBRY community. Bid on the names \"one,\" \"two,\" \"three,\" \"four\" and \"five\" to put your content here!": "Community Content is a public space where anyone can share content with the rest of the LBRY community. Bid on the names \"one,\" \"two,\" \"three,\" \"four\" and \"five\" to put your content here!" +} \ No newline at end of file diff --git a/ui/js/page/discover/view.jsx b/ui/js/page/discover/view.jsx index ba1b372e7..10e8309c9 100644 --- a/ui/js/page/discover/view.jsx +++ b/ui/js/page/discover/view.jsx @@ -5,7 +5,7 @@ import FileCard from 'component/fileCard'; import {BusyMessage} from 'component/common.js'; import ToolTip from 'component/tooltip.js'; -const communityCategoryToolTipText = __('Community Content is a public space where anyone can share content with the ' + +const communityCategoryToolTipText = ('Community Content is a public space where anyone can share content with the ' + 'rest of the LBRY community. Bid on the names "one," "two," "three," "four" and ' + '"five" to put your content here!'); @@ -17,7 +17,7 @@ const FeaturedCategory = (props) => { return

{category} - {category && category.match(/^community/i) && } + {category && category.match(/^community/i) && }

{names && names.map(name => )}
From 8917d9e7e7e61cce0049938874bf63f02123c957 Mon Sep 17 00:00:00 2001 From: Intnick Date: Fri, 26 May 2017 02:16:25 +0200 Subject: [PATCH 005/106] moved the import of y18n component before some other imports; translations for auth developer --- app/locales/en.json | 70 +++++++++++++++++++- ui/js/component/auth.js | 80 +++++++++++------------ ui/js/component/common.js | 6 +- ui/js/component/downloadingModal/view.jsx | 14 ++-- ui/js/component/errorModal/view.jsx | 18 ++--- ui/js/component/file-selector.js | 6 +- ui/js/component/form.js | 4 +- ui/js/component/modal.js | 13 ++-- ui/js/component/reward-link.js | 8 +-- ui/js/component/splash.js | 8 +-- ui/js/main.js | 12 ++-- ui/js/page/channel/view.jsx | 8 +-- ui/js/page/developer.js | 10 +-- ui/js/page/discover/view.jsx | 4 +- ui/js/page/fileListDownloaded/view.jsx | 4 +- ui/js/page/fileListPublished/view.jsx | 4 +- ui/js/page/filePage/view.jsx | 14 ++-- ui/js/page/start.js | 4 +- ui/js/selectors/app.js | 40 ++++++------ 19 files changed, 200 insertions(+), 127 deletions(-) diff --git a/app/locales/en.json b/app/locales/en.json index c725e2624..7c4e78d5e 100644 --- a/app/locales/en.json +++ b/app/locales/en.json @@ -75,5 +75,73 @@ "Discover": "Discover", "Fetching content": "Fetching content", "What's this?": "What's this?", - "Community Content is a public space where anyone can share content with the rest of the LBRY community. Bid on the names \"one,\" \"two,\" \"three,\" \"four\" and \"five\" to put your content here!": "Community Content is a public space where anyone can share content with the rest of the LBRY community. Bid on the names \"one,\" \"two,\" \"three,\" \"four\" and \"five\" to put your content here!" + "Community Content is a public space where anyone can share content with the rest of the LBRY community. Bid on the names \"one,\" \"two,\" \"three,\" \"four\" and \"five\" to put your content here!": "Community Content is a public space where anyone can share content with the rest of the LBRY community. Bid on the names \"one,\" \"two,\" \"three,\" \"four\" and \"five\" to put your content here!", + "LBRY is Closed": "LBRY is Closed", + "Click here to start LBRY": "Click here to start LBRY", + "Failed to load landing content.": "Failed to load landing content.", + "Settings": "Settings", + "Welcome to LBRY": "Welcome to LBRY", + "Downloads & Purchases": "Downloads & Purchases", + "Downloaded": "Downloaded", + "Published": "Published", + "Publishes": "Publishes", + "Overview": "Overview", + "Send": "Send", + "Receive": "Receive", + "Rewards": "Rewards", + "Search results for %s": "Search results for %s", + "Search": "Search", + "Your email is still not verified.": "Your email is still not verified.", + "Next": "Next", + "Email": "Email", + "Verification Code": "Verification Code", + "A verification code is required to access this version.": "A verification code is required to access this version.", + "Verify": "Verify", + "No code?": "No code?", + "Click here": "Click here", + "Authentication": "Authentication", + "LBRY Early Access": "LBRY Early Access", + "Preparing for first access": "Preparing for first access", + "Welcome to LBRY.": "Welcome to LBRY.", + "Using LBRY is like dating a centaur. Totally normal up top, and way different underneath.": "Using LBRY is like dating a centaur. Totally normal up top, and way different underneath.", + "Up top, LBRY is similar to popular media sites.": "Up top, LBRY is similar to popular media sites.", + "Below, LBRY is controlled by users -- you -- via blockchain and decentralization.": "Below, LBRY is controlled by users -- you -- via blockchain and decentralization.", + "Thank you for making content freedom possible! Here's a nickel, kid.": "Thank you for making content freedom possible! Here's a nickel, kid.", + "Developer Settings": "Developer Settings", + "Show developer menu": "Show developer menu", + "Use custom search servers": "Use custom search servers", + "Custom search servers (one per line)": "Custom search servers (one per line)", + "Force Upgrade": "Force Upgrade", + "OK": "OK", + "Show More...": "Show More...", + "Show Less": "Show Less", + "Starting daemon": "Starting daemon", + "Waiting for name resolution": "Waiting for name resolution", + "Using LBRY is like dating a centaur. Totally normal up top, and way different underneath.": "Using LBRY is like dating a centaur. Totally normal up top, and way different underneath.", + "Claim Reward": "Claim Reward", + "Claiming...": "Claiming...", + "This is an estimate and does not include data fees": "This is an estimate and does not include data fees", + "free": "free", + "Reward Claim Error": "Reward Claim Error", + "This field is required": "This field is required", + "Choose File": "Choose File", + "No File Chosen": "No File Chosen", + "Choose Directory": "Choose Directory", + "Downloading Update": "Downloading Update", + "Click \"Begin Upgrade\" to start the upgrade process.": "Click \"Begin Upgrade\" to start the upgrade process.", + "The app will close, and you will be prompted to install the latest version of LBRY.": "The app will close, and you will be prompted to install the latest version of LBRY.", + "After the install is complete, please reopen the app.": "After the install is complete, please reopen the app.", + "Begin Upgrade": "Begin Upgrade", + "API connection string": "API connection string", + "We're sorry that LBRY has encountered an error. This has been reported and we will investigate the problem.": "We're sorry that LBRY has encountered an error. This has been reported and we will investigate the problem.", + "You haven't downloaded anything from LBRY yet. Go": "You haven't downloaded anything from LBRY yet. Go", + "search for your first download": "search for your first download", + "Loading": "Loading", + " credits": " credits", + "It looks like you haven't published anything to LBRY yet. Go": "It looks like you haven't published anything to LBRY yet. Go", + "share your beautiful cats with the world": "share your beautiful cats with the world", + "report": "report", + "Content-Type": "Content-Type", + "Author": "Author", + "License": "License" } \ No newline at end of file diff --git a/ui/js/component/auth.js b/ui/js/component/auth.js index 1d1e8a406..12c6d7158 100644 --- a/ui/js/component/auth.js +++ b/ui/js/component/auth.js @@ -55,11 +55,11 @@ class SubmitEmailStage extends React.Component { return (
{ this.handleSubmit(event) }}> - { this._emailRow = ref }} type="text" label="Email" placeholder="scrwvwls@lbry.io" + { this._emailRow = ref }} type="text" label={__("Email")} placeholder="scrwvwls@lbry.io" name="email" value={this.state.email} onChange={(event) => { this.handleEmailChanged(event) }} />
- { this.handleSubmit(event) }} /> + { this.handleSubmit(event) }} />
@@ -102,7 +102,7 @@ class ConfirmEmailStage extends React.Component { if (userEmail.is_verified) { this.props.setStage("welcome") } else { - onSubmitError(new Error("Your email is still not verified.")) //shouldn't happen? + onSubmitError(new Error(__("Your email is still not verified."))) //shouldn't happen? } }, onSubmitError); } @@ -111,14 +111,14 @@ class ConfirmEmailStage extends React.Component { return (
{ this.handleSubmit(event) }}> - { this._codeRow = ref }} type="text" + { this._codeRow = ref }} type="text" name="code" placeholder="a94bXXXXXXXXXXXXXX" value={this.state.code} onChange={(event) => { this.handleCodeChanged(event) }} - helper="A verification code is required to access this version."/> + helper={__("A verification code is required to access this version.")}/>
- { this.handleSubmit(event)}} /> + { this.handleSubmit(event)}} />
- No code? { this.props.setStage("nocode")}} label="Click here" />. + {__("No code?")} { this.props.setStage("nocode")}} label={__("Click here")} />.
@@ -150,26 +150,26 @@ class WelcomeStage extends React.Component { render() { return ( !this.state.hasReward ? - +
-

Welcome to LBRY.

-

Using LBRY is like dating a centaur. Totally normal up top, and way different underneath.

-

Up top, LBRY is similar to popular media sites.

-

Below, LBRY is controlled by users -- you -- via blockchain and decentralization.

-

Thank you for making content freedom possible! Here's a nickel, kid.

+

{__("Welcome to LBRY.")}

+

{__("Using LBRY is like dating a centaur. Totally normal up top, and way different underneath.")}

+

{__("Up top, LBRY is similar to popular media sites.")}

+

{__("Below, LBRY is controlled by users -- you -- via blockchain and decentralization.")}

+

{__("Thank you for making content freedom possible! Here's a nickel, kid.")}

{ this.onRewardClaim(event) }} onRewardFailure={() => this.props.setStage(null)} onConfirmed={() => { this.props.setStage(null) }} />
: - { this.props.setStage(null) }}> + { this.props.setStage(null) }}>
-

About Your Reward

-

You earned a reward of LBRY credits, or LBC.

-

This reward will show in your Wallet momentarily, probably while you are reading this message.

-

LBC is used to compensate creators, to publish, and to have say in how the network works.

-

No need to understand it all just yet! Try watching or downloading something next.

-

Finally, know that LBRY is an early beta and that it earns the name.

+

{__("About Your Reward")}

+

{__("You earned a reward of ")} {__("LBRY credits, or \"LBC\".")}

+

{__("This reward will show in your Wallet momentarily, probably while you are reading this message.")}

+

{__("LBC is used to compensate creators, to publish, and to have say in how the network works.")}

+

{__("No need to understand it all just yet! Try watching or downloading something next.")}

+

{__("Finally, know that LBRY is an early beta and that it earns the name.")}

); @@ -178,16 +178,16 @@ class WelcomeStage extends React.Component { const ErrorStage = (props) => { return
-

An error was encountered that we cannot continue from.

-

At least we're earning the name beta.

- { props.errorText ?

Message: {props.errorText}

: '' } - { window.location.reload() } } /> +

{__("An error was encountered that we cannot continue from.")}

+

{__("At least we're earning the name beta.")}

+ { props.errorText ?

{__("Message:")} {props.errorText}

: '' } + { window.location.reload() } } />
} const PendingStage = (props) => { return
-

Preparing for first access

+

{__("Preparing for first access")}

} @@ -230,20 +230,20 @@ class CodeRequiredStage extends React.Component { return (
-

Access to LBRY is restricted as we build and scale the network.

-

There are two ways in:

-

Own LBRY Credits

-

If you own at least 1 LBC, you can get in right now.

+

{__("Access to LBRY is restricted as we build and scale the network.")}

+

{__("There are two ways in:")}

+

{__("Own LBRY Credits")}

+

{__("If you own at least 1 LBC, you can get in right now.")}

{ setLocal('auth_bypassed', true); this.props.setStage(null); }} - disabled={disabled} label="Let Me In" button={ disabled ? "alt" : "primary" } />

-

Your balance is . To increase your balance, send credits to this address:

-

-

If you don't understand how to send credits, then...

+ disabled={disabled} label={__("Let Me In")} button={ disabled ? "alt" : "primary" } />

+

{__("Your balance is ")}. {__("To increase your balance, send credits to this address:")}

+

+

{__("If you don't understand how to send credits, then...")}

-

Wait For A Code

-

If you provide your email, you'll automatically receive a notification when the system is open.

-

{ this.props.setStage("email"); }} label="Return" />

+

{__("Wait For A Code")}

+

{__("If you provide your email, you'll automatically receive a notification when the system is open.")}

+

{ this.props.setStage("email"); }} label={__("Return")} />

); @@ -312,16 +312,16 @@ export class AuthOverlay extends React.Component { const StageContent = this._stages[this.state.stage]; if (!StageContent) { - return Unknown authentication step. + return {__("Unknown authentication step.")} } return ( this.state.stage != "welcome" ? - -

LBRY Early Access

+ +

{__("LBRY Early Access")}

{ this.setStage(stage, stageProps) }} />
: { this.setStage(stage, stageProps) }} {...this.state.stageProps} /> ); } -} \ No newline at end of file +} diff --git a/ui/js/component/common.js b/ui/js/component/common.js index c11e0d14c..d864a1c48 100644 --- a/ui/js/component/common.js +++ b/ui/js/component/common.js @@ -68,9 +68,9 @@ export class CreditAmount extends React.Component { const formattedAmount = lbry.formatCredits(this.props.amount, this.props.precision); let amountText; if (this.props.showFree && parseFloat(formattedAmount) == 0) { - amountText = 'free'; + amountText = __('free'); } else if (this.props.label) { - amountText = formattedAmount + (parseFloat(formattedAmount) == 1 ? ' credit' : ' credits'); + amountText = formattedAmount + (parseFloat(formattedAmount) == 1 ? __(' credit') : __(' credits')); } else { amountText = formattedAmount; } @@ -80,7 +80,7 @@ export class CreditAmount extends React.Component { {amountText} - { this.props.isEstimate ? * : null } + { this.props.isEstimate ? * : null } ); } diff --git a/ui/js/component/downloadingModal/view.jsx b/ui/js/component/downloadingModal/view.jsx index b59605e28..32c6d030b 100644 --- a/ui/js/component/downloadingModal/view.jsx +++ b/ui/js/component/downloadingModal/view.jsx @@ -15,22 +15,22 @@ class DownloadingModal extends React.Component { } = this.props return ( - - Downloading Update{downloadProgress ? `: ${downloadProgress}%` : null} + + {__("Downloading Update")}{downloadProgress ? `: ${downloadProgress}%` : null} {downloadComplete ? (

-

Click "Begin Upgrade" to start the upgrade process.

-

The app will close, and you will be prompted to install the latest version of LBRY.

-

After the install is complete, please reopen the app.

+

{__("Click \"Begin Upgrade\" to start the upgrade process.")}

+

{__("The app will close, and you will be prompted to install the latest version of LBRY.")}

+

{__("After the install is complete, please reopen the app.")}

) : null }
{downloadComplete - ? + ? : null} - +
) diff --git a/ui/js/component/errorModal/view.jsx b/ui/js/component/errorModal/view.jsx index c494c9cb1..a5cbcd8c7 100644 --- a/ui/js/component/errorModal/view.jsx +++ b/ui/js/component/errorModal/view.jsx @@ -15,12 +15,12 @@ class ErrorModal extends React.Component { const errorObj = typeof error === "string" ? { error: error } : error const error_key_labels = { - connectionString: 'API connection string', - method: 'Method', - params: 'Parameters', - code: 'Error code', - message: 'Error message', - data: 'Error data', + connectionString: __('API connection string'), + method: __('Method'), + params: __('Parameters'), + code: __('Error code'), + message: __('Error message'), + data: __('Error data'), } @@ -35,16 +35,16 @@ class ErrorModal extends React.Component { return( -

Error

+

{__("Error")}

-

We're sorry that LBRY has encountered an error. This has been reported and we will investigate the problem.

+

{__("We're sorry that LBRY has encountered an error. This has been reported and we will investigate the problem.")}

) diff --git a/ui/js/component/file-selector.js b/ui/js/component/file-selector.js index 4670f4830..786d82caf 100644 --- a/ui/js/component/file-selector.js +++ b/ui/js/component/file-selector.js @@ -41,14 +41,14 @@ class FileSelector extends React.Component {
{' '} {this.state.path ? this.state.path : - 'No File Chosen'} + __('No File Chosen')}
); diff --git a/ui/js/component/form.js b/ui/js/component/form.js index 416011df3..809ebe534 100644 --- a/ui/js/component/form.js +++ b/ui/js/component/form.js @@ -21,7 +21,7 @@ export class FormField extends React.Component { constructor(props) { super(props); - this._fieldRequiredText = 'This field is required'; + this._fieldRequiredText = __('This field is required'); this._type = null; this._element = null; @@ -136,7 +136,7 @@ export class FormRow extends React.Component { constructor(props) { super(props); - this._fieldRequiredText = 'This field is required'; + this._fieldRequiredText = __('This field is required'); this.state = { isError: false, diff --git a/ui/js/component/modal.js b/ui/js/component/modal.js index bd3c1eb3c..89598e9e8 100644 --- a/ui/js/component/modal.js +++ b/ui/js/component/modal.js @@ -2,6 +2,9 @@ import React from 'react'; import ReactModal from 'react-modal'; import Link from 'component/link'; +const i18n = require('y18n')({directory: 'app/locales'}); + + export class Modal extends React.Component { static propTypes = { @@ -18,8 +21,8 @@ export class Modal extends React.Component { static defaultProps = { type: 'alert', overlay: true, - confirmButtonLabel: 'OK', - abortButtonLabel: 'Cancel', + confirmButtonLabel: i18n.__('OK'), + abortButtonLabel: i18n.__('Cancel'), confirmButtonDisabled: false, abortButtonDisabled: false, } @@ -52,9 +55,9 @@ export class ExpandableModal extends React.Component { } static defaultProps = { - confirmButtonLabel: 'OK', - expandButtonLabel: 'Show More...', - hideButtonLabel: 'Show Less', + confirmButtonLabel: i18n.__('OK'), + expandButtonLabel: i18n.__('Show More...'), + hideButtonLabel: i18n.__('Show Less'), } constructor(props) { diff --git a/ui/js/component/reward-link.js b/ui/js/component/reward-link.js index 31bd90e28..bb2c169cf 100644 --- a/ui/js/component/reward-link.js +++ b/ui/js/component/reward-link.js @@ -77,15 +77,15 @@ export class RewardLink extends React.Component { return (
{this.props.claimed - ? Reward claimed. + ? {__("Reward claimed.")} : { this.claimReward() }} />} + label={ this.state.pending ? __("Claiming...") : __("Claim Reward")} onClick={() => { this.claimReward() }} />} {this.state.errorMessage ? - { this.clearError() }}> + { this.clearError() }}> {this.state.errorMessage} : ''}
); } -} \ No newline at end of file +} diff --git a/ui/js/component/splash.js b/ui/js/component/splash.js index e2be56b67..d5433398a 100644 --- a/ui/js/component/splash.js +++ b/ui/js/component/splash.js @@ -12,7 +12,7 @@ export class SplashScreen extends React.Component { super(props); this.state = { - details: 'Starting daemon', + details: __('Starting daemon'), isLagging: false, }; } @@ -29,7 +29,7 @@ export class SplashScreen extends React.Component { // TODO: This is a hack, and the logic should live in the daemon // to give us a better sense of when we are actually started this.setState({ - details: 'Waiting for name resolution', + details: __('Waiting for name resolution'), isLagging: false }); @@ -54,8 +54,8 @@ export class SplashScreen extends React.Component { } else { this.setState({ isLagging: true, - message: "Failed to connect to LBRY", - details: "LBRY was unable to start and connect properly." + message: __("Failed to connect to LBRY"), + details: __("LBRY was unable to start and connect properly.") }) } }) diff --git a/ui/js/main.js b/ui/js/main.js index 13269ca8e..79c92c7d1 100644 --- a/ui/js/main.js +++ b/ui/js/main.js @@ -2,14 +2,19 @@ import React from 'react'; import ReactDOM from 'react-dom'; import lbry from './lbry.js'; import lbryio from './lbryio.js'; + +const i18n = require('y18n')({directory: 'app/locales'}); +window.__ = i18n.__; +window.__n = i18n.__n; + import lighthouse from './lighthouse.js'; import App from 'component/app/index.js'; -import SplashScreen from 'component/splash.js'; import SnackBar from 'component/snackBar'; -import {AuthOverlay} from 'component/auth.js'; import { Provider } from 'react-redux'; import batchActions from 'util/batchActions' import store from 'store.js'; +import SplashScreen from 'component/splash.js'; +import {AuthOverlay} from 'component/auth.js'; import { doChangePath, doNavigate, @@ -30,9 +35,6 @@ const {remote, ipcRenderer, shell} = require('electron'); const contextMenu = remote.require('./menu/context-menu'); const app = require('./app') -const i18n = require('y18n')({directory: 'app/locales'}); -window.__ = i18n.__; -window.__n = i18n.__n; lbry.showMenuIfNeeded(); diff --git a/ui/js/page/channel/view.jsx b/ui/js/page/channel/view.jsx index 05b447c60..eb09ea4d5 100644 --- a/ui/js/page/channel/view.jsx +++ b/ui/js/page/channel/view.jsx @@ -27,11 +27,11 @@ class ChannelPage extends React.Component{ let contentList if (claimsInChannel === undefined) { - contentList = + contentList = } else if (claimsInChannel) { contentList = claimsInChannel.length ? claimsInChannel.map((claim) => ) : - No content found. + {__("No content found.")} } return
@@ -41,11 +41,11 @@ class ChannelPage extends React.Component{

- This channel page is a stub. + {__("This channel page is a stub.")}

-

Published Content

+

{__("Published Content")}

{contentList}
} diff --git a/ui/js/page/developer.js b/ui/js/page/developer.js index 9e7175fd3..4ac1a133b 100644 --- a/ui/js/page/developer.js +++ b/ui/js/page/developer.js @@ -63,17 +63,17 @@ class DeveloperPage extends React.Component { return (
-

Developer Settings

+

{__("Developer Settings")}

- +
- +
{this.state.useCustomLighthouseServers ?
@@ -83,7 +83,7 @@ class DeveloperPage extends React.Component {
{ this.handleUpgradeFileChange() }}/>   - { this.handleForceUpgradeClick() }} /> + { this.handleForceUpgradeClick() }} />
diff --git a/ui/js/page/discover/view.jsx b/ui/js/page/discover/view.jsx index 10e8309c9..fff8663b8 100644 --- a/ui/js/page/discover/view.jsx +++ b/ui/js/page/discover/view.jsx @@ -38,7 +38,7 @@ class DiscoverPage extends React.Component{
{ fetchingFeaturedUris && - + } { typeof featuredUris === "object" && @@ -48,7 +48,7 @@ class DiscoverPage extends React.Component{ } { typeof featuredUris !== undefined && -
Failed to load landing content.
+
{__("Failed to load landing content.")}
}
) diff --git a/ui/js/page/fileListDownloaded/view.jsx b/ui/js/page/fileListDownloaded/view.jsx index 670b27191..df763195b 100644 --- a/ui/js/page/fileListDownloaded/view.jsx +++ b/ui/js/page/fileListDownloaded/view.jsx @@ -27,9 +27,9 @@ class FileListDownloaded extends React.Component { content = } else { if (isPending) { - content = + content = } else { - content = You haven't downloaded anything from LBRY yet. Go navigate('/discover')} label="search for your first download" />! + content = {__("You haven't downloaded anything from LBRY yet. Go")} navigate('/discover')} label={__("search for your first download")} />! } } diff --git a/ui/js/page/fileListPublished/view.jsx b/ui/js/page/fileListPublished/view.jsx index 1fe0ac592..bf1374a45 100644 --- a/ui/js/page/fileListPublished/view.jsx +++ b/ui/js/page/fileListPublished/view.jsx @@ -49,9 +49,9 @@ class FileListPublished extends React.Component { content = } else { if (isPending) { - content = + content = } else { - content = It looks like you haven't published anything to LBRY yet. Go navigate('/publish')} label="share your beautiful cats with the world" />! + content = {__("It looks like you haven't published anything to LBRY yet. Go")} navigate('/publish')} label={__("share your beautiful cats with the world")} />! } } diff --git a/ui/js/page/filePage/view.jsx b/ui/js/page/filePage/view.jsx index 2373588b7..660b8a366 100644 --- a/ui/js/page/filePage/view.jsx +++ b/ui/js/page/filePage/view.jsx @@ -26,16 +26,16 @@ const FormatItem = (props) => { - + - + - + - +
Content-Type{mediaType}{__("Content-Type")}{mediaType}
Author{author}{__("Author")}{author}
Language{language}{__("Language")}{language}
License{license}{__("License")}{license}
@@ -68,7 +68,7 @@ class FilePage extends React.Component{ } = this.props if (!claim || !metadata) { - return Empty claim or metadata info. + return {__("Empty claim or metadata info.")} } const { @@ -117,7 +117,7 @@ class FilePage extends React.Component{ : '' }
- +
@@ -125,4 +125,4 @@ class FilePage extends React.Component{ } } -export default FilePage; \ No newline at end of file +export default FilePage; diff --git a/ui/js/page/start.js b/ui/js/page/start.js index c3af27817..3caf500a5 100644 --- a/ui/js/page/start.js +++ b/ui/js/page/start.js @@ -9,8 +9,8 @@ class StartPage extends React.Component { render() { return (
-

__("LBRY is Closed")

- +

{__("LBRY is Closed")}

+
); } diff --git a/ui/js/selectors/app.js b/ui/js/selectors/app.js index 25ed2403c..9509f8f7a 100644 --- a/ui/js/selectors/app.js +++ b/ui/js/selectors/app.js @@ -39,13 +39,13 @@ export const selectPageTitle = createSelector( (page, params) => { switch (page) { case 'search': - return params.query ? `Search results for ${params.query}` : 'Search' + return params.query ? __("Search results for %s", params.query) : __('Search') case 'settings': - return 'Settings' + return __('Settings') case 'help': - return 'Help' + return __('Help') case 'report': - return 'Report' + return __('Report') case 'wallet': case 'send': case 'receive': @@ -54,19 +54,19 @@ export const selectPageTitle = createSelector( case 'show': return lbryuri.normalize(params.uri) case 'downloaded': - return 'Downloads & Purchases' + return __('Downloads & Purchases') case 'published': - return 'Publishes' + return __('Publishes') case 'start': - return 'Start' + return __('Start') case 'publish': - return 'Publish' + return __('Publish') case 'help': - return 'Help' + return __('Help') case 'developer': - return 'Developer' + return __('Developer') case 'discover': - return 'Home' + return __('Home') default: return ''; } @@ -142,22 +142,22 @@ export const selectHeaderLinks = createSelector( case 'receive': case 'rewards': return { - 'wallet': 'Overview', - 'send': 'Send', - 'receive': 'Receive', - 'rewards': 'Rewards', + 'wallet': __('Overview'), + 'send': __('Send'), + 'receive': __('Receive'), + 'rewards': __('Rewards'), }; case 'downloaded': case 'published': return { - 'downloaded': 'Downloaded', - 'published': 'Published', + 'downloaded': __('Downloaded'), + 'published': __('Published'), }; case 'settings': case 'help': return { - 'settings': 'Settings', - 'help': 'Help', + 'settings': __('Settings'), + 'help': __('Help'), } default: return null; @@ -203,4 +203,4 @@ export const selectSnackBar = createSelector( export const selectSnackBarSnacks = createSelector( selectSnackBar, (snackBar) => snackBar.snacks || [] -) \ No newline at end of file +) From 85aa35122ed566fb4cb67669b9f1dca2a1ae8d1d Mon Sep 17 00:00:00 2001 From: Intnick Date: Fri, 26 May 2017 02:27:05 +0200 Subject: [PATCH 006/106] help page trans --- app/locales/en.json | 24 ++++++++++++++++++++++-- ui/js/page/help/view.jsx | 36 ++++++++++++++++++------------------ 2 files changed, 40 insertions(+), 20 deletions(-) diff --git a/app/locales/en.json b/app/locales/en.json index 7c4e78d5e..d5eebd356 100644 --- a/app/locales/en.json +++ b/app/locales/en.json @@ -143,5 +143,25 @@ "report": "report", "Content-Type": "Content-Type", "Author": "Author", - "License": "License" -} \ No newline at end of file + "License": "License", + "Read the FAQ": "Read the FAQ", + "Our FAQ answers many common questions.": "Our FAQ answers many common questions.", + "Get Live Help": "Get Live Help", + "Live help is available most hours in the": "Live help is available most hours in the", + "channel of our Slack chat room.": "channel of our Slack chat room.", + "Join Our Slack": "Join Our Slack", + "Report a Bug": "Report a Bug", + "Did you find something wrong?": "Did you find something wrong?", + "Submit a Bug Report": "Submit a Bug Report", + "Thanks! LBRY is made by its users.": "Thanks! LBRY is made by its users.", + "Report": "Report", + "About": "About", + "A newer version of LBRY is available.": "A newer version of LBRY is available.", + "Download LBRY %s now!": "Download LBRY %s now!", + "Your copy of LBRY is up to date.": "Your copy of LBRY is up to date.", + "daemon (lbrynet)": "daemon (lbrynet)", + "wallet (lbryum)": "wallet (lbryum)", + "interface": "interface", + "Platform": "Platform", + "Installation ID": "Installation ID" +} diff --git a/ui/js/page/help/view.jsx b/ui/js/page/help/view.jsx index 3f351adfd..07e03efc4 100644 --- a/ui/js/page/help/view.jsx +++ b/ui/js/page/help/view.jsx @@ -59,62 +59,62 @@ class HelpPage extends React.Component {
-

Read the FAQ

+

{__("Read the FAQ")}

-

Our FAQ answers many common questions.

-

+

{__("Our FAQ answers many common questions.")}

+

-

Get Live Help

+

{__("Get Live Help")}

- Live help is available most hours in the #help channel of our Slack chat room. + {__("Live help is available most hours in the")} #help {__("channel of our Slack chat room.")}

- +

-

Report a Bug

+

{__("Report a Bug")}

-

Did you find something wrong?

-

navigate('report')} label="Submit a Bug Report" icon="icon-bug" button="alt" />

-
Thanks! LBRY is made by its users.
+

{__("Did you find something wrong?")}

+

navigate('report')} label={__("Submit a Bug Report")} icon="icon-bug" button="alt" />

+
{__("Thanks! LBRY is made by its users.")}
{!ver ? null :
-

About

+

{__("About")}

{ver.lbrynet_update_available || ver.lbryum_update_available ? -

A newer version of LBRY is available.

- :

Your copy of LBRY is up to date.

+

{__("A newer version of LBRY is available.")}

+ :

{__("Your copy of LBRY is up to date.")}

} - + - + - + - + - + From 6bd1dccbb8b643479cdf8a8b57b95332872995fa Mon Sep 17 00:00:00 2001 From: Intnick Date: Fri, 26 May 2017 02:38:55 +0200 Subject: [PATCH 007/106] search page translated --- app/locales/en.json | 8 ++++++-- ui/js/page/search/view.jsx | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/locales/en.json b/app/locales/en.json index d5eebd356..80799feeb 100644 --- a/app/locales/en.json +++ b/app/locales/en.json @@ -163,5 +163,9 @@ "wallet (lbryum)": "wallet (lbryum)", "interface": "interface", "Platform": "Platform", - "Installation ID": "Installation ID" -} + "Installation ID": "Installation ID", + "Search Results for": "Search Results for", + "These search results are provided by LBRY, Inc.": "These search results are provided by LBRY, Inc.", + "Exact URL": "Exact URL", + "This is the resolution of a LBRY URL and not controlled by LBRY Inc.": "This is the resolution of a LBRY URL and not controlled by LBRY Inc." +} \ No newline at end of file diff --git a/ui/js/page/search/view.jsx b/ui/js/page/search/view.jsx index 8328434fc..5b28f7b2c 100644 --- a/ui/js/page/search/view.jsx +++ b/ui/js/page/search/view.jsx @@ -17,14 +17,14 @@ class SearchPage extends React.Component{ { lbryuri.isValid(query) ?

- Exact URL

: '' }

- Search Results for {query}

From a000058bf6eac63a2b2e3cf02bf0ae52e6b14ecc Mon Sep 17 00:00:00 2001 From: Intnick Date: Fri, 26 May 2017 08:40:35 +0200 Subject: [PATCH 008/106] page settings, show, wallet, report translated --- app/locales/en.json | 27 ++++++++++++++++++++++++++- ui/js/page/report.js | 16 ++++++++-------- ui/js/page/settings/view.jsx | 32 ++++++++++++++++---------------- ui/js/page/showPage/view.jsx | 6 +++--- ui/js/page/wallet/view.jsx | 2 +- 5 files changed, 54 insertions(+), 29 deletions(-) diff --git a/app/locales/en.json b/app/locales/en.json index 80799feeb..27446956d 100644 --- a/app/locales/en.json +++ b/app/locales/en.json @@ -167,5 +167,30 @@ "Search Results for": "Search Results for", "These search results are provided by LBRY, Inc.": "These search results are provided by LBRY, Inc.", "Exact URL": "Exact URL", - "This is the resolution of a LBRY URL and not controlled by LBRY Inc.": "This is the resolution of a LBRY URL and not controlled by LBRY Inc." + "This is the resolution of a LBRY URL and not controlled by LBRY Inc.": "This is the resolution of a LBRY URL and not controlled by LBRY Inc.", + "Download Directory": "Download Directory", + "LBRY downloads will be saved here.": "LBRY downloads will be saved here.", + "Bandwidth Limits": "Bandwidth Limits", + "Max Upload": "Max Upload", + "Unlimited": "Unlimited", + "Up to": "Up to", + "Max Download": "Max Download", + "Show unavailable content in search results": "Show unavailable content in search results", + "Show NSFW content": "Show NSFW content", + "NSFW content may include nudity, intense sexuality, profanity, or other adult content. By displaying NSFW content, you are affirming you are of legal age to view mature content in your country or jurisdiction. ": "NSFW content may include nudity, intense sexuality, profanity, or other adult content. By displaying NSFW content, you are affirming you are of legal age to view mature content in your country or jurisdiction. ", + "Share Diagnostic Data": "Share Diagnostic Data", + "Help make LBRY better by contributing diagnostic data about my usage": "Help make LBRY better by contributing diagnostic data about my usage", + "Choose limit...": "Choose limit...", + "Loading magic decentralized data...": "Loading magic decentralized data...", + "There's nothing at this location.": "There's nothing at this location.", + "Report an Issue": "Report an Issue", + "Please describe the problem you experienced and any information you think might be useful to us. Links to screenshots are great!": "Please describe the problem you experienced and any information you think might be useful to us. Links to screenshots are great!", + "Description of your issue": "Description of your issue", + "Submit Report": "Submit Report", + "Developer?": "Developer?", + "You can also": "You can also", + "submit an issue on GitHub": "submit an issue on GitHub", + "Bug report submitted": "Bug report submitted", + "Your bug report has been submitted! Thank you for your feedback.": "Your bug report has been submitted! Thank you for your feedback.", + "Balance": "Balance" } \ No newline at end of file diff --git a/ui/js/page/report.js b/ui/js/page/report.js index 811adbb04..8d6b259ab 100644 --- a/ui/js/page/report.js +++ b/ui/js/page/report.js @@ -40,25 +40,25 @@ class ReportPage extends React.Component {
-

Report an Issue

-

Please describe the problem you experienced and any information you think might be useful to us. Links to screenshots are great!

+

{__("Report an Issue")}

+

{__("Please describe the problem you experienced and any information you think might be useful to us. Links to screenshots are great!")}

- this._messageArea = t} rows="10" name="message" placeholder="Description of your issue" /> + this._messageArea = t} rows="10" name="message" placeholder={__("Description of your issue")} />
- +
-

Developer?

- You can also . +

{__("Developer?")}

+ {__("You can also")} .
- { this.closeModal(event) }}> - Your bug report has been submitted! Thank you for your feedback. + {__("Your bug report has been submitted! Thank you for your feedback.")}
); diff --git a/ui/js/page/settings/view.jsx b/ui/js/page/settings/view.jsx index d1a4f188c..ea70629ee 100644 --- a/ui/js/page/settings/view.jsx +++ b/ui/js/page/settings/view.jsx @@ -78,7 +78,7 @@ class SettingsPage extends React.Component { } = this.props if (!daemonSettings) { - return
Failed to load settings.
; + return
{__("Failed to load settings.")}
; } /*
@@ -98,33 +98,33 @@ class SettingsPage extends React.Component {
-

Download Directory

+

{__("Download Directory")}

-

Bandwidth Limits

+

{__("Bandwidth Limits")}

-
Max Upload
+
{__("Max Upload")}
{ this.onMaxUploadPrefChange(false) }} defaultChecked={!this.state.isMaxUpload} - label="Unlimited" /> + label={__("Unlimited")} />
{ this.onMaxUploadPrefChange(true) }} defaultChecked={this.state.isMaxUpload} - label={ this.state.isMaxUpload ? 'Up to' : 'Choose limit...' } /> + label={ this.state.isMaxUpload ? __("Up to") : __("Choose limit...") } /> { this.state.isMaxUpload ?
-
Max Download
-
{__("Max Download")}
+ { this.onMaxDownloadPrefChange(false) }} @@ -152,7 +152,7 @@ class SettingsPage extends React.Component { name="max_download_pref" onChange={() => { this.onMaxDownloadPrefChange(true) }} defaultChecked={this.state.isMaxDownload} - label={ this.state.isMaxDownload ? 'Up to' : 'Choose limit...' } /> + label={ this.state.isMaxDownload ? __("Up to") : __("Choose limit...") } /> { this.state.isMaxDownload ?
-

Content

+

{__("Content")}

+ label={__("Show unavailable content in search results")} />
- + helper={__("NSFW content may include nudity, intense sexuality, profanity, or other adult content. By displaying NSFW content, you are affirming you are of legal age to view mature content in your country or jurisdiction. ")} />
-

Share Diagnostic Data

+

{__("Share Diagnostic Data")}

+ label={__("Help make LBRY better by contributing diagnostic data about my usage")} />
diff --git a/ui/js/page/showPage/view.jsx b/ui/js/page/showPage/view.jsx index bab2d4426..633259bea 100644 --- a/ui/js/page/showPage/view.jsx +++ b/ui/js/page/showPage/view.jsx @@ -43,8 +43,8 @@ class ShowPage extends React.Component{

{uri}

- { isResolvingUri && } - { claim === null && There's nothing at this location. } + { isResolvingUri && } + { claim === null && {__("There's nothing at this location.")} }
} @@ -61,4 +61,4 @@ class ShowPage extends React.Component{ } } -export default ShowPage \ No newline at end of file +export default ShowPage diff --git a/ui/js/page/wallet/view.jsx b/ui/js/page/wallet/view.jsx index 4093d003f..a577aa19d 100644 --- a/ui/js/page/wallet/view.jsx +++ b/ui/js/page/wallet/view.jsx @@ -19,7 +19,7 @@ const WalletPage = (props) => {
-

Balance

+

{__("Balance")}

From 0119ed8edc91f31aea819faa5dd171c53f83c180 Mon Sep 17 00:00:00 2001 From: Intnick Date: Fri, 26 May 2017 09:02:37 +0200 Subject: [PATCH 009/106] filaActions and fileCard components translated --- app/locales/en.json | 30 +++++++++++++++++++-- ui/js/component/fileActions/view.jsx | 40 ++++++++++++++-------------- ui/js/component/fileCard/view.jsx | 7 +++-- 3 files changed, 51 insertions(+), 26 deletions(-) diff --git a/app/locales/en.json b/app/locales/en.json index 27446956d..ac594431f 100644 --- a/app/locales/en.json +++ b/app/locales/en.json @@ -192,5 +192,31 @@ "submit an issue on GitHub": "submit an issue on GitHub", "Bug report submitted": "Bug report submitted", "Your bug report has been submitted! Thank you for your feedback.": "Your bug report has been submitted! Thank you for your feedback.", - "Balance": "Balance" -} \ No newline at end of file + "Balance": "Balance", + "Open in Folder": "Open in Folder", + "Checking availability": "Checking availability", + "Confirm Purchase": "Confirm Purchase", + "This will purchase": "This will purchase", + "for": "for", + "credits": "credits", + "Not enough credits": "Not enough credits", + "You don't have enough LBRY credits to pay for this stream.": "You don't have enough LBRY credits to pay for this stream.", + "Download failed": "Download failed", + "LBRY was unable to download the stream": "LBRY was unable to download the stream", + "Remove": "Remove", + "Are you sure you'd like to remove": "Are you sure you'd like to remove", + "from LBRY?": "from LBRY?", + "Delete this file from my computer": "Delete this file from my computer", + "Download": "Download", + "Content unavailable.": "Content unavailable.", + "Why?": "Why?", + "The content on LBRY is hosted by its users. It appears there are no users connected that have this file at the moment.": "The content on LBRY is hosted by its users. It appears there are no users connected that have this file at the moment.", + "Try Anyway": "Try Anyway", + "Open": "Open", + "Remove...": "Remove...", + "% complete": "% complete", + "Loading...": "Loading...", + "Empty claim or metadata info.": "Empty claim or metadata info.", + "This content is Not Safe For Work. To view adult content, please change your": "This content is Not Safe For Work. To view adult content, please change your", + "This address contains no content.": "This address contains no content." +} diff --git a/ui/js/component/fileActions/view.jsx b/ui/js/component/fileActions/view.jsx index 4924d059d..f72893df1 100644 --- a/ui/js/component/fileActions/view.jsx +++ b/ui/js/component/fileActions/view.jsx @@ -66,7 +66,7 @@ class FileActions extends React.Component { const deleteChecked = this.state.deleteChecked, metadata = fileInfo ? fileInfo.metadata : null, - openInFolderMessage = platform.startsWith('Mac') ? 'Open in Finder' : 'Open in Folder', + openInFolderMessage = platform.startsWith('Mac') ? __('Open in Finder') : __('Open in Folder'), showMenu = fileInfo && Object.keys(fileInfo).length > 0, title = metadata ? metadata.title : uri; @@ -76,7 +76,7 @@ class FileActions extends React.Component { const progress = (fileInfo && fileInfo.written_bytes) ? fileInfo.written_bytes / fileInfo.total_bytes * 100 : 0, - label = fileInfo ? progress.toFixed(0) + '% complete' : 'Connecting...', + label = fileInfo ? progress.toFixed(0) + __('% complete') : __('Connecting...'), labelWithIcon = {label}; content =
@@ -86,24 +86,24 @@ class FileActions extends React.Component { } else if (!fileInfo && isAvailable === undefined) { - content = + content = } else if (!fileInfo && !isAvailable && !this.state.forceShowActions) { content =
-
Content unavailable.
- {__("Content unavailable.")}
+ - +
} else if (fileInfo === null && !downloading) { - content = { startDownload(uri) } } />; + content = { startDownload(uri) } } />; } else if (fileInfo && fileInfo.download_path) { - content = openInShell(fileInfo)} />; + content = openInShell(fileInfo)} />; } else { console.log('handle this case of file action props?'); console.log(this.props) @@ -115,29 +115,29 @@ class FileActions extends React.Component { { showMenu ? openInFolder(fileInfo)} label={openInFolderMessage} /> - openModal('confirmRemove')} label="Remove..." /> + openModal('confirmRemove')} label={__("Remove...")} /> : '' } - This will purchase {title} for credits. + contentLabel={__("Confirm Purchase")} onConfirmed={this.onAffirmPurchase.bind(this)} onAborted={this.props.closeModal}> + {__("This will purchase")} {title} {__("for")} {__("credits")}. - - You don't have enough LBRY credits to pay for this stream. + {__("You don't have enough LBRY credits to pay for this stream.")} - - LBRY was unable to download the stream {uri}. + {__("LBRY was unable to download the stream")} {uri}. deleteFile(fileInfo.outpoint, deleteChecked)} onAborted={closeModal}> -

Are you sure you'd like to remove {title} from LBRY?

+

{__("Are you sure you'd like to remove")} {title} {__("from LBRY?")}

- +
); diff --git a/ui/js/component/fileCard/view.jsx b/ui/js/component/fileCard/view.jsx index 918476a53..d333c03c9 100644 --- a/ui/js/component/fileCard/view.jsx +++ b/ui/js/component/fileCard/view.jsx @@ -68,11 +68,11 @@ class FileCard extends React.Component { let description = "" if (isResolvingUri) { - description = "Loading..." + description = __("Loading...") } else if (metadata && metadata.description) { description = metadata.description } else if (claim === null) { - description = 'This address contains no content.' + description = __("This address contains no content.") } return ( @@ -99,8 +99,7 @@ class FileCard extends React.Component { {obscureNsfw && this.state.hovered ?

- This content is Not Safe For Work. - To view adult content, please change your navigate('settings')} label="Settings" />. + {__("This content is Not Safe For Work. To view adult content, please change your")} navigate('settings')} label={__("Settings")} />.

: null} From 73e7419bf29062037f0acc14a7e3cd9254180648 Mon Sep 17 00:00:00 2001 From: Intnick Date: Fri, 26 May 2017 15:55:59 +0200 Subject: [PATCH 010/106] fileList component translated --- app/locales/en.json | 7 +++++-- ui/js/component/fileList/view.jsx | 8 ++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/locales/en.json b/app/locales/en.json index ac594431f..e99a342a3 100644 --- a/app/locales/en.json +++ b/app/locales/en.json @@ -218,5 +218,8 @@ "Loading...": "Loading...", "Empty claim or metadata info.": "Empty claim or metadata info.", "This content is Not Safe For Work. To view adult content, please change your": "This content is Not Safe For Work. To view adult content, please change your", - "This address contains no content.": "This address contains no content." -} + "This address contains no content.": "This address contains no content.", + "Sort by": "Sort by", + "Date": "Date", + "File name": "File name" +} \ No newline at end of file diff --git a/ui/js/component/fileList/view.jsx b/ui/js/component/fileList/view.jsx index eb3b620b8..cd85a7b84 100644 --- a/ui/js/component/fileList/view.jsx +++ b/ui/js/component/fileList/view.jsx @@ -77,11 +77,11 @@ class FileList extends React.Component {
{ fetching && } - Sort by { ' ' } + {__("Sort by")} { ' ' } - - - + + + {content} From 9ba4da4032e69ff2447f361ceb20df74ce020ff7 Mon Sep 17 00:00:00 2001 From: Intnick Date: Fri, 26 May 2017 16:13:16 +0200 Subject: [PATCH 011/106] fileListSearch and fileTitle component translated --- app/locales/en.json | 8 +++++++- ui/js/component/fileListSearch/view.jsx | 10 +++++----- ui/js/component/fileTile/view.jsx | 11 +++++------ 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/app/locales/en.json b/app/locales/en.json index e99a342a3..d0ad9cd54 100644 --- a/app/locales/en.json +++ b/app/locales/en.json @@ -221,5 +221,11 @@ "This address contains no content.": "This address contains no content.", "Sort by": "Sort by", "Date": "Date", - "File name": "File name" + "File name": "File name", + "Looking up the Dewey Decimals": "Looking up the Dewey Decimals", + "No one has checked anything in for %s yet.": "No one has checked anything in for %s yet.", + "Be the first": "Be the first", + "Refreshing the Dewey Decimals": "Refreshing the Dewey Decimals", + "This location is unused.": "This location is unused.", + "Put something here!": "Put something here!" } \ No newline at end of file diff --git a/ui/js/component/fileListSearch/view.jsx b/ui/js/component/fileListSearch/view.jsx index 986d8aa5c..7666c54fc 100644 --- a/ui/js/component/fileListSearch/view.jsx +++ b/ui/js/component/fileListSearch/view.jsx @@ -16,8 +16,8 @@ const SearchNoResults = (props) => { return
- No one has checked anything in for {query} yet. { ' ' } - navigate('/publish')} /> + {__("No one has checked anything in for %s yet."), query} { ' ' } + navigate('/publish')} />
; } @@ -60,10 +60,10 @@ class FileListSearch extends React.Component{ return (
{isSearching && !results && - } + } {isSearching && results && - } + } {(results && !!results.length) ? : @@ -73,4 +73,4 @@ class FileListSearch extends React.Component{ } } -export default FileListSearch \ No newline at end of file +export default FileListSearch diff --git a/ui/js/component/fileTile/view.jsx b/ui/js/component/fileTile/view.jsx index 250bf6296..610ad2d28 100644 --- a/ui/js/component/fileTile/view.jsx +++ b/ui/js/component/fileTile/view.jsx @@ -68,15 +68,15 @@ class FileTile extends React.Component { if (isClaimed) { description = metadata && metadata.description } else if (isResolvingUri) { - description = "Loading..." + description = __("Loading...") } else if (showEmpty === FileTile.SHOW_EMPTY_PUBLISH) { onClick = () => navigate('/publish', { }) description = - This location is unused. { ' ' } - { isClaimable && Put something here! } + {__("This location is unused.")} { ' ' } + { isClaimable && {__("Put something here!")} } } else if (showEmpty === FileTile.SHOW_EMPTY_PENDING) { - description = This file is pending confirmation. + description = {__("This file is pending confirmation.")} } return ( @@ -103,8 +103,7 @@ class FileTile extends React.Component { {this.state.showNsfwHelp ?

- This content is Not Safe For Work. - To view adult content, please change your navigate('/settings')} label="Settings" />. + {__("This content is Not Safe For Work. To view adult content, please change your")} navigate('/settings')} label={__("Settings")} />.

: null} From c5df0875045e5f0f9e6949a84aec8c3676f235b5 Mon Sep 17 00:00:00 2001 From: Intnick Date: Fri, 26 May 2017 16:19:49 +0200 Subject: [PATCH 012/106] header and tranactionList component translated --- app/locales/en.json | 8 +++++++- ui/js/component/header/view.jsx | 2 +- ui/js/component/transactionList/view.jsx | 20 ++++++++++---------- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/app/locales/en.json b/app/locales/en.json index d0ad9cd54..04947c1b9 100644 --- a/app/locales/en.json +++ b/app/locales/en.json @@ -227,5 +227,11 @@ "Be the first": "Be the first", "Refreshing the Dewey Decimals": "Refreshing the Dewey Decimals", "This location is unused.": "This location is unused.", - "Put something here!": "Put something here!" + "Put something here!": "Put something here!", + "Transaction History": "Transaction History", + "You have no transactions.": "You have no transactions.", + "Loading transactions": "Loading transactions", + "Amount": "Amount", + "Time": "Time", + "Transaction": "Transaction" } \ No newline at end of file diff --git a/ui/js/component/header/view.jsx b/ui/js/component/header/view.jsx index 68328feb9..32d15501a 100644 --- a/ui/js/component/header/view.jsx +++ b/ui/js/component/header/view.jsx @@ -23,7 +23,7 @@ export const Header = (props) => { navigate('/wallet')} button="text" icon="icon-bank" label={balance} >
- navigate('/publish')} button="primary button--flat" icon="icon-upload" label="Publish" /> + navigate('/publish')} button="primary button--flat" icon="icon-upload" label={__("Publish")} />
navigate('/downloaded')} button="alt button--flat" icon="icon-folder" /> diff --git a/ui/js/component/transactionList/view.jsx b/ui/js/component/transactionList/view.jsx index 5d92e2b68..3da32a13d 100644 --- a/ui/js/component/transactionList/view.jsx +++ b/ui/js/component/transactionList/view.jsx @@ -22,8 +22,8 @@ class TransactionList extends React.Component{ rows.push(
- - + + @@ -35,19 +35,19 @@ class TransactionList extends React.Component{ return (
-

Transaction History

+

{__("Transaction History")}

- { fetchingTransactions && } - { !fetchingTransactions && rows.length === 0 ?
You have no transactions.
: '' } + { fetchingTransactions && } + { !fetchingTransactions && rows.length === 0 ?
{__("You have no transactions.")}
: '' } { rows.length > 0 ?
daemon (lbrynet){__("daemon (lbrynet)")} {ver.lbrynet_version}
wallet (lbryum){__("wallet (lbryum)")} {ver.lbryum_version}
interface{__("interface")} {uiVersion}
Platform{__("Platform")} {platform}
Installation ID{__("Installation ID")} {this.state.lbryId}
{ (item.amount > 0 ? '+' : '' ) + item.amount }{ item.date ? item.date.toLocaleDateString() : (Transaction pending) }{ item.date ? item.date.toLocaleTimeString() : (Transaction pending) }{ item.date ? item.date.toLocaleDateString() : {__("(Transaction pending)")} }{ item.date ? item.date.toLocaleTimeString() : {__("(Transaction pending)")} } {item.id.substr(0, 7)}
- - - - + + + + @@ -62,4 +62,4 @@ class TransactionList extends React.Component{ } } -export default TransactionList \ No newline at end of file +export default TransactionList From dbb118c8ee3313ae3c2036449700c687a59a7cab Mon Sep 17 00:00:00 2001 From: Mayesters Date: Fri, 26 May 2017 17:30:18 +0200 Subject: [PATCH 013/106] Fix small error in merge master -> i18n --- ui/js/page/help/view.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/js/page/help/view.jsx b/ui/js/page/help/view.jsx index 9d4d49e46..81c889463 100644 --- a/ui/js/page/help/view.jsx +++ b/ui/js/page/help/view.jsx @@ -99,7 +99,7 @@ class HelpPage extends React.Component { {this.state.appVersionInfo ? (ver.lbrynet_update_available || ver.lbryum_update_available ?

{__("A newer version of LBRY is available.")}

- :

{__("Your copy of LBRY is up to date.")}

+ :

{__("Your copy of LBRY is up to date.")}

) : null} { ver ?
AmountDateTimeTransaction{__("Amount")}{__("Date")}{__("Time")}{__("Transaction")}
From 01cb3f583ee7f32231f5bf9af551c424b722581a Mon Sep 17 00:00:00 2001 From: Mayesters Date: Fri, 26 May 2017 22:26:06 +0200 Subject: [PATCH 014/106] 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; From d5a4032b9f2295148a5b62970c7544a787d7a735 Mon Sep 17 00:00:00 2001 From: Intnick Date: Thu, 25 May 2017 18:29:56 +0200 Subject: [PATCH 015/106] initial merge --- app/locales/en.json | 78 ++++++++++++++++++++++++++++++++++++ ui/js/main.js | 6 ++- ui/js/page/discover/view.jsx | 6 +-- 3 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 app/locales/en.json diff --git a/app/locales/en.json b/app/locales/en.json new file mode 100644 index 000000000..96527d026 --- /dev/null +++ b/app/locales/en.json @@ -0,0 +1,78 @@ +{ + "Edit": "Edit", + "Help": "Help", + "Developer": "Developer", + "Reload": "Reload", + "Toggle Developer Tools": "Toggle Developer Tools", + "Inspect Element": "Inspect Element", + "connectionString": "connectionString", + "Method": "Method", + "Parameters": "Parameters", + "Error code": "Error code", + "Error message": "Error message", + "Error data": "Error data", + "Home": "Home", + "Publish": "Publish", + "This LBC remains yours and the deposit can be undone at any time.": "This LBC remains yours and the deposit can be undone at any time.", + "Content": "Content", + "What are you publishing?": "What are you publishing?", + "Access": "Access", + "Select a URL for this publish.": "Select a URL for this publish.", + "How much does this content cost?": "How much does this content cost?", + "Price": "Price", + "Free": "Free", + "Choose price...": "Choose price...", + "US Dollars": "US Dollars", + "LBRY credits": "LBRY credits", + "Public Domain": "Public Domain", + "Creative Commons Attribution 4.0 International": "Creative Commons Attribution 4.0 International", + "Creative Commons Attribution-ShareAlike 4.0 International": "Creative Commons Attribution-ShareAlike 4.0 International", + "Creative Commons Attribution-NoDerivatives 4.0 International": "Creative Commons Attribution-NoDerivatives 4.0 International", + "Creative Commons Attribution-NonCommercial 4.0 International": "Creative Commons Attribution-NonCommercial 4.0 International", + "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International", + "Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International": "Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International", + "Copyrighted...": "Copyrighted...", + "Other...": "Other...", + "Identity": "Identity", + "Who created this content?": "Who created this content?", + "Anonymous": "Anonymous", + "New identity...": "New identity...", + "Address": "Address", + "Where should this content permanently reside?": "Where should this content permanently reside?", + "Read more": "Read more", + "Terms of Service": "Terms of Service", + "Deposit": "Deposit", + "This URL is unused.": "This URL is unused.", + "LBRY names must contain only letters, numbers and dashes.": "LBRY names must contain only letters, numbers and dashes.", + "Title": "Title", + "Thumbnail URL": "Thumbnail URL", + "Description": "Description", + "Description of your content": "Description of your content", + "Language": "Language", + "English": "English", + "Chinese": "Chinese", + "French": "French", + "German": "German", + "Japanese": "Japanese", + "Russian": "Russian", + "Spanish": "Spanish", + "Maturity": "Maturity", + "All Ages": "All Ages", + "Adults Only": "Adults Only", + "Cancel": "Cancel", + "File published": "File published", + "I agree to the": "I agree to the", + "LBRY terms of service": "LBRY terms of service", + "Your file has been published to LBRY at the address": "Your file has been published to LBRY at the address", + "The file will take a few minutes to appear for other LBRY users. Until then it will be listed as \"pending\" under your published files.": "The file will take a few minutes to appear for other LBRY users. Until then it will be listed as \"pending\" under your published files.", + "Error publishing file": "Error publishing file", + "The following error occurred when attempting to publish your file": "The following error occurred when attempting to publish your file", + "A deposit of at least \"%s\" credit is required to win \"%s\". However, you can still get a permanent URL for any amount.": { + "one": "A deposit of at least \"%s\" credit is required to win \"%s\". However, you can still get a permanent URL for any amount.", + "other": "A deposit of at least \"%s\" credits is required to win \"%s\". However, you can still get a permanent URL for any amount." + }, + "Connecting": "Connecting", + "Discover": "Discover", + "Fetching content": "Fetching content", + "What's this?": "What's this?" +} \ No newline at end of file diff --git a/ui/js/main.js b/ui/js/main.js index 04027b6f2..5b81bf23c 100644 --- a/ui/js/main.js +++ b/ui/js/main.js @@ -29,6 +29,10 @@ const {remote, ipcRenderer, shell} = require('electron'); const contextMenu = remote.require('./menu/context-menu'); const app = require('./app') +const i18n = require('y18n')({directory: 'app/locales'}); +window.__ = i18n.__; +window.__n = i18n.__n; + lbry.showMenuIfNeeded(); window.addEventListener('contextmenu', (event) => { @@ -92,7 +96,7 @@ var init = function() { if (window.sessionStorage.getItem('loaded') == 'y') { onDaemonReady(); } else { - ReactDOM.render(, canvas); + ReactDOM.render(, canvas); } }; diff --git a/ui/js/page/discover/view.jsx b/ui/js/page/discover/view.jsx index 91cdfafda..ba1b372e7 100644 --- a/ui/js/page/discover/view.jsx +++ b/ui/js/page/discover/view.jsx @@ -5,7 +5,7 @@ import FileCard from 'component/fileCard'; import {BusyMessage} from 'component/common.js'; import ToolTip from 'component/tooltip.js'; -const communityCategoryToolTipText = ('Community Content is a public space where anyone can share content with the ' + +const communityCategoryToolTipText = __('Community Content is a public space where anyone can share content with the ' + 'rest of the LBRY community. Bid on the names "one," "two," "three," "four" and ' + '"five" to put your content here!'); @@ -17,7 +17,7 @@ const FeaturedCategory = (props) => { return

{category} - {category && category.match(/^community/i) && } + {category && category.match(/^community/i) && }

{names && names.map(name => )}
@@ -55,4 +55,4 @@ class DiscoverPage extends React.Component{ } } -export default DiscoverPage; \ No newline at end of file +export default DiscoverPage; From 59aa56b7efe9ecce84fab0b184813643c5b7dc96 Mon Sep 17 00:00:00 2001 From: Intnick Date: Mon, 22 May 2017 14:29:30 +0200 Subject: [PATCH 016/106] initial merge --- app/locales/en.json | 2 +- ui/js/page/publish/view.jsx | 137 ++++++++++++++++++------------------ 2 files changed, 71 insertions(+), 68 deletions(-) diff --git a/app/locales/en.json b/app/locales/en.json index 96527d026..8c63406bf 100644 --- a/app/locales/en.json +++ b/app/locales/en.json @@ -75,4 +75,4 @@ "Discover": "Discover", "Fetching content": "Fetching content", "What's this?": "What's this?" -} \ No newline at end of file +} diff --git a/ui/js/page/publish/view.jsx b/ui/js/page/publish/view.jsx index 6edb9e371..0e33a4ea6 100644 --- a/ui/js/page/publish/view.jsx +++ b/ui/js/page/publish/view.jsx @@ -179,7 +179,7 @@ class PublishPage extends React.Component { } if (!lbryuri.isValidName(rawName, false)) { - this.refs.name.showError('LBRY names must contain only letters, numbers and dashes.'); + this.refs.name.showError(__("LBRY names must contain only letters, numbers and dashes.")); return; } @@ -266,7 +266,7 @@ class PublishPage extends React.Component { }; if (licenseType == 'copyright') { - newState.copyrightNotice = 'All rights reserved.' + newState.copyrightNotice = __("All rights reserved.") } this.setState(newState); @@ -302,7 +302,7 @@ class PublishPage extends React.Component { const newChannelName = (event.target.value.startsWith('@') ? event.target.value : '@' + event.target.value); if (newChannelName.length > 1 && !lbryuri.isValidName(newChannelName.substr(1), false)) { - this.refs.newChannelName.showError('LBRY channel names must contain only letters, numbers and dashes.'); + this.refs.newChannelName.showError(__("LBRY channel names must contain only letters, numbers and dashes.")); return; } else { this.refs.newChannelName.clearError() @@ -327,7 +327,7 @@ class PublishPage extends React.Component { handleCreateChannelClick(event) { if (this.state.newChannelName.length < 5) { - this.refs.newChannelName.showError('LBRY channel names must be at least 4 characters in length.'); + this.refs.newChannelName.showError(__("LBRY channel names must be at least 4 characters in length.")); return; } @@ -346,7 +346,7 @@ class PublishPage extends React.Component { }, 5000); }, (error) => { // TODO: better error handling - this.refs.newChannelName.showError('Unable to create channel due to an internal error.'); + this.refs.newChannelName.showError(__("Unable to create channel due to an internal error.")); this.setState({ creatingChannel: false, }); @@ -377,14 +377,17 @@ class PublishPage extends React.Component { getNameBidHelpText() { if (!this.state.name) { - return "Select a URL for this publish."; + return __("Select a URL for this publish."); } else if (this.state.nameResolved === false) { - return "This URL is unused."; + return __("This URL is unused."); } else if (this.state.myClaimExists) { - return "You have already used this URL. Publishing to it again will update your previous publish." + return __("You have already used this URL. Publishing to it again will update your previous publish.") } else if (this.state.topClaimValue) { - return A deposit of at least {this.state.topClaimValue} {this.state.topClaimValue == 1 ? 'credit ' : 'credits '} - is required to win {this.state.name}. However, you can still get a permanent URL for any amount. + return {__n("A deposit of at least \"%s\" credit is required to win \"%s\". However, you can still get a permanent URL for any amount." + , "A deposit of at least \"%s\" credits is required to win \"%s\". However, you can still get a permanent URL for any amount." + , this.state.topClaimValue /*pluralization param*/ + , this.state.topClaimValue, this.state.name /*regular params*/ + )} } else { return ''; } @@ -401,49 +404,49 @@ class PublishPage extends React.Component { return null; } - const lbcInputHelp = "This LBC remains yours and the deposit can be undone at any time." + const lbcInputHelp = __("This LBC remains yours and the deposit can be undone at any time."); return (
{ this.handleSubmit(event) }}>
-

Content

+

{__("Content")}

- What are you publishing? + {__("What are you publishing?")}
{ this.onFileChange(event) }} - helper={this.state.myClaimExists ? "If you don't choose a file, the file from your existing claim will be used." : null}/> + helper={this.state.myClaimExists ? __("If you don't choose a file, the file from your existing claim will be used.") : null}/>
{ !this.state.hasFile ? '' :
- +
- +
- +
- - - - - - - - + + + + + + + +
- + {/* */} - - + +
} @@ -451,73 +454,73 @@ class PublishPage extends React.Component {
-

Access

+

{__("Access")}

- How much does this content cost? + {__("How much does this content cost?")}
- +
- { this.handleFeePrefChange(false) } } defaultChecked={!this.state.isFee} /> - { this.handleFeePrefChange(false) } } defaultChecked={!this.state.isFee} /> + { this.handleFeePrefChange(true) } } defaultChecked={this.state.isFee} /> this.handleFeeAmountChange(event)} /> { this.handleFeeCurrencyChange(event) }}> - - + + { this.state.isFee ?
- If you choose to price this content in dollars, the number of credits charged will be adjusted based on the value of LBRY credits at the time of purchase. + {__("If you choose to price this content in dollars, the number of credits charged will be adjusted based on the value of LBRY credits at the time of purchase.")}
: '' } { this.handleLicenseChange(event) }}> - - - - - - - - - + + + + + + + + + {this.state.copyrightChosen - ? { this.handleCopyrightNoticeChange(event) }} /> : null} {this.state.otherLicenseChosen ? - { this.handleOtherLicenseDescriptionChange() }} /> + { this.handleOtherLicenseDescriptionChange() }} /> : null} {this.state.otherLicenseChosen ? - { this.handleOtherLicenseUrlChange(event) }} /> + { this.handleOtherLicenseUrlChange(event) }} /> : null}
-

Identity

+

{__("Identity")}

- Who created this content? + {__("Who created this content?")}
{ this.handleChannelChange(event) }} value={this.state.channel}> - + {this.state.channels.map(({name}) => )} - +
{this.state.channel == 'new' ?
- { this.handleNewChannelNameChange(event) }} ref={newChannelName => { this.refs.newChannelName = newChannelName }} + { this.handleNewChannelNameChange(event) }} ref={newChannelName => { this.refs.newChannelName = newChannelName }} value={this.state.newChannelName} /> - { this.handleNewChannelBidChange(event) }} value={this.state.newChannelBid} />
- { this.handleCreateChannelClick(event) }} disabled={this.state.creatingChannel} /> + { this.handleCreateChannelClick(event) }} disabled={this.state.creatingChannel} />
: null} @@ -534,8 +537,8 @@ class PublishPage extends React.Component {
-

Address

-
Where should this content permanently reside? .
+

{__("Address")}

+
{__("Where should this content permanently reside?")} .
{ this.handleNameChange(event) }} @@ -546,7 +549,7 @@ class PublishPage extends React.Component { { this.handleBidChange(event) }} value={this.state.bid} @@ -557,30 +560,30 @@ class PublishPage extends React.Component {
-

Terms of Service

+

{__("Terms of Service")}

I agree to the + {__("I agree to the")} } type="checkbox" name="tos_agree" ref={(field) => { this.refs.tos_agree = field }} onChange={(event) => { this.handleTOSChange(event)}} />
- { this.handleSubmit(event) }} disabled={this.state.submitting} /> - + { this.handleSubmit(event) }} disabled={this.state.submitting} /> +
- { this.handlePublishStartedConfirmed(event) }}> -

Your file has been published to LBRY at the address lbry://{this.state.name}!

-

The file will take a few minutes to appear for other LBRY users. Until then it will be listed as "pending" under your published files.

+

{__("Your file has been published to LBRY at the address")} lbry://{this.state.name}!

+

{__('The file will take a few minutes to appear for other LBRY users. Until then it will be listed as "pending" under your published files.')}

- { this.closeModal(event) }}> - The following error occurred when attempting to publish your file: {this.state.errorMessage} + {__("The following error occurred when attempting to publish your file")}: {this.state.errorMessage}
); From e8bfd592a646053730bce644ac6b4744cc5f7f80 Mon Sep 17 00:00:00 2001 From: Intnick Date: Mon, 22 May 2017 01:32:00 +0200 Subject: [PATCH 017/106] initial merge --- ui/js/page/start.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/js/page/start.js b/ui/js/page/start.js index 9a2b388b1..c3af27817 100644 --- a/ui/js/page/start.js +++ b/ui/js/page/start.js @@ -9,7 +9,7 @@ class StartPage extends React.Component { render() { return (
-

LBRY is Closed

+

__("LBRY is Closed")

); From 1e311905b8ea4762942ed2ea755a2c10dc71f778 Mon Sep 17 00:00:00 2001 From: Intnick Date: Thu, 25 May 2017 19:31:10 +0200 Subject: [PATCH 018/106] finalization of i18n setup to i18n branch --- app/locales/en.json | 5 +++-- ui/js/page/discover/view.jsx | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/locales/en.json b/app/locales/en.json index 8c63406bf..c725e2624 100644 --- a/app/locales/en.json +++ b/app/locales/en.json @@ -74,5 +74,6 @@ "Connecting": "Connecting", "Discover": "Discover", "Fetching content": "Fetching content", - "What's this?": "What's this?" -} + "What's this?": "What's this?", + "Community Content is a public space where anyone can share content with the rest of the LBRY community. Bid on the names \"one,\" \"two,\" \"three,\" \"four\" and \"five\" to put your content here!": "Community Content is a public space where anyone can share content with the rest of the LBRY community. Bid on the names \"one,\" \"two,\" \"three,\" \"four\" and \"five\" to put your content here!" +} \ No newline at end of file diff --git a/ui/js/page/discover/view.jsx b/ui/js/page/discover/view.jsx index ba1b372e7..10e8309c9 100644 --- a/ui/js/page/discover/view.jsx +++ b/ui/js/page/discover/view.jsx @@ -5,7 +5,7 @@ import FileCard from 'component/fileCard'; import {BusyMessage} from 'component/common.js'; import ToolTip from 'component/tooltip.js'; -const communityCategoryToolTipText = __('Community Content is a public space where anyone can share content with the ' + +const communityCategoryToolTipText = ('Community Content is a public space where anyone can share content with the ' + 'rest of the LBRY community. Bid on the names "one," "two," "three," "four" and ' + '"five" to put your content here!'); @@ -17,7 +17,7 @@ const FeaturedCategory = (props) => { return

{category} - {category && category.match(/^community/i) && } + {category && category.match(/^community/i) && }

{names && names.map(name => )}
From d30d4353e81c2b36a11fc299b0aef4640ed7a80e Mon Sep 17 00:00:00 2001 From: Intnick Date: Fri, 26 May 2017 02:16:25 +0200 Subject: [PATCH 019/106] moved the import of y18n component before some other imports; translations for auth developer --- app/locales/en.json | 70 +++++++++++++++++++- ui/js/component/auth.js | 80 +++++++++++------------ ui/js/component/common.js | 6 +- ui/js/component/downloadingModal/view.jsx | 14 ++-- ui/js/component/errorModal/view.jsx | 18 ++--- ui/js/component/file-selector.js | 6 +- ui/js/component/form.js | 4 +- ui/js/component/modal.js | 13 ++-- ui/js/component/reward-link.js | 8 +-- ui/js/component/splash.js | 8 +-- ui/js/main.js | 12 ++-- ui/js/page/channel/view.jsx | 8 +-- ui/js/page/developer.js | 10 +-- ui/js/page/discover/view.jsx | 4 +- ui/js/page/fileListDownloaded/view.jsx | 4 +- ui/js/page/fileListPublished/view.jsx | 4 +- ui/js/page/filePage/view.jsx | 14 ++-- ui/js/page/start.js | 4 +- ui/js/selectors/app.js | 40 ++++++------ 19 files changed, 200 insertions(+), 127 deletions(-) diff --git a/app/locales/en.json b/app/locales/en.json index c725e2624..7c4e78d5e 100644 --- a/app/locales/en.json +++ b/app/locales/en.json @@ -75,5 +75,73 @@ "Discover": "Discover", "Fetching content": "Fetching content", "What's this?": "What's this?", - "Community Content is a public space where anyone can share content with the rest of the LBRY community. Bid on the names \"one,\" \"two,\" \"three,\" \"four\" and \"five\" to put your content here!": "Community Content is a public space where anyone can share content with the rest of the LBRY community. Bid on the names \"one,\" \"two,\" \"three,\" \"four\" and \"five\" to put your content here!" + "Community Content is a public space where anyone can share content with the rest of the LBRY community. Bid on the names \"one,\" \"two,\" \"three,\" \"four\" and \"five\" to put your content here!": "Community Content is a public space where anyone can share content with the rest of the LBRY community. Bid on the names \"one,\" \"two,\" \"three,\" \"four\" and \"five\" to put your content here!", + "LBRY is Closed": "LBRY is Closed", + "Click here to start LBRY": "Click here to start LBRY", + "Failed to load landing content.": "Failed to load landing content.", + "Settings": "Settings", + "Welcome to LBRY": "Welcome to LBRY", + "Downloads & Purchases": "Downloads & Purchases", + "Downloaded": "Downloaded", + "Published": "Published", + "Publishes": "Publishes", + "Overview": "Overview", + "Send": "Send", + "Receive": "Receive", + "Rewards": "Rewards", + "Search results for %s": "Search results for %s", + "Search": "Search", + "Your email is still not verified.": "Your email is still not verified.", + "Next": "Next", + "Email": "Email", + "Verification Code": "Verification Code", + "A verification code is required to access this version.": "A verification code is required to access this version.", + "Verify": "Verify", + "No code?": "No code?", + "Click here": "Click here", + "Authentication": "Authentication", + "LBRY Early Access": "LBRY Early Access", + "Preparing for first access": "Preparing for first access", + "Welcome to LBRY.": "Welcome to LBRY.", + "Using LBRY is like dating a centaur. Totally normal up top, and way different underneath.": "Using LBRY is like dating a centaur. Totally normal up top, and way different underneath.", + "Up top, LBRY is similar to popular media sites.": "Up top, LBRY is similar to popular media sites.", + "Below, LBRY is controlled by users -- you -- via blockchain and decentralization.": "Below, LBRY is controlled by users -- you -- via blockchain and decentralization.", + "Thank you for making content freedom possible! Here's a nickel, kid.": "Thank you for making content freedom possible! Here's a nickel, kid.", + "Developer Settings": "Developer Settings", + "Show developer menu": "Show developer menu", + "Use custom search servers": "Use custom search servers", + "Custom search servers (one per line)": "Custom search servers (one per line)", + "Force Upgrade": "Force Upgrade", + "OK": "OK", + "Show More...": "Show More...", + "Show Less": "Show Less", + "Starting daemon": "Starting daemon", + "Waiting for name resolution": "Waiting for name resolution", + "Using LBRY is like dating a centaur. Totally normal up top, and way different underneath.": "Using LBRY is like dating a centaur. Totally normal up top, and way different underneath.", + "Claim Reward": "Claim Reward", + "Claiming...": "Claiming...", + "This is an estimate and does not include data fees": "This is an estimate and does not include data fees", + "free": "free", + "Reward Claim Error": "Reward Claim Error", + "This field is required": "This field is required", + "Choose File": "Choose File", + "No File Chosen": "No File Chosen", + "Choose Directory": "Choose Directory", + "Downloading Update": "Downloading Update", + "Click \"Begin Upgrade\" to start the upgrade process.": "Click \"Begin Upgrade\" to start the upgrade process.", + "The app will close, and you will be prompted to install the latest version of LBRY.": "The app will close, and you will be prompted to install the latest version of LBRY.", + "After the install is complete, please reopen the app.": "After the install is complete, please reopen the app.", + "Begin Upgrade": "Begin Upgrade", + "API connection string": "API connection string", + "We're sorry that LBRY has encountered an error. This has been reported and we will investigate the problem.": "We're sorry that LBRY has encountered an error. This has been reported and we will investigate the problem.", + "You haven't downloaded anything from LBRY yet. Go": "You haven't downloaded anything from LBRY yet. Go", + "search for your first download": "search for your first download", + "Loading": "Loading", + " credits": " credits", + "It looks like you haven't published anything to LBRY yet. Go": "It looks like you haven't published anything to LBRY yet. Go", + "share your beautiful cats with the world": "share your beautiful cats with the world", + "report": "report", + "Content-Type": "Content-Type", + "Author": "Author", + "License": "License" } \ No newline at end of file diff --git a/ui/js/component/auth.js b/ui/js/component/auth.js index df9262672..afe6b8066 100644 --- a/ui/js/component/auth.js +++ b/ui/js/component/auth.js @@ -55,11 +55,11 @@ class SubmitEmailStage extends React.Component { return (
{ this.handleSubmit(event) }}> - { this._emailRow = ref }} type="text" label="Email" placeholder="scrwvwls@lbry.io" + { this._emailRow = ref }} type="text" label={__("Email")} placeholder="scrwvwls@lbry.io" name="email" value={this.state.email} onChange={(event) => { this.handleEmailChanged(event) }} />
- { this.handleSubmit(event) }} /> + { this.handleSubmit(event) }} />
@@ -102,7 +102,7 @@ class ConfirmEmailStage extends React.Component { if (userEmail.is_verified) { this.props.setStage("welcome") } else { - onSubmitError(new Error("Your email is still not verified.")) //shouldn't happen? + onSubmitError(new Error(__("Your email is still not verified."))) //shouldn't happen? } }, onSubmitError); } @@ -111,14 +111,14 @@ class ConfirmEmailStage extends React.Component { return (
{ this.handleSubmit(event) }}> - { this._codeRow = ref }} type="text" + { this._codeRow = ref }} type="text" name="code" placeholder="a94bXXXXXXXXXXXXXX" value={this.state.code} onChange={(event) => { this.handleCodeChanged(event) }} - helper="A verification code is required to access this version."/> + helper={__("A verification code is required to access this version.")}/>
- { this.handleSubmit(event)}} /> + { this.handleSubmit(event)}} />
- No code? { this.props.setStage("nocode")}} label="Click here" />. + {__("No code?")} { this.props.setStage("nocode")}} label={__("Click here")} />.
@@ -150,26 +150,26 @@ class WelcomeStage extends React.Component { render() { return ( !this.state.hasReward ? - +
-

Welcome to LBRY.

-

Using LBRY is like dating a centaur. Totally normal up top, and way different underneath.

-

Up top, LBRY is similar to popular media sites.

-

Below, LBRY is controlled by users -- you -- via blockchain and decentralization.

-

Thank you for making content freedom possible! Here's a nickel, kid.

+

{__("Welcome to LBRY.")}

+

{__("Using LBRY is like dating a centaur. Totally normal up top, and way different underneath.")}

+

{__("Up top, LBRY is similar to popular media sites.")}

+

{__("Below, LBRY is controlled by users -- you -- via blockchain and decentralization.")}

+

{__("Thank you for making content freedom possible! Here's a nickel, kid.")}

{ this.onRewardClaim(event) }} onRewardFailure={() => this.props.setStage(null)} onConfirmed={() => { this.props.setStage(null) }} />
: - { this.props.setStage(null) }}> + { this.props.setStage(null) }}>
-

About Your Reward

-

You earned a reward of LBRY credits, or LBC.

-

This reward will show in your Wallet momentarily, probably while you are reading this message.

-

LBC is used to compensate creators, to publish, and to have say in how the network works.

-

No need to understand it all just yet! Try watching or downloading something next.

-

Finally, know that LBRY is an early beta and that it earns the name.

+

{__("About Your Reward")}

+

{__("You earned a reward of ")} {__("LBRY credits, or \"LBC\".")}

+

{__("This reward will show in your Wallet momentarily, probably while you are reading this message.")}

+

{__("LBC is used to compensate creators, to publish, and to have say in how the network works.")}

+

{__("No need to understand it all just yet! Try watching or downloading something next.")}

+

{__("Finally, know that LBRY is an early beta and that it earns the name.")}

); @@ -178,16 +178,16 @@ class WelcomeStage extends React.Component { const ErrorStage = (props) => { return
-

An error was encountered that we cannot continue from.

-

At least we're earning the name beta.

- { props.errorText ?

Message: {props.errorText}

: '' } - { window.location.reload() } } /> +

{__("An error was encountered that we cannot continue from.")}

+

{__("At least we're earning the name beta.")}

+ { props.errorText ?

{__("Message:")} {props.errorText}

: '' } + { window.location.reload() } } />
} const PendingStage = (props) => { return
-

Preparing for first access

+

{__("Preparing for first access")}

} @@ -230,20 +230,20 @@ class CodeRequiredStage extends React.Component { return (
-

Access to LBRY is restricted as we build and scale the network.

-

There are two ways in:

-

Own LBRY Credits

-

If you own at least 1 LBC, you can get in right now.

+

{__("Access to LBRY is restricted as we build and scale the network.")}

+

{__("There are two ways in:")}

+

{__("Own LBRY Credits")}

+

{__("If you own at least 1 LBC, you can get in right now.")}

{ setLocal('auth_bypassed', true); this.props.setStage(null); }} - disabled={disabled} label="Let Me In" button={ disabled ? "alt" : "primary" } />

-

Your balance is . To increase your balance, send credits to this address:

-

-

If you don't understand how to send credits, then...

+ disabled={disabled} label={__("Let Me In")} button={ disabled ? "alt" : "primary" } />

+

{__("Your balance is ")}. {__("To increase your balance, send credits to this address:")}

+

+

{__("If you don't understand how to send credits, then...")}

-

Wait For A Code

-

If you provide your email, you'll automatically receive a notification when the system is open.

-

{ this.props.setStage("email"); }} label="Return" />

+

{__("Wait For A Code")}

+

{__("If you provide your email, you'll automatically receive a notification when the system is open.")}

+

{ this.props.setStage("email"); }} label={__("Return")} />

); @@ -312,16 +312,16 @@ export class AuthOverlay extends React.Component { const StageContent = this._stages[this.state.stage]; if (!StageContent) { - return Unknown authentication step. + return {__("Unknown authentication step.")} } return ( this.state.stage != "welcome" ? - -

LBRY Early Access

+ +

{__("LBRY Early Access")}

{ this.setStage(stage, stageProps) }} />
: { this.setStage(stage, stageProps) }} {...this.state.stageProps} /> ); } -} \ No newline at end of file +} diff --git a/ui/js/component/common.js b/ui/js/component/common.js index c11e0d14c..d864a1c48 100644 --- a/ui/js/component/common.js +++ b/ui/js/component/common.js @@ -68,9 +68,9 @@ export class CreditAmount extends React.Component { const formattedAmount = lbry.formatCredits(this.props.amount, this.props.precision); let amountText; if (this.props.showFree && parseFloat(formattedAmount) == 0) { - amountText = 'free'; + amountText = __('free'); } else if (this.props.label) { - amountText = formattedAmount + (parseFloat(formattedAmount) == 1 ? ' credit' : ' credits'); + amountText = formattedAmount + (parseFloat(formattedAmount) == 1 ? __(' credit') : __(' credits')); } else { amountText = formattedAmount; } @@ -80,7 +80,7 @@ export class CreditAmount extends React.Component { {amountText} - { this.props.isEstimate ? * : null } + { this.props.isEstimate ? * : null } ); } diff --git a/ui/js/component/downloadingModal/view.jsx b/ui/js/component/downloadingModal/view.jsx index dc76fdd4b..053668437 100644 --- a/ui/js/component/downloadingModal/view.jsx +++ b/ui/js/component/downloadingModal/view.jsx @@ -15,22 +15,22 @@ class DownloadingModal extends React.Component { } = this.props return ( - - Downloading Update{downloadProgress ? `: ${downloadProgress}%` : null} + + {__("Downloading Update")}{downloadProgress ? `: ${downloadProgress}%` : null} {downloadComplete ? (

-

Click "Begin Upgrade" to start the upgrade process.

-

The app will close, and you will be prompted to install the latest version of LBRY.

-

After the install is complete, please reopen the app.

+

{__("Click \"Begin Upgrade\" to start the upgrade process.")}

+

{__("The app will close, and you will be prompted to install the latest version of LBRY.")}

+

{__("After the install is complete, please reopen the app.")}

) : null }
{downloadComplete - ? + ? : null} - +
) diff --git a/ui/js/component/errorModal/view.jsx b/ui/js/component/errorModal/view.jsx index c494c9cb1..a5cbcd8c7 100644 --- a/ui/js/component/errorModal/view.jsx +++ b/ui/js/component/errorModal/view.jsx @@ -15,12 +15,12 @@ class ErrorModal extends React.Component { const errorObj = typeof error === "string" ? { error: error } : error const error_key_labels = { - connectionString: 'API connection string', - method: 'Method', - params: 'Parameters', - code: 'Error code', - message: 'Error message', - data: 'Error data', + connectionString: __('API connection string'), + method: __('Method'), + params: __('Parameters'), + code: __('Error code'), + message: __('Error message'), + data: __('Error data'), } @@ -35,16 +35,16 @@ class ErrorModal extends React.Component { return( -

Error

+

{__("Error")}

-

We're sorry that LBRY has encountered an error. This has been reported and we will investigate the problem.

+

{__("We're sorry that LBRY has encountered an error. This has been reported and we will investigate the problem.")}

) diff --git a/ui/js/component/file-selector.js b/ui/js/component/file-selector.js index 4670f4830..786d82caf 100644 --- a/ui/js/component/file-selector.js +++ b/ui/js/component/file-selector.js @@ -41,14 +41,14 @@ class FileSelector extends React.Component {
{' '} {this.state.path ? this.state.path : - 'No File Chosen'} + __('No File Chosen')}
); diff --git a/ui/js/component/form.js b/ui/js/component/form.js index 416011df3..809ebe534 100644 --- a/ui/js/component/form.js +++ b/ui/js/component/form.js @@ -21,7 +21,7 @@ export class FormField extends React.Component { constructor(props) { super(props); - this._fieldRequiredText = 'This field is required'; + this._fieldRequiredText = __('This field is required'); this._type = null; this._element = null; @@ -136,7 +136,7 @@ export class FormRow extends React.Component { constructor(props) { super(props); - this._fieldRequiredText = 'This field is required'; + this._fieldRequiredText = __('This field is required'); this.state = { isError: false, diff --git a/ui/js/component/modal.js b/ui/js/component/modal.js index bd3c1eb3c..89598e9e8 100644 --- a/ui/js/component/modal.js +++ b/ui/js/component/modal.js @@ -2,6 +2,9 @@ import React from 'react'; import ReactModal from 'react-modal'; import Link from 'component/link'; +const i18n = require('y18n')({directory: 'app/locales'}); + + export class Modal extends React.Component { static propTypes = { @@ -18,8 +21,8 @@ export class Modal extends React.Component { static defaultProps = { type: 'alert', overlay: true, - confirmButtonLabel: 'OK', - abortButtonLabel: 'Cancel', + confirmButtonLabel: i18n.__('OK'), + abortButtonLabel: i18n.__('Cancel'), confirmButtonDisabled: false, abortButtonDisabled: false, } @@ -52,9 +55,9 @@ export class ExpandableModal extends React.Component { } static defaultProps = { - confirmButtonLabel: 'OK', - expandButtonLabel: 'Show More...', - hideButtonLabel: 'Show Less', + confirmButtonLabel: i18n.__('OK'), + expandButtonLabel: i18n.__('Show More...'), + hideButtonLabel: i18n.__('Show Less'), } constructor(props) { diff --git a/ui/js/component/reward-link.js b/ui/js/component/reward-link.js index 31bd90e28..bb2c169cf 100644 --- a/ui/js/component/reward-link.js +++ b/ui/js/component/reward-link.js @@ -77,15 +77,15 @@ export class RewardLink extends React.Component { return (
{this.props.claimed - ? Reward claimed. + ? {__("Reward claimed.")} : { this.claimReward() }} />} + label={ this.state.pending ? __("Claiming...") : __("Claim Reward")} onClick={() => { this.claimReward() }} />} {this.state.errorMessage ? - { this.clearError() }}> + { this.clearError() }}> {this.state.errorMessage} : ''}
); } -} \ No newline at end of file +} diff --git a/ui/js/component/splash.js b/ui/js/component/splash.js index e2be56b67..d5433398a 100644 --- a/ui/js/component/splash.js +++ b/ui/js/component/splash.js @@ -12,7 +12,7 @@ export class SplashScreen extends React.Component { super(props); this.state = { - details: 'Starting daemon', + details: __('Starting daemon'), isLagging: false, }; } @@ -29,7 +29,7 @@ export class SplashScreen extends React.Component { // TODO: This is a hack, and the logic should live in the daemon // to give us a better sense of when we are actually started this.setState({ - details: 'Waiting for name resolution', + details: __('Waiting for name resolution'), isLagging: false }); @@ -54,8 +54,8 @@ export class SplashScreen extends React.Component { } else { this.setState({ isLagging: true, - message: "Failed to connect to LBRY", - details: "LBRY was unable to start and connect properly." + message: __("Failed to connect to LBRY"), + details: __("LBRY was unable to start and connect properly.") }) } }) diff --git a/ui/js/main.js b/ui/js/main.js index 5b81bf23c..222e71890 100644 --- a/ui/js/main.js +++ b/ui/js/main.js @@ -2,14 +2,19 @@ import React from 'react'; import ReactDOM from 'react-dom'; import lbry from './lbry.js'; import lbryio from './lbryio.js'; + +const i18n = require('y18n')({directory: 'app/locales'}); +window.__ = i18n.__; +window.__n = i18n.__n; + import lighthouse from './lighthouse.js'; import App from 'component/app/index.js'; -import SplashScreen from 'component/splash.js'; import SnackBar from 'component/snackBar'; -import {AuthOverlay} from 'component/auth.js'; import { Provider } from 'react-redux'; import batchActions from 'util/batchActions' import store from 'store.js'; +import SplashScreen from 'component/splash.js'; +import {AuthOverlay} from 'component/auth.js'; import { doChangePath, doNavigate, @@ -29,9 +34,6 @@ const {remote, ipcRenderer, shell} = require('electron'); const contextMenu = remote.require('./menu/context-menu'); const app = require('./app') -const i18n = require('y18n')({directory: 'app/locales'}); -window.__ = i18n.__; -window.__n = i18n.__n; lbry.showMenuIfNeeded(); diff --git a/ui/js/page/channel/view.jsx b/ui/js/page/channel/view.jsx index 05b447c60..eb09ea4d5 100644 --- a/ui/js/page/channel/view.jsx +++ b/ui/js/page/channel/view.jsx @@ -27,11 +27,11 @@ class ChannelPage extends React.Component{ let contentList if (claimsInChannel === undefined) { - contentList = + contentList = } else if (claimsInChannel) { contentList = claimsInChannel.length ? claimsInChannel.map((claim) => ) : - No content found. + {__("No content found.")} } return
@@ -41,11 +41,11 @@ class ChannelPage extends React.Component{

- This channel page is a stub. + {__("This channel page is a stub.")}

-

Published Content

+

{__("Published Content")}

{contentList} } diff --git a/ui/js/page/developer.js b/ui/js/page/developer.js index 9e7175fd3..4ac1a133b 100644 --- a/ui/js/page/developer.js +++ b/ui/js/page/developer.js @@ -63,17 +63,17 @@ class DeveloperPage extends React.Component { return (
-

Developer Settings

+

{__("Developer Settings")}

- +
- +
{this.state.useCustomLighthouseServers ?
@@ -83,7 +83,7 @@ class DeveloperPage extends React.Component {
{ this.handleUpgradeFileChange() }}/>   - { this.handleForceUpgradeClick() }} /> + { this.handleForceUpgradeClick() }} />
diff --git a/ui/js/page/discover/view.jsx b/ui/js/page/discover/view.jsx index 10e8309c9..fff8663b8 100644 --- a/ui/js/page/discover/view.jsx +++ b/ui/js/page/discover/view.jsx @@ -38,7 +38,7 @@ class DiscoverPage extends React.Component{
{ fetchingFeaturedUris && - + } { typeof featuredUris === "object" && @@ -48,7 +48,7 @@ class DiscoverPage extends React.Component{ } { typeof featuredUris !== undefined && -
Failed to load landing content.
+
{__("Failed to load landing content.")}
}
) diff --git a/ui/js/page/fileListDownloaded/view.jsx b/ui/js/page/fileListDownloaded/view.jsx index 670b27191..df763195b 100644 --- a/ui/js/page/fileListDownloaded/view.jsx +++ b/ui/js/page/fileListDownloaded/view.jsx @@ -27,9 +27,9 @@ class FileListDownloaded extends React.Component { content = } else { if (isPending) { - content = + content = } else { - content = You haven't downloaded anything from LBRY yet. Go navigate('/discover')} label="search for your first download" />! + content = {__("You haven't downloaded anything from LBRY yet. Go")} navigate('/discover')} label={__("search for your first download")} />! } } diff --git a/ui/js/page/fileListPublished/view.jsx b/ui/js/page/fileListPublished/view.jsx index 1fe0ac592..bf1374a45 100644 --- a/ui/js/page/fileListPublished/view.jsx +++ b/ui/js/page/fileListPublished/view.jsx @@ -49,9 +49,9 @@ class FileListPublished extends React.Component { content = } else { if (isPending) { - content = + content = } else { - content = It looks like you haven't published anything to LBRY yet. Go navigate('/publish')} label="share your beautiful cats with the world" />! + content = {__("It looks like you haven't published anything to LBRY yet. Go")} navigate('/publish')} label={__("share your beautiful cats with the world")} />! } } diff --git a/ui/js/page/filePage/view.jsx b/ui/js/page/filePage/view.jsx index e7a1e2068..87c96c0cd 100644 --- a/ui/js/page/filePage/view.jsx +++ b/ui/js/page/filePage/view.jsx @@ -26,16 +26,16 @@ const FormatItem = (props) => {
- + - + - + - +
Content-Type{mediaType}{__("Content-Type")}{mediaType}
Author{author}{__("Author")}{author}
Language{language}{__("Language")}{language}
License{license}{__("License")}{license}
@@ -75,7 +75,7 @@ class FilePage extends React.Component{ } = this.props if (!claim || !metadata) { - return Empty claim or metadata info. + return {__("Empty claim or metadata info.")} } const { @@ -124,7 +124,7 @@ class FilePage extends React.Component{
: '' }
- +
@@ -132,4 +132,4 @@ class FilePage extends React.Component{ } } -export default FilePage; \ No newline at end of file +export default FilePage; diff --git a/ui/js/page/start.js b/ui/js/page/start.js index c3af27817..3caf500a5 100644 --- a/ui/js/page/start.js +++ b/ui/js/page/start.js @@ -9,8 +9,8 @@ class StartPage extends React.Component { render() { return (
-

__("LBRY is Closed")

- +

{__("LBRY is Closed")}

+
); } diff --git a/ui/js/selectors/app.js b/ui/js/selectors/app.js index 25ed2403c..9509f8f7a 100644 --- a/ui/js/selectors/app.js +++ b/ui/js/selectors/app.js @@ -39,13 +39,13 @@ export const selectPageTitle = createSelector( (page, params) => { switch (page) { case 'search': - return params.query ? `Search results for ${params.query}` : 'Search' + return params.query ? __("Search results for %s", params.query) : __('Search') case 'settings': - return 'Settings' + return __('Settings') case 'help': - return 'Help' + return __('Help') case 'report': - return 'Report' + return __('Report') case 'wallet': case 'send': case 'receive': @@ -54,19 +54,19 @@ export const selectPageTitle = createSelector( case 'show': return lbryuri.normalize(params.uri) case 'downloaded': - return 'Downloads & Purchases' + return __('Downloads & Purchases') case 'published': - return 'Publishes' + return __('Publishes') case 'start': - return 'Start' + return __('Start') case 'publish': - return 'Publish' + return __('Publish') case 'help': - return 'Help' + return __('Help') case 'developer': - return 'Developer' + return __('Developer') case 'discover': - return 'Home' + return __('Home') default: return ''; } @@ -142,22 +142,22 @@ export const selectHeaderLinks = createSelector( case 'receive': case 'rewards': return { - 'wallet': 'Overview', - 'send': 'Send', - 'receive': 'Receive', - 'rewards': 'Rewards', + 'wallet': __('Overview'), + 'send': __('Send'), + 'receive': __('Receive'), + 'rewards': __('Rewards'), }; case 'downloaded': case 'published': return { - 'downloaded': 'Downloaded', - 'published': 'Published', + 'downloaded': __('Downloaded'), + 'published': __('Published'), }; case 'settings': case 'help': return { - 'settings': 'Settings', - 'help': 'Help', + 'settings': __('Settings'), + 'help': __('Help'), } default: return null; @@ -203,4 +203,4 @@ export const selectSnackBar = createSelector( export const selectSnackBarSnacks = createSelector( selectSnackBar, (snackBar) => snackBar.snacks || [] -) \ No newline at end of file +) From c7d7a532ac09a6c830e4212c7354a88c548fdd9a Mon Sep 17 00:00:00 2001 From: Intnick Date: Fri, 26 May 2017 02:27:05 +0200 Subject: [PATCH 020/106] help page trans --- app/locales/en.json | 25 +++++++++++++++++++-- ui/js/page/help/view.jsx | 48 +++++++++++++++++++++------------------- 2 files changed, 48 insertions(+), 25 deletions(-) diff --git a/app/locales/en.json b/app/locales/en.json index 7c4e78d5e..de026931c 100644 --- a/app/locales/en.json +++ b/app/locales/en.json @@ -143,5 +143,26 @@ "report": "report", "Content-Type": "Content-Type", "Author": "Author", - "License": "License" -} \ No newline at end of file + "License": "License", + "Read the FAQ": "Read the FAQ", + "Our FAQ answers many common questions.": "Our FAQ answers many common questions.", + "Get Live Help": "Get Live Help", + "Live help is available most hours in the": "Live help is available most hours in the", + "channel of our Slack chat room.": "channel of our Slack chat room.", + "Join Our Slack": "Join Our Slack", + "Report a Bug": "Report a Bug", + "Did you find something wrong?": "Did you find something wrong?", + "Submit a Bug Report": "Submit a Bug Report", + "Thanks! LBRY is made by its users.": "Thanks! LBRY is made by its users.", + "Report": "Report", + "About": "About", + "A newer version of LBRY is available.": "A newer version of LBRY is available.", + "Download LBRY %s now!": "Download LBRY %s now!", + "Your copy of LBRY is up to date.": "Your copy of LBRY is up to date.", + "daemon (lbrynet)": "daemon (lbrynet)", + "wallet (lbryum)": "wallet (lbryum)", + "interface": "interface", + "Platform": "Platform", + "Installation ID": "Installation ID", + "Looking up version info": "Looking up version info" +} diff --git a/ui/js/page/help/view.jsx b/ui/js/page/help/view.jsx index 3f67c2d70..13b3e0342 100644 --- a/ui/js/page/help/view.jsx +++ b/ui/js/page/help/view.jsx @@ -65,70 +65,72 @@ class HelpPage extends React.Component {
-

Read the FAQ

+

{__("Read the FAQ")}

-

Our FAQ answers many common questions.

-

+

{__("Our FAQ answers many common questions.")}

+

-

Get Live Help

+

{__("Get Live Help")}

- Live help is available most hours in the #help channel of our Slack chat room. + {__("Live help is available most hours in the")} #help {__("channel of our Slack chat room.")}

- +

-

Report a Bug

+

{__("Report a Bug")}

-

Did you find something wrong?

-

navigate('report')} label="Submit a Bug Report" icon="icon-bug" button="alt" />

-
Thanks! LBRY is made by its users.
+

{__("Did you find something wrong?")}

+

navigate('report')} label={__("Submit a Bug Report")} icon="icon-bug" button="alt" />

+
{__("Thanks! LBRY is made by its users.")}
-
-

About

-
+ {!ver ? null : +
+

{__("About")}

+
{this.state.appVersionInfo ? - (ver.lbrynet_update_available || ver.lbryum_update_available ? -

A newer version of LBRY is available.

- :

Your copy of LBRY is up to date.

) : null} - { ver ? + (ver.lbrynet_update_available || ver.lbryum_update_available ? +

{__("A newer version of LBRY is available.")}

+ :

{__("Your copy of LBRY is up to date.")}

) : null} + { ver ? - + - + - + - + - +
daemon (lbrynet){__("daemon (lbrynet)")} {ver.lbrynet_version}
wallet (lbryum){__("wallet (lbryum)")} {ver.lbryum_version}
interface{__("interface")} {uiVersion}
Platform{__("Platform")} {platform}
Installation ID{__("Installation ID")} {this.state.lbryId}
: - + }
+ } ); } From 3ba79fff32c1d88a75b67d9ec07c891084c72086 Mon Sep 17 00:00:00 2001 From: Intnick Date: Fri, 26 May 2017 02:38:55 +0200 Subject: [PATCH 021/106] search page translated --- app/locales/en.json | 6 +++++- ui/js/page/search/view.jsx | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/locales/en.json b/app/locales/en.json index de026931c..feaa18531 100644 --- a/app/locales/en.json +++ b/app/locales/en.json @@ -164,5 +164,9 @@ "interface": "interface", "Platform": "Platform", "Installation ID": "Installation ID", + "Search Results for": "Search Results for", + "These search results are provided by LBRY, Inc.": "These search results are provided by LBRY, Inc.", + "Exact URL": "Exact URL", + "This is the resolution of a LBRY URL and not controlled by LBRY Inc.": "This is the resolution of a LBRY URL and not controlled by LBRY Inc.", "Looking up version info": "Looking up version info" -} +} \ No newline at end of file diff --git a/ui/js/page/search/view.jsx b/ui/js/page/search/view.jsx index 8328434fc..5b28f7b2c 100644 --- a/ui/js/page/search/view.jsx +++ b/ui/js/page/search/view.jsx @@ -17,14 +17,14 @@ class SearchPage extends React.Component{ { lbryuri.isValid(query) ?

- Exact URL

: '' }

- Search Results for {query}

From 0cf1da36ea4008274940882a29198942b05575c9 Mon Sep 17 00:00:00 2001 From: Intnick Date: Fri, 26 May 2017 08:40:35 +0200 Subject: [PATCH 022/106] page settings, show, wallet, report translated --- app/locales/en.json | 25 +++++++++++++++++++++++++ ui/js/page/report.js | 16 ++++++++-------- ui/js/page/settings/view.jsx | 32 ++++++++++++++++---------------- ui/js/page/showPage/view.jsx | 6 +++--- ui/js/page/wallet/view.jsx | 2 +- 5 files changed, 53 insertions(+), 28 deletions(-) diff --git a/app/locales/en.json b/app/locales/en.json index feaa18531..c8629384a 100644 --- a/app/locales/en.json +++ b/app/locales/en.json @@ -168,5 +168,30 @@ "These search results are provided by LBRY, Inc.": "These search results are provided by LBRY, Inc.", "Exact URL": "Exact URL", "This is the resolution of a LBRY URL and not controlled by LBRY Inc.": "This is the resolution of a LBRY URL and not controlled by LBRY Inc.", + "Download Directory": "Download Directory", + "LBRY downloads will be saved here.": "LBRY downloads will be saved here.", + "Bandwidth Limits": "Bandwidth Limits", + "Max Upload": "Max Upload", + "Unlimited": "Unlimited", + "Up to": "Up to", + "Max Download": "Max Download", + "Show unavailable content in search results": "Show unavailable content in search results", + "Show NSFW content": "Show NSFW content", + "NSFW content may include nudity, intense sexuality, profanity, or other adult content. By displaying NSFW content, you are affirming you are of legal age to view mature content in your country or jurisdiction. ": "NSFW content may include nudity, intense sexuality, profanity, or other adult content. By displaying NSFW content, you are affirming you are of legal age to view mature content in your country or jurisdiction. ", + "Share Diagnostic Data": "Share Diagnostic Data", + "Help make LBRY better by contributing diagnostic data about my usage": "Help make LBRY better by contributing diagnostic data about my usage", + "Choose limit...": "Choose limit...", + "Loading magic decentralized data...": "Loading magic decentralized data...", + "There's nothing at this location.": "There's nothing at this location.", + "Report an Issue": "Report an Issue", + "Please describe the problem you experienced and any information you think might be useful to us. Links to screenshots are great!": "Please describe the problem you experienced and any information you think might be useful to us. Links to screenshots are great!", + "Description of your issue": "Description of your issue", + "Submit Report": "Submit Report", + "Developer?": "Developer?", + "You can also": "You can also", + "submit an issue on GitHub": "submit an issue on GitHub", + "Bug report submitted": "Bug report submitted", + "Your bug report has been submitted! Thank you for your feedback.": "Your bug report has been submitted! Thank you for your feedback.", + "Balance": "Balance", "Looking up version info": "Looking up version info" } \ No newline at end of file diff --git a/ui/js/page/report.js b/ui/js/page/report.js index 811adbb04..8d6b259ab 100644 --- a/ui/js/page/report.js +++ b/ui/js/page/report.js @@ -40,25 +40,25 @@ class ReportPage extends React.Component {
-

Report an Issue

-

Please describe the problem you experienced and any information you think might be useful to us. Links to screenshots are great!

+

{__("Report an Issue")}

+

{__("Please describe the problem you experienced and any information you think might be useful to us. Links to screenshots are great!")}

- this._messageArea = t} rows="10" name="message" placeholder="Description of your issue" /> + this._messageArea = t} rows="10" name="message" placeholder={__("Description of your issue")} />
- +
-

Developer?

- You can also . +

{__("Developer?")}

+ {__("You can also")} .
- { this.closeModal(event) }}> - Your bug report has been submitted! Thank you for your feedback. + {__("Your bug report has been submitted! Thank you for your feedback.")}
); diff --git a/ui/js/page/settings/view.jsx b/ui/js/page/settings/view.jsx index d1a4f188c..ea70629ee 100644 --- a/ui/js/page/settings/view.jsx +++ b/ui/js/page/settings/view.jsx @@ -78,7 +78,7 @@ class SettingsPage extends React.Component { } = this.props if (!daemonSettings) { - return
Failed to load settings.
; + return
{__("Failed to load settings.")}
; } /*
@@ -98,33 +98,33 @@ class SettingsPage extends React.Component {
-

Download Directory

+

{__("Download Directory")}

-

Bandwidth Limits

+

{__("Bandwidth Limits")}

-
Max Upload
+
{__("Max Upload")}
{ this.onMaxUploadPrefChange(false) }} defaultChecked={!this.state.isMaxUpload} - label="Unlimited" /> + label={__("Unlimited")} />
{ this.onMaxUploadPrefChange(true) }} defaultChecked={this.state.isMaxUpload} - label={ this.state.isMaxUpload ? 'Up to' : 'Choose limit...' } /> + label={ this.state.isMaxUpload ? __("Up to") : __("Choose limit...") } /> { this.state.isMaxUpload ?
-
Max Download
-
{__("Max Download")}
+ { this.onMaxDownloadPrefChange(false) }} @@ -152,7 +152,7 @@ class SettingsPage extends React.Component { name="max_download_pref" onChange={() => { this.onMaxDownloadPrefChange(true) }} defaultChecked={this.state.isMaxDownload} - label={ this.state.isMaxDownload ? 'Up to' : 'Choose limit...' } /> + label={ this.state.isMaxDownload ? __("Up to") : __("Choose limit...") } /> { this.state.isMaxDownload ?
-

Content

+

{__("Content")}

+ label={__("Show unavailable content in search results")} />
- + helper={__("NSFW content may include nudity, intense sexuality, profanity, or other adult content. By displaying NSFW content, you are affirming you are of legal age to view mature content in your country or jurisdiction. ")} />
-

Share Diagnostic Data

+

{__("Share Diagnostic Data")}

+ label={__("Help make LBRY better by contributing diagnostic data about my usage")} />
diff --git a/ui/js/page/showPage/view.jsx b/ui/js/page/showPage/view.jsx index bab2d4426..633259bea 100644 --- a/ui/js/page/showPage/view.jsx +++ b/ui/js/page/showPage/view.jsx @@ -43,8 +43,8 @@ class ShowPage extends React.Component{

{uri}

- { isResolvingUri && } - { claim === null && There's nothing at this location. } + { isResolvingUri && } + { claim === null && {__("There's nothing at this location.")} }
} @@ -61,4 +61,4 @@ class ShowPage extends React.Component{ } } -export default ShowPage \ No newline at end of file +export default ShowPage diff --git a/ui/js/page/wallet/view.jsx b/ui/js/page/wallet/view.jsx index 4093d003f..a577aa19d 100644 --- a/ui/js/page/wallet/view.jsx +++ b/ui/js/page/wallet/view.jsx @@ -19,7 +19,7 @@ const WalletPage = (props) => {
-

Balance

+

{__("Balance")}

From ff02e0452b77796a1663be2ba0b3ddbc55b197bc Mon Sep 17 00:00:00 2001 From: Intnick Date: Fri, 26 May 2017 09:02:37 +0200 Subject: [PATCH 023/106] filaActions and fileCard components translated --- app/locales/en.json | 28 ++++++++++++++++++- ui/js/component/fileActions/view.jsx | 40 ++++++++++++++-------------- ui/js/component/fileCard/view.jsx | 7 +++-- 3 files changed, 50 insertions(+), 25 deletions(-) diff --git a/app/locales/en.json b/app/locales/en.json index c8629384a..7ffeee538 100644 --- a/app/locales/en.json +++ b/app/locales/en.json @@ -193,5 +193,31 @@ "Bug report submitted": "Bug report submitted", "Your bug report has been submitted! Thank you for your feedback.": "Your bug report has been submitted! Thank you for your feedback.", "Balance": "Balance", + "Open in Folder": "Open in Folder", + "Checking availability": "Checking availability", + "Confirm Purchase": "Confirm Purchase", + "This will purchase": "This will purchase", + "for": "for", + "credits": "credits", + "Not enough credits": "Not enough credits", + "You don't have enough LBRY credits to pay for this stream.": "You don't have enough LBRY credits to pay for this stream.", + "Download failed": "Download failed", + "LBRY was unable to download the stream": "LBRY was unable to download the stream", + "Remove": "Remove", + "Are you sure you'd like to remove": "Are you sure you'd like to remove", + "from LBRY?": "from LBRY?", + "Delete this file from my computer": "Delete this file from my computer", + "Download": "Download", + "Content unavailable.": "Content unavailable.", + "Why?": "Why?", + "The content on LBRY is hosted by its users. It appears there are no users connected that have this file at the moment.": "The content on LBRY is hosted by its users. It appears there are no users connected that have this file at the moment.", + "Try Anyway": "Try Anyway", + "Open": "Open", + "Remove...": "Remove...", + "% complete": "% complete", + "Loading...": "Loading...", + "Empty claim or metadata info.": "Empty claim or metadata info.", + "This content is Not Safe For Work. To view adult content, please change your": "This content is Not Safe For Work. To view adult content, please change your", + "This address contains no content.": "This address contains no content.", "Looking up version info": "Looking up version info" -} \ No newline at end of file +} diff --git a/ui/js/component/fileActions/view.jsx b/ui/js/component/fileActions/view.jsx index 4924d059d..f72893df1 100644 --- a/ui/js/component/fileActions/view.jsx +++ b/ui/js/component/fileActions/view.jsx @@ -66,7 +66,7 @@ class FileActions extends React.Component { const deleteChecked = this.state.deleteChecked, metadata = fileInfo ? fileInfo.metadata : null, - openInFolderMessage = platform.startsWith('Mac') ? 'Open in Finder' : 'Open in Folder', + openInFolderMessage = platform.startsWith('Mac') ? __('Open in Finder') : __('Open in Folder'), showMenu = fileInfo && Object.keys(fileInfo).length > 0, title = metadata ? metadata.title : uri; @@ -76,7 +76,7 @@ class FileActions extends React.Component { const progress = (fileInfo && fileInfo.written_bytes) ? fileInfo.written_bytes / fileInfo.total_bytes * 100 : 0, - label = fileInfo ? progress.toFixed(0) + '% complete' : 'Connecting...', + label = fileInfo ? progress.toFixed(0) + __('% complete') : __('Connecting...'), labelWithIcon = {label}; content =
@@ -86,24 +86,24 @@ class FileActions extends React.Component { } else if (!fileInfo && isAvailable === undefined) { - content = + content = } else if (!fileInfo && !isAvailable && !this.state.forceShowActions) { content =
-
Content unavailable.
- {__("Content unavailable.")}
+ - +
} else if (fileInfo === null && !downloading) { - content = { startDownload(uri) } } />; + content = { startDownload(uri) } } />; } else if (fileInfo && fileInfo.download_path) { - content = openInShell(fileInfo)} />; + content = openInShell(fileInfo)} />; } else { console.log('handle this case of file action props?'); console.log(this.props) @@ -115,29 +115,29 @@ class FileActions extends React.Component { { showMenu ? openInFolder(fileInfo)} label={openInFolderMessage} /> - openModal('confirmRemove')} label="Remove..." /> + openModal('confirmRemove')} label={__("Remove...")} /> : '' } - This will purchase {title} for credits. + contentLabel={__("Confirm Purchase")} onConfirmed={this.onAffirmPurchase.bind(this)} onAborted={this.props.closeModal}> + {__("This will purchase")} {title} {__("for")} {__("credits")}. - - You don't have enough LBRY credits to pay for this stream. + {__("You don't have enough LBRY credits to pay for this stream.")} - - LBRY was unable to download the stream {uri}. + {__("LBRY was unable to download the stream")} {uri}. deleteFile(fileInfo.outpoint, deleteChecked)} onAborted={closeModal}> -

Are you sure you'd like to remove {title} from LBRY?

+

{__("Are you sure you'd like to remove")} {title} {__("from LBRY?")}

- +
); diff --git a/ui/js/component/fileCard/view.jsx b/ui/js/component/fileCard/view.jsx index 918476a53..d333c03c9 100644 --- a/ui/js/component/fileCard/view.jsx +++ b/ui/js/component/fileCard/view.jsx @@ -68,11 +68,11 @@ class FileCard extends React.Component { let description = "" if (isResolvingUri) { - description = "Loading..." + description = __("Loading...") } else if (metadata && metadata.description) { description = metadata.description } else if (claim === null) { - description = 'This address contains no content.' + description = __("This address contains no content.") } return ( @@ -99,8 +99,7 @@ class FileCard extends React.Component { {obscureNsfw && this.state.hovered ?

- This content is Not Safe For Work. - To view adult content, please change your navigate('settings')} label="Settings" />. + {__("This content is Not Safe For Work. To view adult content, please change your")} navigate('settings')} label={__("Settings")} />.

: null} From 7d6368aecace2ecee37fe8ef0fef523ad6c103c7 Mon Sep 17 00:00:00 2001 From: Intnick Date: Fri, 26 May 2017 15:55:59 +0200 Subject: [PATCH 024/106] fileList component translated --- app/locales/en.json | 6 ++++-- ui/js/component/fileList/view.jsx | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/locales/en.json b/app/locales/en.json index 7ffeee538..e99a342a3 100644 --- a/app/locales/en.json +++ b/app/locales/en.json @@ -219,5 +219,7 @@ "Empty claim or metadata info.": "Empty claim or metadata info.", "This content is Not Safe For Work. To view adult content, please change your": "This content is Not Safe For Work. To view adult content, please change your", "This address contains no content.": "This address contains no content.", - "Looking up version info": "Looking up version info" -} + "Sort by": "Sort by", + "Date": "Date", + "File name": "File name" +} \ No newline at end of file diff --git a/ui/js/component/fileList/view.jsx b/ui/js/component/fileList/view.jsx index eb3b620b8..cd85a7b84 100644 --- a/ui/js/component/fileList/view.jsx +++ b/ui/js/component/fileList/view.jsx @@ -77,11 +77,11 @@ class FileList extends React.Component {
{ fetching && } - Sort by { ' ' } + {__("Sort by")} { ' ' } - - - + + + {content} From 972ac785957511c8638b044fee696b6057da7bb6 Mon Sep 17 00:00:00 2001 From: Intnick Date: Fri, 26 May 2017 16:13:16 +0200 Subject: [PATCH 025/106] fileListSearch and fileTitle component translated --- app/locales/en.json | 8 +++++++- ui/js/component/fileListSearch/view.jsx | 10 +++++----- ui/js/component/fileTile/view.jsx | 11 +++++------ 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/app/locales/en.json b/app/locales/en.json index e99a342a3..d0ad9cd54 100644 --- a/app/locales/en.json +++ b/app/locales/en.json @@ -221,5 +221,11 @@ "This address contains no content.": "This address contains no content.", "Sort by": "Sort by", "Date": "Date", - "File name": "File name" + "File name": "File name", + "Looking up the Dewey Decimals": "Looking up the Dewey Decimals", + "No one has checked anything in for %s yet.": "No one has checked anything in for %s yet.", + "Be the first": "Be the first", + "Refreshing the Dewey Decimals": "Refreshing the Dewey Decimals", + "This location is unused.": "This location is unused.", + "Put something here!": "Put something here!" } \ No newline at end of file diff --git a/ui/js/component/fileListSearch/view.jsx b/ui/js/component/fileListSearch/view.jsx index 986d8aa5c..7666c54fc 100644 --- a/ui/js/component/fileListSearch/view.jsx +++ b/ui/js/component/fileListSearch/view.jsx @@ -16,8 +16,8 @@ const SearchNoResults = (props) => { return
- No one has checked anything in for {query} yet. { ' ' } - navigate('/publish')} /> + {__("No one has checked anything in for %s yet."), query} { ' ' } + navigate('/publish')} />
; } @@ -60,10 +60,10 @@ class FileListSearch extends React.Component{ return (
{isSearching && !results && - } + } {isSearching && results && - } + } {(results && !!results.length) ? : @@ -73,4 +73,4 @@ class FileListSearch extends React.Component{ } } -export default FileListSearch \ No newline at end of file +export default FileListSearch diff --git a/ui/js/component/fileTile/view.jsx b/ui/js/component/fileTile/view.jsx index 250bf6296..610ad2d28 100644 --- a/ui/js/component/fileTile/view.jsx +++ b/ui/js/component/fileTile/view.jsx @@ -68,15 +68,15 @@ class FileTile extends React.Component { if (isClaimed) { description = metadata && metadata.description } else if (isResolvingUri) { - description = "Loading..." + description = __("Loading...") } else if (showEmpty === FileTile.SHOW_EMPTY_PUBLISH) { onClick = () => navigate('/publish', { }) description = - This location is unused. { ' ' } - { isClaimable && Put something here! } + {__("This location is unused.")} { ' ' } + { isClaimable && {__("Put something here!")} } } else if (showEmpty === FileTile.SHOW_EMPTY_PENDING) { - description = This file is pending confirmation. + description = {__("This file is pending confirmation.")} } return ( @@ -103,8 +103,7 @@ class FileTile extends React.Component { {this.state.showNsfwHelp ?

- This content is Not Safe For Work. - To view adult content, please change your navigate('/settings')} label="Settings" />. + {__("This content is Not Safe For Work. To view adult content, please change your")} navigate('/settings')} label={__("Settings")} />.

: null} From 1d09f0839286b03c110560dd3056401b9b2e6150 Mon Sep 17 00:00:00 2001 From: Intnick Date: Fri, 26 May 2017 16:19:49 +0200 Subject: [PATCH 026/106] header and tranactionList component translated --- app/locales/en.json | 8 +++++++- ui/js/component/header/view.jsx | 2 +- ui/js/component/transactionList/view.jsx | 20 ++++++++++---------- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/app/locales/en.json b/app/locales/en.json index d0ad9cd54..04947c1b9 100644 --- a/app/locales/en.json +++ b/app/locales/en.json @@ -227,5 +227,11 @@ "Be the first": "Be the first", "Refreshing the Dewey Decimals": "Refreshing the Dewey Decimals", "This location is unused.": "This location is unused.", - "Put something here!": "Put something here!" + "Put something here!": "Put something here!", + "Transaction History": "Transaction History", + "You have no transactions.": "You have no transactions.", + "Loading transactions": "Loading transactions", + "Amount": "Amount", + "Time": "Time", + "Transaction": "Transaction" } \ No newline at end of file diff --git a/ui/js/component/header/view.jsx b/ui/js/component/header/view.jsx index 68328feb9..32d15501a 100644 --- a/ui/js/component/header/view.jsx +++ b/ui/js/component/header/view.jsx @@ -23,7 +23,7 @@ export const Header = (props) => { navigate('/wallet')} button="text" icon="icon-bank" label={balance} >
- navigate('/publish')} button="primary button--flat" icon="icon-upload" label="Publish" /> + navigate('/publish')} button="primary button--flat" icon="icon-upload" label={__("Publish")} />
navigate('/downloaded')} button="alt button--flat" icon="icon-folder" /> diff --git a/ui/js/component/transactionList/view.jsx b/ui/js/component/transactionList/view.jsx index 5d92e2b68..3da32a13d 100644 --- a/ui/js/component/transactionList/view.jsx +++ b/ui/js/component/transactionList/view.jsx @@ -22,8 +22,8 @@ class TransactionList extends React.Component{ rows.push( { (item.amount > 0 ? '+' : '' ) + item.amount } - { item.date ? item.date.toLocaleDateString() : (Transaction pending) } - { item.date ? item.date.toLocaleTimeString() : (Transaction pending) } + { item.date ? item.date.toLocaleDateString() : {__("(Transaction pending)")} } + { item.date ? item.date.toLocaleTimeString() : {__("(Transaction pending)")} } {item.id.substr(0, 7)} @@ -35,19 +35,19 @@ class TransactionList extends React.Component{ return (
-

Transaction History

+

{__("Transaction History")}

- { fetchingTransactions && } - { !fetchingTransactions && rows.length === 0 ?
You have no transactions.
: '' } + { fetchingTransactions && } + { !fetchingTransactions && rows.length === 0 ?
{__("You have no transactions.")}
: '' } { rows.length > 0 ? - - - - + + + + @@ -62,4 +62,4 @@ class TransactionList extends React.Component{ } } -export default TransactionList \ No newline at end of file +export default TransactionList From 469e769e018aa7f6835fc13874a4dbf81e6adc50 Mon Sep 17 00:00:00 2001 From: Mayesters Date: Fri, 26 May 2017 22:26:06 +0200 Subject: [PATCH 027/106] 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 0bf7dc0bb..431c2ee82 100644 --- a/ui/js/component/video/view.jsx +++ b/ui/js/component/video/view.jsx @@ -53,20 +53,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 :(")} ); } @@ -102,16 +102,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 a3ac1e958..c090951ce 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]; } @@ -82,7 +82,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}) => { @@ -97,7 +97,7 @@ rewards.claimReward = function (type) { // Display global notice const action = doShowSnackBar({ message, - linkText: "Show All", + linkText: __("Show All"), linkTarget: "/rewards", isError: false, }) @@ -126,7 +126,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; @@ -141,8 +141,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; From 13989632a7a79771ae0429a2563a2532a635c747 Mon Sep 17 00:00:00 2001 From: Intnick Date: Sun, 28 May 2017 16:09:56 +0200 Subject: [PATCH 028/106] language switch implementation. Needs more testing --- app/locales/en.json | 3 ++- ui/js/component/app/view.jsx | 2 +- ui/js/component/header/index.js | 3 ++- ui/js/component/header/view.jsx | 5 +++-- ui/js/lbry.js | 1 + ui/js/main.js | 3 ++- ui/js/page/settings/view.jsx | 34 ++++++++++++++++++++++++++++++++- ui/js/selectors/app.js | 5 ++++- 8 files changed, 48 insertions(+), 8 deletions(-) diff --git a/app/locales/en.json b/app/locales/en.json index acf9f743f..0d5af2e42 100644 --- a/app/locales/en.json +++ b/app/locales/en.json @@ -305,5 +305,6 @@ "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" + "Find movies, music, games, and more": "Find movies, music, games, and more", + "Wallet": "Wallet" } \ No newline at end of file diff --git a/ui/js/component/app/view.jsx b/ui/js/component/app/view.jsx index 1c7ff4eb4..2c13c6328 100644 --- a/ui/js/component/app/view.jsx +++ b/ui/js/component/app/view.jsx @@ -20,7 +20,7 @@ class App extends React.Component { lbry.balanceSubscribe((balance) => { this.props.updateBalance(balance) }) - } + }y render() { const { diff --git a/ui/js/component/header/index.js b/ui/js/component/header/index.js index dafdabf32..25846b5c3 100644 --- a/ui/js/component/header/index.js +++ b/ui/js/component/header/index.js @@ -13,7 +13,8 @@ import { import Header from './view' const select = (state) => ({ - balance: lbry.formatCredits(selectBalance(state), 1) + balance: lbry.formatCredits(selectBalance(state), 1), + publish: __("Publish"), }) const perform = (dispatch) => ({ diff --git a/ui/js/component/header/view.jsx b/ui/js/component/header/view.jsx index 32d15501a..341b734cb 100644 --- a/ui/js/component/header/view.jsx +++ b/ui/js/component/header/view.jsx @@ -6,7 +6,8 @@ export const Header = (props) => { const { balance, back, - navigate + navigate, + publish, } = props return
- navigate('/publish')} button="primary button--flat" icon="icon-upload" label={__("Publish")} /> + navigate('/publish')} button="primary button--flat" icon="icon-upload" label={publish} />
navigate('/downloaded')} button="alt button--flat" icon="icon-folder" /> diff --git a/ui/js/lbry.js b/ui/js/lbry.js index 0be9f5ef1..d3836e516 100644 --- a/ui/js/lbry.js +++ b/ui/js/lbry.js @@ -18,6 +18,7 @@ let lbry = { useCustomLighthouseServers: false, customLighthouseServers: [], showDeveloperMenu: false, + language: 'en', } }; diff --git a/ui/js/main.js b/ui/js/main.js index 222e71890..e50f6f6c0 100644 --- a/ui/js/main.js +++ b/ui/js/main.js @@ -3,9 +3,10 @@ import ReactDOM from 'react-dom'; import lbry from './lbry.js'; import lbryio from './lbryio.js'; -const i18n = require('y18n')({directory: 'app/locales'}); +const i18n = require('y18n')({directory: 'app/locales'/*, locale: lbry.getClientSetting('language')*/}); window.__ = i18n.__; window.__n = i18n.__n; +window.i18n = i18n; import lighthouse from './lighthouse.js'; import App from 'component/app/index.js'; diff --git a/ui/js/page/settings/view.jsx b/ui/js/page/settings/view.jsx index ea70629ee..973f4d75a 100644 --- a/ui/js/page/settings/view.jsx +++ b/ui/js/page/settings/view.jsx @@ -3,10 +3,11 @@ import {FormField, FormRow} from 'component/form.js'; import SubHeader from 'component/subHeader' import lbry from 'lbry.js'; + class SettingsPage extends React.Component { constructor(props) { super(props); - + const daemonSettings = this.props.daemonSettings this.state = { @@ -14,6 +15,7 @@ class SettingsPage extends React.Component { isMaxDownload: daemonSettings && daemonSettings.max_download != 0, showNsfw: lbry.getClientSetting('showNsfw'), showUnavailable: lbry.getClientSetting('showUnavailable'), + language: lbry.getClientSetting('language'), } } @@ -68,6 +70,12 @@ class SettingsPage extends React.Component { lbry.setClientSetting('showNsfw', event.target.checked); } + onLanguageChange(language) { + lbry.setClientSetting('language', language); + i18n.setLocale(language); + this.setState({language: language}) + } + onShowUnavailableChange(event) { } @@ -185,6 +193,30 @@ class SettingsPage extends React.Component { helper={__("NSFW content may include nudity, intense sexuality, profanity, or other adult content. By displaying NSFW content, you are affirming you are of legal age to view mature content in your country or jurisdiction. ")} />
+ + +
+
+

{__("Language")}

+
+
+
+ { this.onLanguageChange('en') }} + defaultChecked={this.state.language=='en'} /> +
+
+ { this.onLanguageChange('rs') }} + defaultChecked={this.state.language=='rs'} /> +
+
+
+

{__("Share Diagnostic Data")}

diff --git a/ui/js/selectors/app.js b/ui/js/selectors/app.js index 9509f8f7a..1e96d66d0 100644 --- a/ui/js/selectors/app.js +++ b/ui/js/selectors/app.js @@ -47,10 +47,13 @@ export const selectPageTitle = createSelector( case 'report': return __('Report') case 'wallet': + return __("Wallet") case 'send': + return __("Send") case 'receive': + return __("Receive") case 'rewards': - return page.charAt(0).toUpperCase() + page.slice(1) + return __("Rewards") case 'show': return lbryuri.normalize(params.uri) case 'downloaded': From 02b13fc25268c6e63e98c1eb3009bde6be4c57f3 Mon Sep 17 00:00:00 2001 From: Intnick Date: Sun, 28 May 2017 18:36:35 +0200 Subject: [PATCH 029/106] i18n ready for testing --- app/locales/en.json | 5 +- app/locales/rs.json | 311 ++++++++++++++++++++++++++++++++ ui/js/component/header/view.jsx | 2 +- 3 files changed, 315 insertions(+), 3 deletions(-) create mode 100644 app/locales/rs.json diff --git a/app/locales/en.json b/app/locales/en.json index 0d5af2e42..30913e3ac 100644 --- a/app/locales/en.json +++ b/app/locales/en.json @@ -306,5 +306,6 @@ "Transaction failed": "Transaction failed", "Something went wrong": "Something went wrong", "Find movies, music, games, and more": "Find movies, music, games, and more", - "Wallet": "Wallet" -} \ No newline at end of file + "Wallet": "Wallet", + "Looking up version info": "Looking up version info" +} diff --git a/app/locales/rs.json b/app/locales/rs.json new file mode 100644 index 000000000..ebac8ca19 --- /dev/null +++ b/app/locales/rs.json @@ -0,0 +1,311 @@ +{ + "Edit": "RS_Edit", + "Help": "RS_Help", + "Developer": "RS_Developer", + "Reload": "RS_Reload", + "Toggle Developer Tools": "RS_Toggle Developer Tools", + "Inspect Element": "RS_Inspect Element", + "connectionString": "RS_connectionString", + "Method": "RS_Method", + "Parameters": "RS_Parameters", + "Error code": "RS_Error code", + "Error message": "RS_Error message", + "Error data": "RS_Error data", + "Home": "RS_Home", + "Publish": "RS_Publish", + "This LBC remains yours and the deposit can be undone at any time.": "RS_This LBC remains yours and the deposit can be undone at any time.", + "Content": "RS_Content", + "What are you publishing?": "RS_What are you publishing?", + "Access": "RS_Access", + "Select a URL for this publish.": "RS_Select a URL for this publish.", + "How much does this content cost?": "RS_How much does this content cost?", + "Price": "RS_Price", + "Free": "RS_Free", + "Choose price...": "RS_Choose price...", + "US Dollars": "RS_US Dollars", + "LBRY credits": "RS_LBRY credits", + "Public Domain": "RS_Public Domain", + "Creative Commons Attribution 4.0 International": "RS_Creative Commons Attribution 4.0 International", + "Creative Commons Attribution-ShareAlike 4.0 International": "RS_Creative Commons Attribution-ShareAlike 4.0 International", + "Creative Commons Attribution-NoDerivatives 4.0 International": "RS_Creative Commons Attribution-NoDerivatives 4.0 International", + "Creative Commons Attribution-NonCommercial 4.0 International": "RS_Creative Commons Attribution-NonCommercial 4.0 International", + "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International": "RS_Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International", + "Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International": "RS_Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International", + "Copyrighted...": "RS_Copyrighted...", + "Other...": "RS_Other...", + "Identity": "RS_Identity", + "Who created this content?": "RS_Who created this content?", + "Anonymous": "RS_Anonymous", + "New identity...": "RS_New identity...", + "Address": "RS_Address", + "Where should this content permanently reside?": "RS_Where should this content permanently reside?", + "Read more": "RS_Read more", + "Terms of Service": "RS_Terms of Service", + "Deposit": "RS_Deposit", + "This URL is unused.": "RS_This URL is unused.", + "LBRY names must contain only letters, numbers and dashes.": "RS_LBRY names must contain only letters, numbers and dashes.", + "Title": "RS_Title", + "Thumbnail URL": "RS_Thumbnail URL", + "Description": "RS_Description", + "Description of your content": "RS_Description of your content", + "Language": "RS_Language", + "English": "RS_English", + "Chinese": "RS_Chinese", + "French": "RS_French", + "German": "RS_German", + "Japanese": "RS_Japanese", + "Russian": "RS_Russian", + "Spanish": "RS_Spanish", + "Maturity": "RS_Maturity", + "All Ages": "RS_All Ages", + "Adults Only": "RS_Adults Only", + "Cancel": "RS_Cancel", + "File published": "RS_File published", + "I agree to the": "RS_I agree to the", + "LBRY terms of service": "RS_LBRY terms of service", + "Your file has been published to LBRY at the address": "RS_Your file has been published to LBRY at the address", + "The file will take a few minutes to appear for other LBRY users. Until then it will be listed as \"pending\" under your published files.": "RS_The file will take a few minutes to appear for other LBRY users. Until then it will be listed as \"pending\" under your published files.", + "Error publishing file": "RS_Error publishing file", + "The following error occurred when attempting to publish your file": "RS_The following error occurred when attempting to publish your file", + "A deposit of at least \"%s\" credit is required to win \"%s\". However, you can still get a permanent URL for any amount.": { + "one": "RS_A deposit of at least \"%s\" credit is required to win \"%s\". However, you can still get a permanent URL for any amount.", + "other": "RS_A deposit of at least \"%s\" credits is required to win \"%s\". However, you can still get a permanent URL for any amount." + }, + "Connecting": "RS_Connecting", + "Discover": "RS_Discover", + "Fetching content": "RS_Fetching content", + "What's this?": "RS_What's this?", + "Community Content is a public space where anyone can share content with the rest of the LBRY community. Bid on the names \"one,\" \"two,\" \"three,\" \"four\" and \"five\" to put your content here!": "RS_Community Content is a public space where anyone can share content with the rest of the LBRY community. Bid on the names \"one,\" \"two,\" \"three,\" \"four\" and \"five\" to put your content here!", + "LBRY is Closed": "RS_LBRY is Closed", + "Click here to start LBRY": "RS_Click here to start LBRY", + "Failed to load landing content.": "RS_Failed to load landing content.", + "Settings": "RS_Settings", + "Welcome to LBRY": "RS_Welcome to LBRY", + "Downloads & Purchases": "RS_Downloads & Purchases", + "Downloaded": "RS_Downloaded", + "Published": "RS_Published", + "Publishes": "RS_Publishes", + "Overview": "RS_Overview", + "Send": "RS_Send", + "Receive": "RS_Receive", + "Rewards": "RS_Rewards", + "Search results for %s": "RS_Search results for %s", + "Search": "RS_Search", + "Your email is still not verified.": "RS_Your email is still not verified.", + "Next": "RS_Next", + "Email": "RS_Email", + "Verification Code": "RS_Verification Code", + "A verification code is required to access this version.": "RS_A verification code is required to access this version.", + "Verify": "RS_Verify", + "No code?": "RS_No code?", + "Click here": "RS_Click here", + "Authentication": "RS_Authentication", + "LBRY Early Access": "RS_LBRY Early Access", + "Preparing for first access": "RS_Preparing for first access", + "Welcome to LBRY.": "RS_Welcome to LBRY.", + "Using LBRY is like dating a centaur. Totally normal up top, and way different underneath.": "RS_Using LBRY is like dating a centaur. Totally normal up top, and way different underneath.", + "Up top, LBRY is similar to popular media sites.": "RS_Up top, LBRY is similar to popular media sites.", + "Below, LBRY is controlled by users -- you -- via blockchain and decentralization.": "RS_Below, LBRY is controlled by users -- you -- via blockchain and decentralization.", + "Thank you for making content freedom possible! Here's a nickel, kid.": "RS_Thank you for making content freedom possible! Here's a nickel, kid.", + "Developer Settings": "RS_Developer Settings", + "Show developer menu": "RS_Show developer menu", + "Use custom search servers": "RS_Use custom search servers", + "Custom search servers (one per line)": "RS_Custom search servers (one per line)", + "Force Upgrade": "RS_Force Upgrade", + "OK": "RS_OK", + "Show More...": "RS_Show More...", + "Show Less": "RS_Show Less", + "Starting daemon": "RS_Starting daemon", + "Waiting for name resolution": "RS_Waiting for name resolution", + "Using LBRY is like dating a centaur. Totally normal up top, and way different underneath.": "RS_Using LBRY is like dating a centaur. Totally normal up top, and way different underneath.", + "Claim Reward": "RS_Claim Reward", + "Claiming...": "RS_Claiming...", + "This is an estimate and does not include data fees": "RS_This is an estimate and does not include data fees", + "free": "RS_free", + "Reward Claim Error": "RS_Reward Claim Error", + "This field is required": "RS_This field is required", + "Choose File": "RS_Choose File", + "No File Chosen": "RS_No File Chosen", + "Choose Directory": "RS_Choose Directory", + "Downloading Update": "RS_Downloading Update", + "Click \"Begin Upgrade\" to start the upgrade process.": "RS_Click \"Begin Upgrade\" to start the upgrade process.", + "The app will close, and you will be prompted to install the latest version of LBRY.": "RS_The app will close, and you will be prompted to install the latest version of LBRY.", + "After the install is complete, please reopen the app.": "RS_After the install is complete, please reopen the app.", + "Begin Upgrade": "RS_Begin Upgrade", + "API connection string": "RS_API connection string", + "We're sorry that LBRY has encountered an error. This has been reported and we will investigate the problem.": "RS_We're sorry that LBRY has encountered an error. This has been reported and we will investigate the problem.", + "You haven't downloaded anything from LBRY yet. Go": "RS_You haven't downloaded anything from LBRY yet. Go", + "search for your first download": "RS_search for your first download", + "Loading": "RS_Loading", + " credits": "RS_ credits", + "It looks like you haven't published anything to LBRY yet. Go": "RS_It looks like you haven't published anything to LBRY yet. Go", + "share your beautiful cats with the world": "RS_share your beautiful cats with the world", + "report": "RS_report", + "Content-Type": "RS_Content-Type", + "Author": "RS_Author", + "License": "RS_License", + "Read the FAQ": "RS_Read the FAQ", + "Our FAQ answers many common questions.": "RS_Our FAQ answers many common questions.", + "Get Live Help": "RS_Get Live Help", + "Live help is available most hours in the": "RS_Live help is available most hours in the", + "channel of our Slack chat room.": "RS_channel of our Slack chat room.", + "Join Our Slack": "RS_Join Our Slack", + "Report a Bug": "RS_Report a Bug", + "Did you find something wrong?": "RS_Did you find something wrong?", + "Submit a Bug Report": "RS_Submit a Bug Report", + "Thanks! LBRY is made by its users.": "RS_Thanks! LBRY is made by its users.", + "Report": "RS_Report", + "About": "RS_About", + "A newer version of LBRY is available.": "RS_A newer version of LBRY is available.", + "Download LBRY %s now!": "RS_Download LBRY %s now!", + "Your copy of LBRY is up to date.": "RS_Your copy of LBRY is up to date.", + "daemon (lbrynet)": "RS_daemon (lbrynet)", + "wallet (lbryum)": "RS_wallet (lbryum)", + "interface": "RS_interface", + "Platform": "RS_Platform", + "Installation ID": "RS_Installation ID", + "Search Results for": "RS_Search Results for", + "These search results are provided by LBRY, Inc.": "RS_These search results are provided by LBRY, Inc.", + "Exact URL": "RS_Exact URL", + "This is the resolution of a LBRY URL and not controlled by LBRY Inc.": "RS_This is the resolution of a LBRY URL and not controlled by LBRY Inc.", + "Download Directory": "RS_Download Directory", + "LBRY downloads will be saved here.": "RS_LBRY downloads will be saved here.", + "Bandwidth Limits": "RS_Bandwidth Limits", + "Max Upload": "RS_Max Upload", + "Unlimited": "RS_Unlimited", + "Up to": "RS_Up to", + "Max Download": "RS_Max Download", + "Show unavailable content in search results": "RS_Show unavailable content in search results", + "Show NSFW content": "RS_Show NSFW content", + "NSFW content may include nudity, intense sexuality, profanity, or other adult content. By displaying NSFW content, you are affirming you are of legal age to view mature content in your country or jurisdiction. ": "RS_NSFW content may include nudity, intense sexuality, profanity, or other adult content. By displaying NSFW content, you are affirming you are of legal age to view mature content in your country or jurisdiction. ", + "Share Diagnostic Data": "RS_Share Diagnostic Data", + "Help make LBRY better by contributing diagnostic data about my usage": "RS_Help make LBRY better by contributing diagnostic data about my usage", + "Choose limit...": "RS_Choose limit...", + "Loading magic decentralized data...": "RS_Loading magic decentralized data...", + "There's nothing at this location.": "RS_There's nothing at this location.", + "Report an Issue": "RS_Report an Issue", + "Please describe the problem you experienced and any information you think might be useful to us. Links to screenshots are great!": "RS_Please describe the problem you experienced and any information you think might be useful to us. Links to screenshots are great!", + "Description of your issue": "RS_Description of your issue", + "Submit Report": "RS_Submit Report", + "Developer?": "RS_Developer?", + "You can also": "RS_You can also", + "submit an issue on GitHub": "RS_submit an issue on GitHub", + "Bug report submitted": "RS_Bug report submitted", + "Your bug report has been submitted! Thank you for your feedback.": "RS_Your bug report has been submitted! Thank you for your feedback.", + "Balance": "RS_Balance", + "Open in Folder": "RS_Open in Folder", + "Checking availability": "RS_Checking availability", + "Confirm Purchase": "RS_Confirm Purchase", + "This will purchase": "RS_This will purchase", + "for": "RS_for", + "credits": "RS_credits", + "Not enough credits": "RS_Not enough credits", + "You don't have enough LBRY credits to pay for this stream.": "RS_You don't have enough LBRY credits to pay for this stream.", + "Download failed": "RS_Download failed", + "LBRY was unable to download the stream": "RS_LBRY was unable to download the stream", + "Remove": "RS_Remove", + "Are you sure you'd like to remove": "RS_Are you sure you'd like to remove", + "from LBRY?": "RS_from LBRY?", + "Delete this file from my computer": "RS_Delete this file from my computer", + "Download": "RS_Download", + "Content unavailable.": "RS_Content unavailable.", + "Why?": "RS_Why?", + "The content on LBRY is hosted by its users. It appears there are no users connected that have this file at the moment.": "RS_The content on LBRY is hosted by its users. It appears there are no users connected that have this file at the moment.", + "Try Anyway": "RS_Try Anyway", + "Open": "RS_Open", + "Remove...": "RS_Remove...", + "% complete": "RS_% complete", + "Loading...": "RS_Loading...", + "Empty claim or metadata info.": "RS_Empty claim or metadata info.", + "This content is Not Safe For Work. To view adult content, please change your": "RS_This content is Not Safe For Work. To view adult content, please change your", + "This address contains no content.": "RS_This address contains no content.", + "Sort by": "RS_Sort by", + "Date": "RS_Date", + "File name": "RS_File name", + "Looking up the Dewey Decimals": "RS_Looking up the Dewey Decimals", + "No one has checked anything in for %s yet.": "RS_No one has checked anything in for %s yet.", + "Be the first": "RS_Be the first", + "Refreshing the Dewey Decimals": "RS_Refreshing the Dewey Decimals", + "This location is unused.": "RS_This location is unused.", + "Put something here!": "RS_Put something here!", + "Transaction History": "RS_Transaction History", + "You have no transactions.": "RS_You have no transactions.", + "Loading transactions": "RS_Loading transactions", + "Amount": "RS_Amount", + "Time": "RS_Time", + "Transaction": "RS_Transaction", + "You earned %s for registering as a new developer.": "RS_You earned %s for registering as a new developer.", + "You earned %s LBC new user reward.": "RS_You earned %s LBC new user reward.", + "You earned %s LBC for verifying your email address.": "RS_You earned %s LBC for verifying your email address.", + "You earned %s LBC for creating a publisher identity.": "RS_You earned %s LBC for creating a publisher identity.", + "You earned %s LBC for streaming your first video.": "RS_You earned %s LBC for streaming your first video.", + "You earned %s LBC for downloading some of the things.": "RS_You earned %s LBC for downloading some of the things.", + "You earned %s LBC for making your first publication.": "RS_You earned %s LBC for making your first publication.", + "Your First Nickel": "RS_Your First Nickel", + "First Publish": "RS_First Publish", + "We're Going Streaming": "RS_We're Going Streaming", + "Channel Surfing": "RS_Channel Surfing", + "Many Views": "RS_Many Views", + "Hot Right Now": "RS_Hot Right Now", + "A welcome bonus for being at the vanguard of content freedom.": "RS_A welcome bonus for being at the vanguard of content freedom.", + "The first view is on us.": "RS_The first view is on us.", + "Up the quad, and to the gymanasium. Press play. Everybody's doing it.": "RS_Up the quad, and to the gymanasium. Press play. Everybody's doing it.", + "Claim your channel! Create an identity used to securely publish content.": "RS_Claim your channel! Create an identity used to securely publish content.", + "Watch a bunch of stuff... who knows how much?": "RS_Watch a bunch of stuff... who knows how much?", + "Watch the latest featured content.": "RS_Watch the latest featured content.", + "Rewards are not enabled.": "RS_Rewards are not enabled.", + "Failed to load rewards.": "RS_Failed to load rewards.", + "Reward claimed.": "RS_Reward claimed.", + "Show All": "RS_Show All", + "Please create a channel identity first.": "RS_Please create a channel identity first.", + "Please publish something and wait for confirmation by the network to claim this reward.": "RS_Please publish something and wait for confirmation by the network to claim this reward.", + "Please publish something to claim this reward.": "RS_Please publish something to claim this reward.", + "Could not connect to Lighthouse server. Last server attempted: %s": "RS_Could not connect to Lighthouse server. Last server attempted: %s", + "LBRY URIs must include a protocol prefix (lbry://).": "RS_LBRY URIs must include a protocol prefix (lbry://).", + "URI does not include name.": "RS_URI does not include name.", + "No channel name after @.": "RS_No channel name after @.", + "Channel names must be at least %s characters.": "RS_Channel names must be at least %s characters.", + "Invalid character %s in name: %s.": "RS_Invalid character %s in name: %s.", + "No modifier provided after separator %s.": "RS_No modifier provided after separator %s.", + "Invalid claim ID %s.": "RS_Invalid claim ID %s.", + "Claim sequence must be a number.": "RS_Claim sequence must be a number.", + "Bid position must be a number.": "RS_Bid position must be a number.", + "Only channel URIs may have a path.": "RS_Only channel URIs may have a path.", + "Invalid character %s in path: %s": "RS_Invalid character %s in path: %s", + "No path provided after /": "RS_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.": "RS_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.": "RS_Path and contentName do not match. Only one is required; most likely you wanted contentName.", + "Internal API disabled": "RS_Internal API disabled", + "LBRY internal API is disabled": "RS_LBRY internal API is disabled", + "Something went wrong making an internal API call.": "RS_Something went wrong making an internal API call.", + "XMLHttpRequest connection timed out": "RS_XMLHttpRequest connection timed out", + "Invalid method": "RS_Invalid method", + "Received invalid authentication response.": "RS_Received invalid authentication response.", + "Unable to connect to LBRY": "RS_Unable to connect to LBRY", + "Resolve has hacked cache on top of it that requires a URI": "RS_Resolve has hacked cache on top of it that requires a URI", + "Connection to API server failed": "RS_Connection to API server failed", + "Please select a file to upgrade from": "RS_Please select a file to upgrade from", + "Update available": "RS_Update available", + "Upgrade": "RS_Upgrade", + "Skip": "RS_Skip", + "Your version of LBRY is out of date and may be unreliable or insecure.": "RS_Your version of LBRY is out of date and may be unreliable or insecure.", + "Sorry, your download timed out :(": "RS_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": "RS_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!": "RS_Downloading stream... not long left now!", + "this is the world's worst loading screen and we shipped our software with it anyway...": "RS_this is the world's worst loading screen and we shipped our software with it anyway...", + "Wallet Address": "RS_Wallet Address", + "Get New Address": "RS_Get New Address", + "Other LBRY users may send credits to you by entering this address on the \"Send\" page.": "RS_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.": "RS_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": "RS_Send Credits", + "Recipient Address": "RS_Recipient Address", + "Insufficient balance": "RS_Insufficient balance", + "Insufficient balance: after this transaction you would have less than 1 LBC in your wallet.": "RS_Insufficient balance: after this transaction you would have less than 1 LBC in your wallet.", + "Transaction successful": "RS_Transaction successful", + "Your transaction was successfully placed in the queue.": "RS_Your transaction was successfully placed in the queue.", + "Transaction failed": "RS_Transaction failed", + "Something went wrong": "RS_Something went wrong", + "Find movies, music, games, and more": "RS_Find movies, music, games, and more", + "Wallet": "RS_Wallet", + "Looking up version info": "RS_Looking up version info" +} diff --git a/ui/js/component/header/view.jsx b/ui/js/component/header/view.jsx index 341b734cb..719cfd2d7 100644 --- a/ui/js/component/header/view.jsx +++ b/ui/js/component/header/view.jsx @@ -18,7 +18,7 @@ export const Header = (props) => { navigate('/discover')} button="alt button--flat" icon="icon-home" />
- +
navigate('/wallet')} button="text" icon="icon-bank" label={balance} > From 1a3c20a637e3c055811c67eb5c8b996152f438cd Mon Sep 17 00:00:00 2001 From: Mayesters Date: Sun, 28 May 2017 18:56:01 +0200 Subject: [PATCH 030/106] Translated updated components --- app/locales/en.json | 4 +++- ui/js/component/fileActions/view.jsx | 4 ++-- ui/js/component/video/view.jsx | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/locales/en.json b/app/locales/en.json index 30913e3ac..6baadaac6 100644 --- a/app/locales/en.json +++ b/app/locales/en.json @@ -307,5 +307,7 @@ "Something went wrong": "Something went wrong", "Find movies, music, games, and more": "Find movies, music, games, and more", "Wallet": "Wallet", - "Looking up version info": "Looking up version info" + "Looking up version info": "Looking up version info", + "It looks like you deleted or moved this file. We're rebuilding it now. It will only take a few seconds.": "It looks like you deleted or moved this file. We're rebuilding it now. It will only take a few seconds.", + "Fetching cost info": "Fetching cost info" } diff --git a/ui/js/component/fileActions/view.jsx b/ui/js/component/fileActions/view.jsx index 686dfd98f..b73573922 100644 --- a/ui/js/component/fileActions/view.jsx +++ b/ui/js/component/fileActions/view.jsx @@ -101,9 +101,9 @@ class FileActions extends React.Component { } else if (fileInfo === null && !downloading) { if (!costInfo) { - content = + content = } else { - content = { startDownload(uri) } } />; + content = { startDownload(uri) } } />; } } else if (fileInfo && fileInfo.download_path) { diff --git a/ui/js/component/video/view.jsx b/ui/js/component/video/view.jsx index 8f0c99720..3cf65a7e1 100644 --- a/ui/js/component/video/view.jsx +++ b/ui/js/component/video/view.jsx @@ -102,7 +102,7 @@ class Video extends React.Component { let loadStatusMessage = '' if(fileInfo && fileInfo.completed && !fileInfo.written_bytes) { - loadStatusMessage = "It looks like you deleted or moved this file. We're rebuilding it now. It will only take a few seconds." + loadStatusMessage = __("It looks like you deleted or moved this file. We're rebuilding it now. It will only take a few seconds.") } else if (isLoading) { 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) { From a8a42cee2ef8a5314df050b463c2e9d74b64b4d0 Mon Sep 17 00:00:00 2001 From: Mayesters Date: Sun, 28 May 2017 21:35:21 +0200 Subject: [PATCH 031/106] wunderbar translated --- ui/js/component/wunderbar/view.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/js/component/wunderbar/view.jsx b/ui/js/component/wunderbar/view.jsx index 45c39b74e..ea361d320 100644 --- a/ui/js/component/wunderbar/view.jsx +++ b/ui/js/component/wunderbar/view.jsx @@ -151,7 +151,7 @@ class WunderBar extends React.PureComponent { onChange={this.onChange} onKeyPress={this.onKeyPress} value={this.state.address} - placeholder="Find movies, music, games, and more" /> + placeholder={__("Find movies, music, games, and more")} />
); } From 21d8e0c7d17653b89197feaaea37146b1fd580d9 Mon Sep 17 00:00:00 2001 From: Mayesters Date: Wed, 31 May 2017 12:29:22 +0200 Subject: [PATCH 032/106] fixed tick marks in translation --- ui/js/rewards.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ui/js/rewards.js b/ui/js/rewards.js index c090951ce..f7998ce06 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 %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), + 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]; } From dc2dfff148b1b4fd398b1a3dbac04b31b6bbb9fb Mon Sep 17 00:00:00 2001 From: Mayesters Date: Wed, 31 May 2017 12:33:39 +0200 Subject: [PATCH 033/106] fixed misstructured call --- ui/js/page/help/view.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/js/page/help/view.jsx b/ui/js/page/help/view.jsx index 13b3e0342..34ef6a50a 100644 --- a/ui/js/page/help/view.jsx +++ b/ui/js/page/help/view.jsx @@ -99,7 +99,7 @@ class HelpPage extends React.Component {
{this.state.appVersionInfo ? (ver.lbrynet_update_available || ver.lbryum_update_available ? -

{__("A newer version of LBRY is available.")}

+

{__("A newer version of LBRY is available.")}

:

{__("Your copy of LBRY is up to date.")}

) : null} { ver ?
AmountDateTimeTransaction{__("Amount")}{__("Date")}{__("Time")}{__("Transaction")}
From fe7b5eb4e0919091dd0dba990b0355870c82aeda Mon Sep 17 00:00:00 2001 From: Mayesters Date: Wed, 31 May 2017 12:34:39 +0200 Subject: [PATCH 034/106] removed unnecessary y --- ui/js/component/app/view.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/js/component/app/view.jsx b/ui/js/component/app/view.jsx index 2c13c6328..1c7ff4eb4 100644 --- a/ui/js/component/app/view.jsx +++ b/ui/js/component/app/view.jsx @@ -20,7 +20,7 @@ class App extends React.Component { lbry.balanceSubscribe((balance) => { this.props.updateBalance(balance) }) - }y + } render() { const { From 2d5da067de3412c5f09d9b89ba21db9c4c5ed9fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20B=C3=B6ther?= Date: Wed, 31 May 2017 12:40:13 +0200 Subject: [PATCH 035/106] delete windows dev files --- electron.bat | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 electron.bat diff --git a/electron.bat b/electron.bat deleted file mode 100644 index e300c90ae..000000000 --- a/electron.bat +++ /dev/null @@ -1,5 +0,0 @@ -start /min %~dp0node_modules\.bin\electron app - -pause - - From da46487372b30c1a8c05d43a6e3b054ff379aadd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20B=C3=B6ther?= Date: Wed, 31 May 2017 12:40:31 +0200 Subject: [PATCH 036/106] remove windows dev files --- ui/watch.bat | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 ui/watch.bat diff --git a/ui/watch.bat b/ui/watch.bat deleted file mode 100644 index d899c62f9..000000000 --- a/ui/watch.bat +++ /dev/null @@ -1,33 +0,0 @@ -rmdir %~dp0node_modules /s /q -rmdir %~dp0..\node_modules /s /q -rmdir %~dp0..\app\node_modules /s /q - -call yarn install - -echo f | xcopy /s /y %~dp0dist %~dp0..\app\dist - -call %~dp0node_modules\.bin\node-sass --output %~dp0..\app\dist\css --sourcemap=none %~dp0scss\ - -start /min %~dp0node_modules\.bin\node-sass --output %~dp0..\app\dist\css --sourcemap=none --watch %~dp0scss\ & - -call %~dp0node_modules\.bin\webpack --config webpack.dev.config.js --progress --colors - -start /min %~dp0node_modules\.bin\webpack --config webpack.dev.config.js --progress --colors --watch - -call yarn build:langs - -cp %~dp0build\lang\en.json %~dp0..\app\dist\lang\en.json - -cd %~dp0..\app - -call yarn install - -cd ..\ - -call yarn install - -start /min %~dp0..\node_modules\.bin\electron app - -exit 0 - - From 313cea5580452d5831d1ff73c9814ea3dbe4b931 Mon Sep 17 00:00:00 2001 From: Mayesters Date: Wed, 31 May 2017 12:55:32 +0200 Subject: [PATCH 037/106] fix master merge translations --- app/locales/en.json | 9 +++++++-- ui/js/component/fileActions/view.jsx | 2 +- ui/js/component/splash.js | 12 ++++++------ ui/js/component/video/view.jsx | 4 ++-- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/app/locales/en.json b/app/locales/en.json index 6baadaac6..de73a67b1 100644 --- a/app/locales/en.json +++ b/app/locales/en.json @@ -309,5 +309,10 @@ "Wallet": "Wallet", "Looking up version info": "Looking up version info", "It looks like you deleted or moved this file. We're rebuilding it now. It will only take a few seconds.": "It looks like you deleted or moved this file. We're rebuilding it now. It will only take a few seconds.", - "Fetching cost info": "Fetching cost info" -} + "Fetching cost info": "Fetching cost info", + "Testing network": "Testing network", + "Connection Failure": "Connection Failure", + "Try closing all LBRY processes and starting again. If this still happpens, your anti-virus software or firewall may be preventing LBRY from connecting. Contact hello@lbry.io if you think this is a software bug.": "Try closing all LBRY processes and starting again. If this still happpens, your anti-virus software or firewall may be preventing LBRY from connecting. Contact hello@lbry.io if you think this is a software bug.", + "Timed Out": "Timed Out", + "Testing Network": "Testing Network" +} \ No newline at end of file diff --git a/ui/js/component/fileActions/view.jsx b/ui/js/component/fileActions/view.jsx index 445b3b6e7..0a2106b26 100644 --- a/ui/js/component/fileActions/view.jsx +++ b/ui/js/component/fileActions/view.jsx @@ -122,7 +122,7 @@ class FileActions extends React.Component { openModal('confirmRemove')} label={__("Remove...")} /> : '' } + contentLabel={__("Confirm Purchase")} onConfirmed={this.onAffirmPurchase.bind(this)} onAborted={closeModal}> {__("This will purchase")} {title} {__("for")} {__("credits")}. { this.setState({ isLagging: true, - message: "Connection Failure", - details: "Try closing all LBRY processes and starting again. If this still happpens, your anti-virus software or firewall may be preventing LBRY from connecting. Contact hello@lbry.io if you think this is a software bug." + message: __("Connection Failure"), + details: __("Try closing all LBRY processes and starting again. If this still happpens, your anti-virus software or firewall may be preventing LBRY from connecting. Contact hello@lbry.io if you think this is a software bug.") }) }) } diff --git a/ui/js/component/video/view.jsx b/ui/js/component/video/view.jsx index 49de15cbf..b3601a287 100644 --- a/ui/js/component/video/view.jsx +++ b/ui/js/component/video/view.jsx @@ -52,7 +52,7 @@ class VideoPlayButton extends React.Component { className="video__play-button" icon="icon-play" onClick={this.onWatchClick.bind(this)} /> - + {__("You don't have enough LBRY credits to pay for this stream.")} {title} {__("for")} {__("credits")}. + isOpen={modal == 'timedOut'} onConfirmed={closeModal} contentLabel={__("Timed Out")}> {__("Sorry, your download timed out :(")} ); From eb1227fa21c06635e958c833380ef6e4853573b8 Mon Sep 17 00:00:00 2001 From: Mayesters Date: Wed, 31 May 2017 12:59:58 +0200 Subject: [PATCH 038/106] add i18n to README --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 0819f2cbc..c2b0af5a7 100644 --- a/README.md +++ b/README.md @@ -48,3 +48,7 @@ to create distributable packages, which is run by calling: This project has currently only been worked on in Linux and macOS. If you are on Windows, you can checkout out the build steps in [appveyor.yml](https://github.com/lbryio/lbry-app/blob/master/.appveyor.yml) and probably figure out something from there. + +## Internationalization + +If you want to help translating the lbry-app, you can copy the en.json file in /app/locales and modify the values while leaving the keys as their original English strings. An example for this would be: `"Skip": "Ãœberspringen",` Translations should automatically show up in options. \ No newline at end of file From addf29f3bc1bf6cd3d6be8f427dce8d4a7286662 Mon Sep 17 00:00:00 2001 From: Intnick Date: Thu, 1 Jun 2017 17:02:02 +0200 Subject: [PATCH 039/106] global i18n object defined in app.js; smaller translation improvements --- app/locales/en.json | 4 ++-- ui/js/app.js | 9 ++++++++- ui/js/component/app/view.jsx | 2 +- ui/js/component/common.js | 2 +- ui/js/main.js | 6 ------ ui/js/selectors/app.js | 34 ++++++++++++---------------------- 6 files changed, 24 insertions(+), 33 deletions(-) diff --git a/app/locales/en.json b/app/locales/en.json index 6baadaac6..a55aa69e1 100644 --- a/app/locales/en.json +++ b/app/locales/en.json @@ -137,7 +137,8 @@ "You haven't downloaded anything from LBRY yet. Go": "You haven't downloaded anything from LBRY yet. Go", "search for your first download": "search for your first download", "Loading": "Loading", - " credits": " credits", + "credit": "credit", + "credits": "credits", "It looks like you haven't published anything to LBRY yet. Go": "It looks like you haven't published anything to LBRY yet. Go", "share your beautiful cats with the world": "share your beautiful cats with the world", "report": "report", @@ -198,7 +199,6 @@ "Confirm Purchase": "Confirm Purchase", "This will purchase": "This will purchase", "for": "for", - "credits": "credits", "Not enough credits": "Not enough credits", "You don't have enough LBRY credits to pay for this stream.": "You don't have enough LBRY credits to pay for this stream.", "Download failed": "Download failed", diff --git a/ui/js/app.js b/ui/js/app.js index b354036ba..3752f43e5 100644 --- a/ui/js/app.js +++ b/ui/js/app.js @@ -1,4 +1,5 @@ import store from 'store.js'; +import lbry from './lbry.js'; const env = ENV; const config = require(`./config/${env}`); @@ -14,5 +15,11 @@ const app = { } } +const language = lbry.getClientSetting('language') ? lbry.getClientSetting('language') : 'en'; +const i18n = require('y18n')({directory: 'app/locales', locale: language}); +window.__ = i18n.__; +window.__n = i18n.__n; +window.i18n = i18n; + global.app = app; -module.exports = app; \ No newline at end of file +module.exports = app; diff --git a/ui/js/component/app/view.jsx b/ui/js/component/app/view.jsx index 2c13c6328..1c7ff4eb4 100644 --- a/ui/js/component/app/view.jsx +++ b/ui/js/component/app/view.jsx @@ -20,7 +20,7 @@ class App extends React.Component { lbry.balanceSubscribe((balance) => { this.props.updateBalance(balance) }) - }y + } render() { const { diff --git a/ui/js/component/common.js b/ui/js/component/common.js index d864a1c48..cc5578f1a 100644 --- a/ui/js/component/common.js +++ b/ui/js/component/common.js @@ -70,7 +70,7 @@ export class CreditAmount extends React.Component { if (this.props.showFree && parseFloat(formattedAmount) == 0) { amountText = __('free'); } else if (this.props.label) { - amountText = formattedAmount + (parseFloat(formattedAmount) == 1 ? __(' credit') : __(' credits')); + amountText = formattedAmount + ' ' + (parseFloat(formattedAmount) == 1 ? __('credit') : __('credits')); } else { amountText = formattedAmount; } diff --git a/ui/js/main.js b/ui/js/main.js index 957921563..0cad9589c 100644 --- a/ui/js/main.js +++ b/ui/js/main.js @@ -2,12 +2,6 @@ import React from 'react'; import ReactDOM from 'react-dom'; import lbry from './lbry.js'; import lbryio from './lbryio.js'; - -const i18n = require('y18n')({directory: 'app/locales'/*, locale: lbry.getClientSetting('language')*/}); -window.__ = i18n.__; -window.__n = i18n.__n; -window.i18n = i18n; - import lighthouse from './lighthouse.js'; import App from 'component/app/index.js'; import SnackBar from 'component/snackBar'; diff --git a/ui/js/selectors/app.js b/ui/js/selectors/app.js index 1e96d66d0..ad1d50149 100644 --- a/ui/js/selectors/app.js +++ b/ui/js/selectors/app.js @@ -38,36 +38,26 @@ export const selectPageTitle = createSelector( selectCurrentParams, (page, params) => { switch (page) { + case 'settings': + case 'help': + case 'report': + case 'wallet': + case 'send': + case 'receive': + case 'rewards': + case 'start': + case 'publish': + case 'help': + case 'developer': + return __(page.charAt(0).toUpperCase() + page.slice(1)) case 'search': return params.query ? __("Search results for %s", params.query) : __('Search') - case 'settings': - return __('Settings') - case 'help': - return __('Help') - case 'report': - return __('Report') - case 'wallet': - return __("Wallet") - case 'send': - return __("Send") - case 'receive': - return __("Receive") - case 'rewards': - return __("Rewards") case 'show': return lbryuri.normalize(params.uri) case 'downloaded': return __('Downloads & Purchases') case 'published': return __('Publishes') - case 'start': - return __('Start') - case 'publish': - return __('Publish') - case 'help': - return __('Help') - case 'developer': - return __('Developer') case 'discover': return __('Home') default: From c658211e2cac5b3001a2cf69351b363a900b096a Mon Sep 17 00:00:00 2001 From: Mayesters Date: Thu, 1 Jun 2017 17:49:07 +0200 Subject: [PATCH 040/106] merge translations fixed --- app/locales/en.json | 4 +++- ui/js/component/auth.js | 2 +- ui/js/page/help/view.jsx | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/locales/en.json b/app/locales/en.json index 2dd30de19..3587a1417 100644 --- a/app/locales/en.json +++ b/app/locales/en.json @@ -314,5 +314,7 @@ "Connection Failure": "Connection Failure", "Try closing all LBRY processes and starting again. If this still happpens, your anti-virus software or firewall may be preventing LBRY from connecting. Contact hello@lbry.io if you think this is a software bug.": "Try closing all LBRY processes and starting again. If this still happpens, your anti-virus software or firewall may be preventing LBRY from connecting. Contact hello@lbry.io if you think this is a software bug.", "Timed Out": "Timed Out", - "Testing Network": "Testing Network" + "Testing Network": "Testing Network", + "This email is already in use": "This email is already in use", + "Download now!": "Download now!" } \ No newline at end of file diff --git a/ui/js/component/auth.js b/ui/js/component/auth.js index faae3a463..8bea57b38 100644 --- a/ui/js/component/auth.js +++ b/ui/js/component/auth.js @@ -41,7 +41,7 @@ class SubmitEmailStage extends React.Component { lbryio.call('user_email', 'new', {email: this.state.email}, 'post').then(() => { this.onEmailSaved(this.state.email); }, (error) => { - if (error.xhr && (error.xhr.status == 409 || error.message == "This email is already in use")) { + if (error.xhr && (error.xhr.status == 409 || error.message == __("This email is already in use"))) { this.onEmailSaved(this.state.email); return; } else if (this._emailRow) { diff --git a/ui/js/page/help/view.jsx b/ui/js/page/help/view.jsx index d8c818b53..8cca6fc5b 100644 --- a/ui/js/page/help/view.jsx +++ b/ui/js/page/help/view.jsx @@ -99,8 +99,8 @@ class HelpPage extends React.Component {
{ this.state.upgradeAvailable === null ? '' : ( this.state.upgradeAvailable ? -

A newer version of LBRY is available.

- :

Your copy of LBRY is up to date.

)} +

{__("A newer version of LBRY is available.")}

+ :

{__("Your copy of LBRY is up to date.")}

)} { this.state.uiVersion && ver ?
From f84c73801862ee7a0e2ec2243d3935df515e0d82 Mon Sep 17 00:00:00 2001 From: Jeremy Kauffman Date: Fri, 2 Jun 2017 12:40:26 -0400 Subject: [PATCH 041/106] changes to global declaration, eliminate translation files --- app/locales/en.json | 320 ----------------------------------- app/locales/rs.json | 311 ---------------------------------- ui/js/app.js | 5 +- ui/js/component/modal.js | 14 +- ui/js/page/settings/view.jsx | 18 +- 5 files changed, 16 insertions(+), 652 deletions(-) delete mode 100644 app/locales/en.json delete mode 100644 app/locales/rs.json diff --git a/app/locales/en.json b/app/locales/en.json deleted file mode 100644 index 3587a1417..000000000 --- a/app/locales/en.json +++ /dev/null @@ -1,320 +0,0 @@ -{ - "Edit": "Edit", - "Help": "Help", - "Developer": "Developer", - "Reload": "Reload", - "Toggle Developer Tools": "Toggle Developer Tools", - "Inspect Element": "Inspect Element", - "connectionString": "connectionString", - "Method": "Method", - "Parameters": "Parameters", - "Error code": "Error code", - "Error message": "Error message", - "Error data": "Error data", - "Home": "Home", - "Publish": "Publish", - "This LBC remains yours and the deposit can be undone at any time.": "This LBC remains yours and the deposit can be undone at any time.", - "Content": "Content", - "What are you publishing?": "What are you publishing?", - "Access": "Access", - "Select a URL for this publish.": "Select a URL for this publish.", - "How much does this content cost?": "How much does this content cost?", - "Price": "Price", - "Free": "Free", - "Choose price...": "Choose price...", - "US Dollars": "US Dollars", - "LBRY credits": "LBRY credits", - "Public Domain": "Public Domain", - "Creative Commons Attribution 4.0 International": "Creative Commons Attribution 4.0 International", - "Creative Commons Attribution-ShareAlike 4.0 International": "Creative Commons Attribution-ShareAlike 4.0 International", - "Creative Commons Attribution-NoDerivatives 4.0 International": "Creative Commons Attribution-NoDerivatives 4.0 International", - "Creative Commons Attribution-NonCommercial 4.0 International": "Creative Commons Attribution-NonCommercial 4.0 International", - "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International", - "Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International": "Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International", - "Copyrighted...": "Copyrighted...", - "Other...": "Other...", - "Identity": "Identity", - "Who created this content?": "Who created this content?", - "Anonymous": "Anonymous", - "New identity...": "New identity...", - "Address": "Address", - "Where should this content permanently reside?": "Where should this content permanently reside?", - "Read more": "Read more", - "Terms of Service": "Terms of Service", - "Deposit": "Deposit", - "This URL is unused.": "This URL is unused.", - "LBRY names must contain only letters, numbers and dashes.": "LBRY names must contain only letters, numbers and dashes.", - "Title": "Title", - "Thumbnail URL": "Thumbnail URL", - "Description": "Description", - "Description of your content": "Description of your content", - "Language": "Language", - "English": "English", - "Chinese": "Chinese", - "French": "French", - "German": "German", - "Japanese": "Japanese", - "Russian": "Russian", - "Spanish": "Spanish", - "Maturity": "Maturity", - "All Ages": "All Ages", - "Adults Only": "Adults Only", - "Cancel": "Cancel", - "File published": "File published", - "I agree to the": "I agree to the", - "LBRY terms of service": "LBRY terms of service", - "Your file has been published to LBRY at the address": "Your file has been published to LBRY at the address", - "The file will take a few minutes to appear for other LBRY users. Until then it will be listed as \"pending\" under your published files.": "The file will take a few minutes to appear for other LBRY users. Until then it will be listed as \"pending\" under your published files.", - "Error publishing file": "Error publishing file", - "The following error occurred when attempting to publish your file": "The following error occurred when attempting to publish your file", - "A deposit of at least \"%s\" credit is required to win \"%s\". However, you can still get a permanent URL for any amount.": { - "one": "A deposit of at least \"%s\" credit is required to win \"%s\". However, you can still get a permanent URL for any amount.", - "other": "A deposit of at least \"%s\" credits is required to win \"%s\". However, you can still get a permanent URL for any amount." - }, - "Connecting": "Connecting", - "Discover": "Discover", - "Fetching content": "Fetching content", - "What's this?": "What's this?", - "Community Content is a public space where anyone can share content with the rest of the LBRY community. Bid on the names \"one,\" \"two,\" \"three,\" \"four\" and \"five\" to put your content here!": "Community Content is a public space where anyone can share content with the rest of the LBRY community. Bid on the names \"one,\" \"two,\" \"three,\" \"four\" and \"five\" to put your content here!", - "LBRY is Closed": "LBRY is Closed", - "Click here to start LBRY": "Click here to start LBRY", - "Failed to load landing content.": "Failed to load landing content.", - "Settings": "Settings", - "Welcome to LBRY": "Welcome to LBRY", - "Downloads & Purchases": "Downloads & Purchases", - "Downloaded": "Downloaded", - "Published": "Published", - "Publishes": "Publishes", - "Overview": "Overview", - "Send": "Send", - "Receive": "Receive", - "Rewards": "Rewards", - "Search results for %s": "Search results for %s", - "Search": "Search", - "Your email is still not verified.": "Your email is still not verified.", - "Next": "Next", - "Email": "Email", - "Verification Code": "Verification Code", - "A verification code is required to access this version.": "A verification code is required to access this version.", - "Verify": "Verify", - "No code?": "No code?", - "Click here": "Click here", - "Authentication": "Authentication", - "LBRY Early Access": "LBRY Early Access", - "Preparing for first access": "Preparing for first access", - "Welcome to LBRY.": "Welcome to LBRY.", - "Using LBRY is like dating a centaur. Totally normal up top, and way different underneath.": "Using LBRY is like dating a centaur. Totally normal up top, and way different underneath.", - "Up top, LBRY is similar to popular media sites.": "Up top, LBRY is similar to popular media sites.", - "Below, LBRY is controlled by users -- you -- via blockchain and decentralization.": "Below, LBRY is controlled by users -- you -- via blockchain and decentralization.", - "Thank you for making content freedom possible! Here's a nickel, kid.": "Thank you for making content freedom possible! Here's a nickel, kid.", - "Developer Settings": "Developer Settings", - "Show developer menu": "Show developer menu", - "Use custom search servers": "Use custom search servers", - "Custom search servers (one per line)": "Custom search servers (one per line)", - "Force Upgrade": "Force Upgrade", - "OK": "OK", - "Show More...": "Show More...", - "Show Less": "Show Less", - "Starting daemon": "Starting daemon", - "Waiting for name resolution": "Waiting for name resolution", - "Using LBRY is like dating a centaur. Totally normal up top, and way different underneath.": "Using LBRY is like dating a centaur. Totally normal up top, and way different underneath.", - "Claim Reward": "Claim Reward", - "Claiming...": "Claiming...", - "This is an estimate and does not include data fees": "This is an estimate and does not include data fees", - "free": "free", - "Reward Claim Error": "Reward Claim Error", - "This field is required": "This field is required", - "Choose File": "Choose File", - "No File Chosen": "No File Chosen", - "Choose Directory": "Choose Directory", - "Downloading Update": "Downloading Update", - "Click \"Begin Upgrade\" to start the upgrade process.": "Click \"Begin Upgrade\" to start the upgrade process.", - "The app will close, and you will be prompted to install the latest version of LBRY.": "The app will close, and you will be prompted to install the latest version of LBRY.", - "After the install is complete, please reopen the app.": "After the install is complete, please reopen the app.", - "Begin Upgrade": "Begin Upgrade", - "API connection string": "API connection string", - "We're sorry that LBRY has encountered an error. This has been reported and we will investigate the problem.": "We're sorry that LBRY has encountered an error. This has been reported and we will investigate the problem.", - "You haven't downloaded anything from LBRY yet. Go": "You haven't downloaded anything from LBRY yet. Go", - "search for your first download": "search for your first download", - "Loading": "Loading", - "credit": "credit", - "credits": "credits", - "It looks like you haven't published anything to LBRY yet. Go": "It looks like you haven't published anything to LBRY yet. Go", - "share your beautiful cats with the world": "share your beautiful cats with the world", - "report": "report", - "Content-Type": "Content-Type", - "Author": "Author", - "License": "License", - "Read the FAQ": "Read the FAQ", - "Our FAQ answers many common questions.": "Our FAQ answers many common questions.", - "Get Live Help": "Get Live Help", - "Live help is available most hours in the": "Live help is available most hours in the", - "channel of our Slack chat room.": "channel of our Slack chat room.", - "Join Our Slack": "Join Our Slack", - "Report a Bug": "Report a Bug", - "Did you find something wrong?": "Did you find something wrong?", - "Submit a Bug Report": "Submit a Bug Report", - "Thanks! LBRY is made by its users.": "Thanks! LBRY is made by its users.", - "Report": "Report", - "About": "About", - "A newer version of LBRY is available.": "A newer version of LBRY is available.", - "Download LBRY %s now!": "Download LBRY %s now!", - "Your copy of LBRY is up to date.": "Your copy of LBRY is up to date.", - "daemon (lbrynet)": "daemon (lbrynet)", - "wallet (lbryum)": "wallet (lbryum)", - "interface": "interface", - "Platform": "Platform", - "Installation ID": "Installation ID", - "Search Results for": "Search Results for", - "These search results are provided by LBRY, Inc.": "These search results are provided by LBRY, Inc.", - "Exact URL": "Exact URL", - "This is the resolution of a LBRY URL and not controlled by LBRY Inc.": "This is the resolution of a LBRY URL and not controlled by LBRY Inc.", - "Download Directory": "Download Directory", - "LBRY downloads will be saved here.": "LBRY downloads will be saved here.", - "Bandwidth Limits": "Bandwidth Limits", - "Max Upload": "Max Upload", - "Unlimited": "Unlimited", - "Up to": "Up to", - "Max Download": "Max Download", - "Show unavailable content in search results": "Show unavailable content in search results", - "Show NSFW content": "Show NSFW content", - "NSFW content may include nudity, intense sexuality, profanity, or other adult content. By displaying NSFW content, you are affirming you are of legal age to view mature content in your country or jurisdiction. ": "NSFW content may include nudity, intense sexuality, profanity, or other adult content. By displaying NSFW content, you are affirming you are of legal age to view mature content in your country or jurisdiction. ", - "Share Diagnostic Data": "Share Diagnostic Data", - "Help make LBRY better by contributing diagnostic data about my usage": "Help make LBRY better by contributing diagnostic data about my usage", - "Choose limit...": "Choose limit...", - "Loading magic decentralized data...": "Loading magic decentralized data...", - "There's nothing at this location.": "There's nothing at this location.", - "Report an Issue": "Report an Issue", - "Please describe the problem you experienced and any information you think might be useful to us. Links to screenshots are great!": "Please describe the problem you experienced and any information you think might be useful to us. Links to screenshots are great!", - "Description of your issue": "Description of your issue", - "Submit Report": "Submit Report", - "Developer?": "Developer?", - "You can also": "You can also", - "submit an issue on GitHub": "submit an issue on GitHub", - "Bug report submitted": "Bug report submitted", - "Your bug report has been submitted! Thank you for your feedback.": "Your bug report has been submitted! Thank you for your feedback.", - "Balance": "Balance", - "Open in Folder": "Open in Folder", - "Checking availability": "Checking availability", - "Confirm Purchase": "Confirm Purchase", - "This will purchase": "This will purchase", - "for": "for", - "Not enough credits": "Not enough credits", - "You don't have enough LBRY credits to pay for this stream.": "You don't have enough LBRY credits to pay for this stream.", - "Download failed": "Download failed", - "LBRY was unable to download the stream": "LBRY was unable to download the stream", - "Remove": "Remove", - "Are you sure you'd like to remove": "Are you sure you'd like to remove", - "from LBRY?": "from LBRY?", - "Delete this file from my computer": "Delete this file from my computer", - "Download": "Download", - "Content unavailable.": "Content unavailable.", - "Why?": "Why?", - "The content on LBRY is hosted by its users. It appears there are no users connected that have this file at the moment.": "The content on LBRY is hosted by its users. It appears there are no users connected that have this file at the moment.", - "Try Anyway": "Try Anyway", - "Open": "Open", - "Remove...": "Remove...", - "% complete": "% complete", - "Loading...": "Loading...", - "Empty claim or metadata info.": "Empty claim or metadata info.", - "This content is Not Safe For Work. To view adult content, please change your": "This content is Not Safe For Work. To view adult content, please change your", - "This address contains no content.": "This address contains no content.", - "Sort by": "Sort by", - "Date": "Date", - "File name": "File name", - "Looking up the Dewey Decimals": "Looking up the Dewey Decimals", - "No one has checked anything in for %s yet.": "No one has checked anything in for %s yet.", - "Be the first": "Be the first", - "Refreshing the Dewey Decimals": "Refreshing the Dewey Decimals", - "This location is unused.": "This location is unused.", - "Put something here!": "Put something here!", - "Transaction History": "Transaction History", - "You have no transactions.": "You have no transactions.", - "Loading transactions": "Loading transactions", - "Amount": "Amount", - "Time": "Time", - "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", - "Wallet": "Wallet", - "Looking up version info": "Looking up version info", - "It looks like you deleted or moved this file. We're rebuilding it now. It will only take a few seconds.": "It looks like you deleted or moved this file. We're rebuilding it now. It will only take a few seconds.", - "Fetching cost info": "Fetching cost info", - "Testing network": "Testing network", - "Connection Failure": "Connection Failure", - "Try closing all LBRY processes and starting again. If this still happpens, your anti-virus software or firewall may be preventing LBRY from connecting. Contact hello@lbry.io if you think this is a software bug.": "Try closing all LBRY processes and starting again. If this still happpens, your anti-virus software or firewall may be preventing LBRY from connecting. Contact hello@lbry.io if you think this is a software bug.", - "Timed Out": "Timed Out", - "Testing Network": "Testing Network", - "This email is already in use": "This email is already in use", - "Download now!": "Download now!" -} \ No newline at end of file diff --git a/app/locales/rs.json b/app/locales/rs.json deleted file mode 100644 index ebac8ca19..000000000 --- a/app/locales/rs.json +++ /dev/null @@ -1,311 +0,0 @@ -{ - "Edit": "RS_Edit", - "Help": "RS_Help", - "Developer": "RS_Developer", - "Reload": "RS_Reload", - "Toggle Developer Tools": "RS_Toggle Developer Tools", - "Inspect Element": "RS_Inspect Element", - "connectionString": "RS_connectionString", - "Method": "RS_Method", - "Parameters": "RS_Parameters", - "Error code": "RS_Error code", - "Error message": "RS_Error message", - "Error data": "RS_Error data", - "Home": "RS_Home", - "Publish": "RS_Publish", - "This LBC remains yours and the deposit can be undone at any time.": "RS_This LBC remains yours and the deposit can be undone at any time.", - "Content": "RS_Content", - "What are you publishing?": "RS_What are you publishing?", - "Access": "RS_Access", - "Select a URL for this publish.": "RS_Select a URL for this publish.", - "How much does this content cost?": "RS_How much does this content cost?", - "Price": "RS_Price", - "Free": "RS_Free", - "Choose price...": "RS_Choose price...", - "US Dollars": "RS_US Dollars", - "LBRY credits": "RS_LBRY credits", - "Public Domain": "RS_Public Domain", - "Creative Commons Attribution 4.0 International": "RS_Creative Commons Attribution 4.0 International", - "Creative Commons Attribution-ShareAlike 4.0 International": "RS_Creative Commons Attribution-ShareAlike 4.0 International", - "Creative Commons Attribution-NoDerivatives 4.0 International": "RS_Creative Commons Attribution-NoDerivatives 4.0 International", - "Creative Commons Attribution-NonCommercial 4.0 International": "RS_Creative Commons Attribution-NonCommercial 4.0 International", - "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International": "RS_Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International", - "Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International": "RS_Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International", - "Copyrighted...": "RS_Copyrighted...", - "Other...": "RS_Other...", - "Identity": "RS_Identity", - "Who created this content?": "RS_Who created this content?", - "Anonymous": "RS_Anonymous", - "New identity...": "RS_New identity...", - "Address": "RS_Address", - "Where should this content permanently reside?": "RS_Where should this content permanently reside?", - "Read more": "RS_Read more", - "Terms of Service": "RS_Terms of Service", - "Deposit": "RS_Deposit", - "This URL is unused.": "RS_This URL is unused.", - "LBRY names must contain only letters, numbers and dashes.": "RS_LBRY names must contain only letters, numbers and dashes.", - "Title": "RS_Title", - "Thumbnail URL": "RS_Thumbnail URL", - "Description": "RS_Description", - "Description of your content": "RS_Description of your content", - "Language": "RS_Language", - "English": "RS_English", - "Chinese": "RS_Chinese", - "French": "RS_French", - "German": "RS_German", - "Japanese": "RS_Japanese", - "Russian": "RS_Russian", - "Spanish": "RS_Spanish", - "Maturity": "RS_Maturity", - "All Ages": "RS_All Ages", - "Adults Only": "RS_Adults Only", - "Cancel": "RS_Cancel", - "File published": "RS_File published", - "I agree to the": "RS_I agree to the", - "LBRY terms of service": "RS_LBRY terms of service", - "Your file has been published to LBRY at the address": "RS_Your file has been published to LBRY at the address", - "The file will take a few minutes to appear for other LBRY users. Until then it will be listed as \"pending\" under your published files.": "RS_The file will take a few minutes to appear for other LBRY users. Until then it will be listed as \"pending\" under your published files.", - "Error publishing file": "RS_Error publishing file", - "The following error occurred when attempting to publish your file": "RS_The following error occurred when attempting to publish your file", - "A deposit of at least \"%s\" credit is required to win \"%s\". However, you can still get a permanent URL for any amount.": { - "one": "RS_A deposit of at least \"%s\" credit is required to win \"%s\". However, you can still get a permanent URL for any amount.", - "other": "RS_A deposit of at least \"%s\" credits is required to win \"%s\". However, you can still get a permanent URL for any amount." - }, - "Connecting": "RS_Connecting", - "Discover": "RS_Discover", - "Fetching content": "RS_Fetching content", - "What's this?": "RS_What's this?", - "Community Content is a public space where anyone can share content with the rest of the LBRY community. Bid on the names \"one,\" \"two,\" \"three,\" \"four\" and \"five\" to put your content here!": "RS_Community Content is a public space where anyone can share content with the rest of the LBRY community. Bid on the names \"one,\" \"two,\" \"three,\" \"four\" and \"five\" to put your content here!", - "LBRY is Closed": "RS_LBRY is Closed", - "Click here to start LBRY": "RS_Click here to start LBRY", - "Failed to load landing content.": "RS_Failed to load landing content.", - "Settings": "RS_Settings", - "Welcome to LBRY": "RS_Welcome to LBRY", - "Downloads & Purchases": "RS_Downloads & Purchases", - "Downloaded": "RS_Downloaded", - "Published": "RS_Published", - "Publishes": "RS_Publishes", - "Overview": "RS_Overview", - "Send": "RS_Send", - "Receive": "RS_Receive", - "Rewards": "RS_Rewards", - "Search results for %s": "RS_Search results for %s", - "Search": "RS_Search", - "Your email is still not verified.": "RS_Your email is still not verified.", - "Next": "RS_Next", - "Email": "RS_Email", - "Verification Code": "RS_Verification Code", - "A verification code is required to access this version.": "RS_A verification code is required to access this version.", - "Verify": "RS_Verify", - "No code?": "RS_No code?", - "Click here": "RS_Click here", - "Authentication": "RS_Authentication", - "LBRY Early Access": "RS_LBRY Early Access", - "Preparing for first access": "RS_Preparing for first access", - "Welcome to LBRY.": "RS_Welcome to LBRY.", - "Using LBRY is like dating a centaur. Totally normal up top, and way different underneath.": "RS_Using LBRY is like dating a centaur. Totally normal up top, and way different underneath.", - "Up top, LBRY is similar to popular media sites.": "RS_Up top, LBRY is similar to popular media sites.", - "Below, LBRY is controlled by users -- you -- via blockchain and decentralization.": "RS_Below, LBRY is controlled by users -- you -- via blockchain and decentralization.", - "Thank you for making content freedom possible! Here's a nickel, kid.": "RS_Thank you for making content freedom possible! Here's a nickel, kid.", - "Developer Settings": "RS_Developer Settings", - "Show developer menu": "RS_Show developer menu", - "Use custom search servers": "RS_Use custom search servers", - "Custom search servers (one per line)": "RS_Custom search servers (one per line)", - "Force Upgrade": "RS_Force Upgrade", - "OK": "RS_OK", - "Show More...": "RS_Show More...", - "Show Less": "RS_Show Less", - "Starting daemon": "RS_Starting daemon", - "Waiting for name resolution": "RS_Waiting for name resolution", - "Using LBRY is like dating a centaur. Totally normal up top, and way different underneath.": "RS_Using LBRY is like dating a centaur. Totally normal up top, and way different underneath.", - "Claim Reward": "RS_Claim Reward", - "Claiming...": "RS_Claiming...", - "This is an estimate and does not include data fees": "RS_This is an estimate and does not include data fees", - "free": "RS_free", - "Reward Claim Error": "RS_Reward Claim Error", - "This field is required": "RS_This field is required", - "Choose File": "RS_Choose File", - "No File Chosen": "RS_No File Chosen", - "Choose Directory": "RS_Choose Directory", - "Downloading Update": "RS_Downloading Update", - "Click \"Begin Upgrade\" to start the upgrade process.": "RS_Click \"Begin Upgrade\" to start the upgrade process.", - "The app will close, and you will be prompted to install the latest version of LBRY.": "RS_The app will close, and you will be prompted to install the latest version of LBRY.", - "After the install is complete, please reopen the app.": "RS_After the install is complete, please reopen the app.", - "Begin Upgrade": "RS_Begin Upgrade", - "API connection string": "RS_API connection string", - "We're sorry that LBRY has encountered an error. This has been reported and we will investigate the problem.": "RS_We're sorry that LBRY has encountered an error. This has been reported and we will investigate the problem.", - "You haven't downloaded anything from LBRY yet. Go": "RS_You haven't downloaded anything from LBRY yet. Go", - "search for your first download": "RS_search for your first download", - "Loading": "RS_Loading", - " credits": "RS_ credits", - "It looks like you haven't published anything to LBRY yet. Go": "RS_It looks like you haven't published anything to LBRY yet. Go", - "share your beautiful cats with the world": "RS_share your beautiful cats with the world", - "report": "RS_report", - "Content-Type": "RS_Content-Type", - "Author": "RS_Author", - "License": "RS_License", - "Read the FAQ": "RS_Read the FAQ", - "Our FAQ answers many common questions.": "RS_Our FAQ answers many common questions.", - "Get Live Help": "RS_Get Live Help", - "Live help is available most hours in the": "RS_Live help is available most hours in the", - "channel of our Slack chat room.": "RS_channel of our Slack chat room.", - "Join Our Slack": "RS_Join Our Slack", - "Report a Bug": "RS_Report a Bug", - "Did you find something wrong?": "RS_Did you find something wrong?", - "Submit a Bug Report": "RS_Submit a Bug Report", - "Thanks! LBRY is made by its users.": "RS_Thanks! LBRY is made by its users.", - "Report": "RS_Report", - "About": "RS_About", - "A newer version of LBRY is available.": "RS_A newer version of LBRY is available.", - "Download LBRY %s now!": "RS_Download LBRY %s now!", - "Your copy of LBRY is up to date.": "RS_Your copy of LBRY is up to date.", - "daemon (lbrynet)": "RS_daemon (lbrynet)", - "wallet (lbryum)": "RS_wallet (lbryum)", - "interface": "RS_interface", - "Platform": "RS_Platform", - "Installation ID": "RS_Installation ID", - "Search Results for": "RS_Search Results for", - "These search results are provided by LBRY, Inc.": "RS_These search results are provided by LBRY, Inc.", - "Exact URL": "RS_Exact URL", - "This is the resolution of a LBRY URL and not controlled by LBRY Inc.": "RS_This is the resolution of a LBRY URL and not controlled by LBRY Inc.", - "Download Directory": "RS_Download Directory", - "LBRY downloads will be saved here.": "RS_LBRY downloads will be saved here.", - "Bandwidth Limits": "RS_Bandwidth Limits", - "Max Upload": "RS_Max Upload", - "Unlimited": "RS_Unlimited", - "Up to": "RS_Up to", - "Max Download": "RS_Max Download", - "Show unavailable content in search results": "RS_Show unavailable content in search results", - "Show NSFW content": "RS_Show NSFW content", - "NSFW content may include nudity, intense sexuality, profanity, or other adult content. By displaying NSFW content, you are affirming you are of legal age to view mature content in your country or jurisdiction. ": "RS_NSFW content may include nudity, intense sexuality, profanity, or other adult content. By displaying NSFW content, you are affirming you are of legal age to view mature content in your country or jurisdiction. ", - "Share Diagnostic Data": "RS_Share Diagnostic Data", - "Help make LBRY better by contributing diagnostic data about my usage": "RS_Help make LBRY better by contributing diagnostic data about my usage", - "Choose limit...": "RS_Choose limit...", - "Loading magic decentralized data...": "RS_Loading magic decentralized data...", - "There's nothing at this location.": "RS_There's nothing at this location.", - "Report an Issue": "RS_Report an Issue", - "Please describe the problem you experienced and any information you think might be useful to us. Links to screenshots are great!": "RS_Please describe the problem you experienced and any information you think might be useful to us. Links to screenshots are great!", - "Description of your issue": "RS_Description of your issue", - "Submit Report": "RS_Submit Report", - "Developer?": "RS_Developer?", - "You can also": "RS_You can also", - "submit an issue on GitHub": "RS_submit an issue on GitHub", - "Bug report submitted": "RS_Bug report submitted", - "Your bug report has been submitted! Thank you for your feedback.": "RS_Your bug report has been submitted! Thank you for your feedback.", - "Balance": "RS_Balance", - "Open in Folder": "RS_Open in Folder", - "Checking availability": "RS_Checking availability", - "Confirm Purchase": "RS_Confirm Purchase", - "This will purchase": "RS_This will purchase", - "for": "RS_for", - "credits": "RS_credits", - "Not enough credits": "RS_Not enough credits", - "You don't have enough LBRY credits to pay for this stream.": "RS_You don't have enough LBRY credits to pay for this stream.", - "Download failed": "RS_Download failed", - "LBRY was unable to download the stream": "RS_LBRY was unable to download the stream", - "Remove": "RS_Remove", - "Are you sure you'd like to remove": "RS_Are you sure you'd like to remove", - "from LBRY?": "RS_from LBRY?", - "Delete this file from my computer": "RS_Delete this file from my computer", - "Download": "RS_Download", - "Content unavailable.": "RS_Content unavailable.", - "Why?": "RS_Why?", - "The content on LBRY is hosted by its users. It appears there are no users connected that have this file at the moment.": "RS_The content on LBRY is hosted by its users. It appears there are no users connected that have this file at the moment.", - "Try Anyway": "RS_Try Anyway", - "Open": "RS_Open", - "Remove...": "RS_Remove...", - "% complete": "RS_% complete", - "Loading...": "RS_Loading...", - "Empty claim or metadata info.": "RS_Empty claim or metadata info.", - "This content is Not Safe For Work. To view adult content, please change your": "RS_This content is Not Safe For Work. To view adult content, please change your", - "This address contains no content.": "RS_This address contains no content.", - "Sort by": "RS_Sort by", - "Date": "RS_Date", - "File name": "RS_File name", - "Looking up the Dewey Decimals": "RS_Looking up the Dewey Decimals", - "No one has checked anything in for %s yet.": "RS_No one has checked anything in for %s yet.", - "Be the first": "RS_Be the first", - "Refreshing the Dewey Decimals": "RS_Refreshing the Dewey Decimals", - "This location is unused.": "RS_This location is unused.", - "Put something here!": "RS_Put something here!", - "Transaction History": "RS_Transaction History", - "You have no transactions.": "RS_You have no transactions.", - "Loading transactions": "RS_Loading transactions", - "Amount": "RS_Amount", - "Time": "RS_Time", - "Transaction": "RS_Transaction", - "You earned %s for registering as a new developer.": "RS_You earned %s for registering as a new developer.", - "You earned %s LBC new user reward.": "RS_You earned %s LBC new user reward.", - "You earned %s LBC for verifying your email address.": "RS_You earned %s LBC for verifying your email address.", - "You earned %s LBC for creating a publisher identity.": "RS_You earned %s LBC for creating a publisher identity.", - "You earned %s LBC for streaming your first video.": "RS_You earned %s LBC for streaming your first video.", - "You earned %s LBC for downloading some of the things.": "RS_You earned %s LBC for downloading some of the things.", - "You earned %s LBC for making your first publication.": "RS_You earned %s LBC for making your first publication.", - "Your First Nickel": "RS_Your First Nickel", - "First Publish": "RS_First Publish", - "We're Going Streaming": "RS_We're Going Streaming", - "Channel Surfing": "RS_Channel Surfing", - "Many Views": "RS_Many Views", - "Hot Right Now": "RS_Hot Right Now", - "A welcome bonus for being at the vanguard of content freedom.": "RS_A welcome bonus for being at the vanguard of content freedom.", - "The first view is on us.": "RS_The first view is on us.", - "Up the quad, and to the gymanasium. Press play. Everybody's doing it.": "RS_Up the quad, and to the gymanasium. Press play. Everybody's doing it.", - "Claim your channel! Create an identity used to securely publish content.": "RS_Claim your channel! Create an identity used to securely publish content.", - "Watch a bunch of stuff... who knows how much?": "RS_Watch a bunch of stuff... who knows how much?", - "Watch the latest featured content.": "RS_Watch the latest featured content.", - "Rewards are not enabled.": "RS_Rewards are not enabled.", - "Failed to load rewards.": "RS_Failed to load rewards.", - "Reward claimed.": "RS_Reward claimed.", - "Show All": "RS_Show All", - "Please create a channel identity first.": "RS_Please create a channel identity first.", - "Please publish something and wait for confirmation by the network to claim this reward.": "RS_Please publish something and wait for confirmation by the network to claim this reward.", - "Please publish something to claim this reward.": "RS_Please publish something to claim this reward.", - "Could not connect to Lighthouse server. Last server attempted: %s": "RS_Could not connect to Lighthouse server. Last server attempted: %s", - "LBRY URIs must include a protocol prefix (lbry://).": "RS_LBRY URIs must include a protocol prefix (lbry://).", - "URI does not include name.": "RS_URI does not include name.", - "No channel name after @.": "RS_No channel name after @.", - "Channel names must be at least %s characters.": "RS_Channel names must be at least %s characters.", - "Invalid character %s in name: %s.": "RS_Invalid character %s in name: %s.", - "No modifier provided after separator %s.": "RS_No modifier provided after separator %s.", - "Invalid claim ID %s.": "RS_Invalid claim ID %s.", - "Claim sequence must be a number.": "RS_Claim sequence must be a number.", - "Bid position must be a number.": "RS_Bid position must be a number.", - "Only channel URIs may have a path.": "RS_Only channel URIs may have a path.", - "Invalid character %s in path: %s": "RS_Invalid character %s in path: %s", - "No path provided after /": "RS_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.": "RS_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.": "RS_Path and contentName do not match. Only one is required; most likely you wanted contentName.", - "Internal API disabled": "RS_Internal API disabled", - "LBRY internal API is disabled": "RS_LBRY internal API is disabled", - "Something went wrong making an internal API call.": "RS_Something went wrong making an internal API call.", - "XMLHttpRequest connection timed out": "RS_XMLHttpRequest connection timed out", - "Invalid method": "RS_Invalid method", - "Received invalid authentication response.": "RS_Received invalid authentication response.", - "Unable to connect to LBRY": "RS_Unable to connect to LBRY", - "Resolve has hacked cache on top of it that requires a URI": "RS_Resolve has hacked cache on top of it that requires a URI", - "Connection to API server failed": "RS_Connection to API server failed", - "Please select a file to upgrade from": "RS_Please select a file to upgrade from", - "Update available": "RS_Update available", - "Upgrade": "RS_Upgrade", - "Skip": "RS_Skip", - "Your version of LBRY is out of date and may be unreliable or insecure.": "RS_Your version of LBRY is out of date and may be unreliable or insecure.", - "Sorry, your download timed out :(": "RS_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": "RS_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!": "RS_Downloading stream... not long left now!", - "this is the world's worst loading screen and we shipped our software with it anyway...": "RS_this is the world's worst loading screen and we shipped our software with it anyway...", - "Wallet Address": "RS_Wallet Address", - "Get New Address": "RS_Get New Address", - "Other LBRY users may send credits to you by entering this address on the \"Send\" page.": "RS_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.": "RS_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": "RS_Send Credits", - "Recipient Address": "RS_Recipient Address", - "Insufficient balance": "RS_Insufficient balance", - "Insufficient balance: after this transaction you would have less than 1 LBC in your wallet.": "RS_Insufficient balance: after this transaction you would have less than 1 LBC in your wallet.", - "Transaction successful": "RS_Transaction successful", - "Your transaction was successfully placed in the queue.": "RS_Your transaction was successfully placed in the queue.", - "Transaction failed": "RS_Transaction failed", - "Something went wrong": "RS_Something went wrong", - "Find movies, music, games, and more": "RS_Find movies, music, games, and more", - "Wallet": "RS_Wallet", - "Looking up version info": "RS_Looking up version info" -} diff --git a/ui/js/app.js b/ui/js/app.js index 3752f43e5..987b112c8 100644 --- a/ui/js/app.js +++ b/ui/js/app.js @@ -3,11 +3,13 @@ import lbry from './lbry.js'; const env = ENV; const config = require(`./config/${env}`); +const i18n = require('y18n') const logs = []; const app = { env: env, config: config, store: store, + i18n: i18n, logs: logs, log: function(message) { console.log(message); @@ -15,11 +17,8 @@ const app = { } } -const language = lbry.getClientSetting('language') ? lbry.getClientSetting('language') : 'en'; -const i18n = require('y18n')({directory: 'app/locales', locale: language}); window.__ = i18n.__; window.__n = i18n.__n; -window.i18n = i18n; global.app = app; module.exports = app; diff --git a/ui/js/component/modal.js b/ui/js/component/modal.js index 89598e9e8..8ee2a54ca 100644 --- a/ui/js/component/modal.js +++ b/ui/js/component/modal.js @@ -2,10 +2,6 @@ import React from 'react'; import ReactModal from 'react-modal'; import Link from 'component/link'; -const i18n = require('y18n')({directory: 'app/locales'}); - - - export class Modal extends React.Component { static propTypes = { type: React.PropTypes.oneOf(['alert', 'confirm', 'custom']), @@ -21,8 +17,8 @@ export class Modal extends React.Component { static defaultProps = { type: 'alert', overlay: true, - confirmButtonLabel: i18n.__('OK'), - abortButtonLabel: i18n.__('Cancel'), + confirmButtonLabel: __('OK'), + abortButtonLabel: __('Cancel'), confirmButtonDisabled: false, abortButtonDisabled: false, } @@ -55,9 +51,9 @@ export class ExpandableModal extends React.Component { } static defaultProps = { - confirmButtonLabel: i18n.__('OK'), - expandButtonLabel: i18n.__('Show More...'), - hideButtonLabel: i18n.__('Show Less'), + confirmButtonLabel: __('OK'), + expandButtonLabel: __('Show More...'), + hideButtonLabel: __('Show Less'), } constructor(props) { diff --git a/ui/js/page/settings/view.jsx b/ui/js/page/settings/view.jsx index 973f4d75a..7450745fa 100644 --- a/ui/js/page/settings/view.jsx +++ b/ui/js/page/settings/view.jsx @@ -7,7 +7,7 @@ import lbry from 'lbry.js'; class SettingsPage extends React.Component { constructor(props) { super(props); - + const daemonSettings = this.props.daemonSettings this.state = { @@ -70,11 +70,11 @@ class SettingsPage extends React.Component { lbry.setClientSetting('showNsfw', event.target.checked); } - onLanguageChange(language) { - lbry.setClientSetting('language', language); - i18n.setLocale(language); - this.setState({language: language}) - } + // onLanguageChange(language) { + // lbry.setClientSetting('language', language); + // i18n.setLocale(language); + // this.setState({language: language}) + // } onShowUnavailableChange(event) { @@ -193,8 +193,8 @@ class SettingsPage extends React.Component { helper={__("NSFW content may include nudity, intense sexuality, profanity, or other adult content. By displaying NSFW content, you are affirming you are of legal age to view mature content in your country or jurisdiction. ")} /> - - + + /*

{__("Language")}

@@ -215,7 +215,7 @@ class SettingsPage extends React.Component { defaultChecked={this.state.language=='rs'} />
-
+ */
From 1fd1b3c06481557aef3f6123b58c14845b088d1d Mon Sep 17 00:00:00 2001 From: 6ea86b96 <6ea86b96@gmail.com> Date: Sat, 3 Jun 2017 00:54:11 +0700 Subject: [PATCH 042/106] Render all file types that render-media can handle --- ui/js/component/video/view.jsx | 6 ++++-- ui/js/page/filePage/view.jsx | 5 ++++- ui/scss/page/_show.scss | 5 +++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ui/js/component/video/view.jsx b/ui/js/component/video/view.jsx index 09ca9a5ac..247be7740 100644 --- a/ui/js/component/video/view.jsx +++ b/ui/js/component/video/view.jsx @@ -49,7 +49,7 @@ class VideoPlayButton extends React.Component { */ const disabled = isLoading || fileInfo === undefined || (fileInfo === null && (!costInfo || costInfo.cost === undefined)) - const icon = mediaType == "image" ? "icon-folder-o" : "icon-play" + const icon = ["audio", "video"].indexOf(mediaType) !== -1 ? "icon-play" : "icon-folder-o" return (
- {mediaType === "audio" && } + {["audio", "application"].indexOf(mediaType) !== -1 && }
) diff --git a/ui/js/page/filePage/view.jsx b/ui/js/page/filePage/view.jsx index b1e031df7..cdee31c35 100644 --- a/ui/js/page/filePage/view.jsx +++ b/ui/js/page/filePage/view.jsx @@ -93,11 +93,14 @@ class FilePage extends React.Component{ const channelUri = signatureIsValid && hasSignature && channelName ? lbryuri.build({channelName, claimId: channelClaimId}, false) : null const uriIndicator = const mediaType = lbry.getMediaType(contentType) + const player = require('render-media') + const isPlayable = Object.values(player.mime).indexOf(contentType) !== -1 || + mediaType === "audio" return (
- { ["video", "audio", "image"].indexOf(mediaType) !== -1 ? + { isPlayable ?
diff --git a/ui/scss/page/_show.scss b/ui/scss/page/_show.scss index 48b82d065..0dbfea2e0 100644 --- a/ui/scss/page/_show.scss +++ b/ui/scss/page/_show.scss @@ -6,4 +6,9 @@ img { max-width: 100%; } + + iframe { + width: 100%; + min-height: 500px; + } } \ No newline at end of file From db64723c24d66f82dc4ac3bbf01dfc00e0ece6b4 Mon Sep 17 00:00:00 2001 From: Krishnaraj Bhat Date: Sat, 3 Jun 2017 13:34:58 +0530 Subject: [PATCH 043/106] Add timeout for jayson client requests request() didn't hit the callback sometimes fixes #19 fixes #188 --- app/main.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/main.js b/app/main.js index 889fa0402..85a0dd3c7 100644 --- a/app/main.js +++ b/app/main.js @@ -21,7 +21,13 @@ const VERSION_CHECK_INTERVAL = 30 * 60 * 1000; const LATEST_RELEASE_API_URL = 'https://api.github.com/repos/lbryio/lbry-app/releases/latest'; -let client = jayson.client.http('http://localhost:5279/lbryapi'); +let client = jayson.client.http({ + host: 'localhost', + port: 5279, + path: '/lbryapi', + timeout: 1000 +}); + // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the JavaScript object is garbage collected. let win; From f59731ff4152c25e7a1649c2813014973078cddc Mon Sep 17 00:00:00 2001 From: Mayesters Date: Sat, 3 Jun 2017 13:08:45 +0200 Subject: [PATCH 044/106] Added y18n as dependency --- ui/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/package.json b/ui/package.json index 7465c0fcd..dd2e4e365 100644 --- a/ui/package.json +++ b/ui/package.json @@ -34,7 +34,8 @@ "redux-logger": "^3.0.1", "redux-thunk": "^2.2.0", "render-media": "^2.10.0", - "reselect": "^3.0.0" + "reselect": "^3.0.0", + "y18n": "^3.2.1" }, "devDependencies": { "babel": "^6.5.2", From a539b58829225cc022bdadd54a9d816df37458d7 Mon Sep 17 00:00:00 2001 From: Mayesters Date: Sat, 3 Jun 2017 13:27:37 +0200 Subject: [PATCH 045/106] Include y18n without creating files + fix modal --- ui/js/app.js | 3 ++- ui/js/component/modal.js | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ui/js/app.js b/ui/js/app.js index 987b112c8..2f94dc302 100644 --- a/ui/js/app.js +++ b/ui/js/app.js @@ -3,7 +3,8 @@ import lbry from './lbry.js'; const env = ENV; const config = require(`./config/${env}`); -const i18n = require('y18n') +const language = lbry.getClientSetting('language') ? lbry.getClientSetting('language') : 'en'; +const i18n = require('y18n')({directory: 'app/locales', updateFiles: false, locale: language}); const logs = []; const app = { env: env, diff --git a/ui/js/component/modal.js b/ui/js/component/modal.js index 8ee2a54ca..ee01e8432 100644 --- a/ui/js/component/modal.js +++ b/ui/js/component/modal.js @@ -1,6 +1,7 @@ import React from 'react'; import ReactModal from 'react-modal'; import Link from 'component/link'; +import app from '../app.js' export class Modal extends React.Component { static propTypes = { @@ -17,8 +18,8 @@ export class Modal extends React.Component { static defaultProps = { type: 'alert', overlay: true, - confirmButtonLabel: __('OK'), - abortButtonLabel: __('Cancel'), + confirmButtonLabel: app.i18n.__('OK'), + abortButtonLabel: app.i18n.__('Cancel'), confirmButtonDisabled: false, abortButtonDisabled: false, } @@ -51,9 +52,9 @@ export class ExpandableModal extends React.Component { } static defaultProps = { - confirmButtonLabel: __('OK'), - expandButtonLabel: __('Show More...'), - hideButtonLabel: __('Show Less'), + confirmButtonLabel: app.i18n.__('OK'), + expandButtonLabel: app.i18n.__('Show More...'), + hideButtonLabel: app.i18n.__('Show Less'), } constructor(props) { From 77aa8c61b08371cb745edcabac3255a8027f04b6 Mon Sep 17 00:00:00 2001 From: Mayesters Date: Sat, 3 Jun 2017 13:34:32 +0200 Subject: [PATCH 046/106] Fix commenting out of setting --- ui/js/page/settings/view.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/js/page/settings/view.jsx b/ui/js/page/settings/view.jsx index 7450745fa..212356e87 100644 --- a/ui/js/page/settings/view.jsx +++ b/ui/js/page/settings/view.jsx @@ -194,7 +194,7 @@ class SettingsPage extends React.Component {
- /* + {/*}

{__("Language")}

@@ -215,7 +215,7 @@ class SettingsPage extends React.Component { defaultChecked={this.state.language=='rs'} />
-
*/ + */}
From eb0641d82a40694c6852d4c8d437f00386a49718 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Mon, 5 Jun 2017 10:44:53 -0400 Subject: [PATCH 047/106] update deprecated commands --- ui/js/actions/settings.js | 2 +- ui/js/actions/wallet.js | 2 +- ui/js/lbry.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/js/actions/settings.js b/ui/js/actions/settings.js index 41dccd3f2..a0742d377 100644 --- a/ui/js/actions/settings.js +++ b/ui/js/actions/settings.js @@ -19,7 +19,7 @@ export function doSetDaemonSetting(key, value) { let settings = {}; settings[key] = value; lbry.settings_set(settings).then(settings) - lbry.get_settings().then((settings) => { + lbry.settings_get().then((settings) => { dispatch({ type: types.DAEMON_SETTINGS_RECEIVED, data: { diff --git a/ui/js/actions/wallet.js b/ui/js/actions/wallet.js index 79b22d8d6..53eccfa67 100644 --- a/ui/js/actions/wallet.js +++ b/ui/js/actions/wallet.js @@ -24,7 +24,7 @@ export function doFetchTransactions() { type: types.FETCH_TRANSACTIONS_STARTED }) - lbry.call('get_transaction_history', {}, (results) => { + lbry.call('transaction_list', {}, (results) => { dispatch({ type: types.FETCH_TRANSACTIONS_COMPLETED, data: { diff --git a/ui/js/lbry.js b/ui/js/lbry.js index 7b95016ac..2b400b53f 100644 --- a/ui/js/lbry.js +++ b/ui/js/lbry.js @@ -124,7 +124,7 @@ lbry.connect = function() { } lbry.checkAddressIsMine = function(address, callback) { - lbry.call('address_is_mine', {address: address}, callback); + lbry.call('wallet_is_address_mine', {address: address}, callback); } lbry.sendToAddress = function(amount, address, callback, errorCallback) { @@ -256,7 +256,7 @@ lbry.setClientSetting = function(setting, value) { } lbry.getSessionInfo = function(callback) { - lbry.call('get_lbry_session_info', {}, callback); + lbry.call('status', {session_status: true}, callback); } lbry.reportBug = function(message, callback) { From 304a737b6daf4bd0aafe06e48444c5c368374e2d Mon Sep 17 00:00:00 2001 From: Jeremy Kauffman Date: Mon, 5 Jun 2017 11:47:18 -0400 Subject: [PATCH 048/106] upgrade changelog --- CHANGELOG.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 79ee6f3ae..08971fd20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,16 +8,18 @@ Web UI version numbers should always match the corresponding version of LBRY App ## [Unreleased] ### Added - * + * More file types, like audio and documents, can be streamed and/or served from the app * ### Changed - * + * All UI strings are now rendered according to gettext standard, in prep for i18n * ### Fixed - * - * + * If a daemon is running but unresponsive, startup is no longer blocked indefinitely + * Updated deprecated LBRY API call signatures + * App scrolls to the top of the page on navigation + * Download progress works properly for purchased but deleted files ### Deprecated * From 5597f736bf3bcc74a43c17c8ac9c6990594356de Mon Sep 17 00:00:00 2001 From: Jeremy Kauffman Date: Mon, 5 Jun 2017 11:49:47 -0400 Subject: [PATCH 049/106] =?UTF-8?q?Bump=20version:=200.11.9=20=E2=86=92=20?= =?UTF-8?q?0.12.0rc1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- app/package.json | 2 +- ui/package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 03dae8d5b..0f707a784 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.11.9 +current_version = 0.12.0rc1 commit = True tag = True parse = (?P\d+)\.(?P\d+)\.(?P\d+)((?P[a-z]+)(?P\d+))? diff --git a/app/package.json b/app/package.json index 824cb40a6..8893290b5 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "LBRY", - "version": "0.11.9", + "version": "0.12.0rc1", "main": "main.js", "description": "LBRY is a fully decentralized, open-source protocol facilitating the discovery, access, and (sometimes) purchase of data.", "author": { diff --git a/ui/package.json b/ui/package.json index dd2e4e365..377cd07f7 100644 --- a/ui/package.json +++ b/ui/package.json @@ -1,6 +1,6 @@ { "name": "lbry-web-ui", - "version": "0.11.9", + "version": "0.12.0rc1", "description": "LBRY UI", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", From a023c114936097f292e17d9dd5461adf631aa444 Mon Sep 17 00:00:00 2001 From: Jeremy Kauffman Date: Mon, 5 Jun 2017 12:57:27 -0400 Subject: [PATCH 050/106] update to latest daemon, remove extra bracket --- build/DAEMON_URL | 2 +- ui/js/page/help/view.jsx | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/build/DAEMON_URL b/build/DAEMON_URL index 11bffea34..efb0b928e 100644 --- a/build/DAEMON_URL +++ b/build/DAEMON_URL @@ -1 +1 @@ -https://github.com/lbryio/lbry/releases/download/v0.10.3/lbrynet-daemon-v0.10.3-OSNAME.zip +https://github.com/lbryio/lbry/releases/download/v0.11.0rc1/lbrynet-daemon-v0.11.0rc1-OSNAME.zip diff --git a/ui/js/page/help/view.jsx b/ui/js/page/help/view.jsx index 8cca6fc5b..c7c046426 100644 --- a/ui/js/page/help/view.jsx +++ b/ui/js/page/help/view.jsx @@ -130,7 +130,6 @@ class HelpPage extends React.Component { }
- } ); } From 1dc1b0ed7ad737f404b5bcc8834ad6311b663997 Mon Sep 17 00:00:00 2001 From: Jeremy Kauffman Date: Mon, 5 Jun 2017 12:58:04 -0400 Subject: [PATCH 051/106] =?UTF-8?q?Bump=20version:=200.12.0rc1=20=E2=86=92?= =?UTF-8?q?=200.12.0rc2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- app/package.json | 2 +- ui/package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 0f707a784..9ed829559 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.12.0rc1 +current_version = 0.12.0rc2 commit = True tag = True parse = (?P\d+)\.(?P\d+)\.(?P\d+)((?P[a-z]+)(?P\d+))? diff --git a/app/package.json b/app/package.json index 8893290b5..55b3aa4a7 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "LBRY", - "version": "0.12.0rc1", + "version": "0.12.0rc2", "main": "main.js", "description": "LBRY is a fully decentralized, open-source protocol facilitating the discovery, access, and (sometimes) purchase of data.", "author": { diff --git a/ui/package.json b/ui/package.json index 377cd07f7..20dc8b1e3 100644 --- a/ui/package.json +++ b/ui/package.json @@ -1,6 +1,6 @@ { "name": "lbry-web-ui", - "version": "0.12.0rc1", + "version": "0.12.0rc2", "description": "LBRY UI", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", From a2ec397ff8eb159c36cb8316b5a322a9d5f7e25b Mon Sep 17 00:00:00 2001 From: Fillerino Date: Mon, 5 Jun 2017 22:35:24 +0200 Subject: [PATCH 052/106] Quick fix for Issue #198 , not being able to go to SEND/RECEIVE page This commit fixes the missing _ in one of the i18n translation labels. fixes #198 --- ui/js/component/walletSend/view.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/js/component/walletSend/view.jsx b/ui/js/component/walletSend/view.jsx index 5e05a946e..bf9fcafa0 100644 --- a/ui/js/component/walletSend/view.jsx +++ b/ui/js/component/walletSend/view.jsx @@ -29,7 +29,7 @@ const WalletSend = (props) => {
- 0.0) || !address} /> + 0.0) || !address} />
From e644bc5d890b97935c1fe77f624b1d51b71212f8 Mon Sep 17 00:00:00 2001 From: Jeremy Kauffman Date: Mon, 5 Jun 2017 19:11:26 -0400 Subject: [PATCH 053/106] =?UTF-8?q?Bump=20version:=200.12.0rc2=20=E2=86=92?= =?UTF-8?q?=200.12.0rc3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- app/package.json | 2 +- ui/package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 9ed829559..79d1ef0ed 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.12.0rc2 +current_version = 0.12.0rc3 commit = True tag = True parse = (?P\d+)\.(?P\d+)\.(?P\d+)((?P[a-z]+)(?P\d+))? diff --git a/app/package.json b/app/package.json index 55b3aa4a7..dbd659e0d 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "LBRY", - "version": "0.12.0rc2", + "version": "0.12.0rc3", "main": "main.js", "description": "LBRY is a fully decentralized, open-source protocol facilitating the discovery, access, and (sometimes) purchase of data.", "author": { diff --git a/ui/package.json b/ui/package.json index 20dc8b1e3..4a39ee759 100644 --- a/ui/package.json +++ b/ui/package.json @@ -1,6 +1,6 @@ { "name": "lbry-web-ui", - "version": "0.12.0rc2", + "version": "0.12.0rc3", "description": "LBRY UI", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", From 6f938349909571b9a2cc8e2234dc359a42c74d0c Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Mon, 5 Jun 2017 21:20:41 -0700 Subject: [PATCH 054/106] add prettier --- ui/package.json | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ui/package.json b/ui/package.json index 4a39ee759..9bd150877 100644 --- a/ui/package.json +++ b/ui/package.json @@ -4,7 +4,8 @@ "description": "LBRY UI", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "dev": "webpack-dev-server --devtool eval --progress --colors --inline" + "dev": "webpack-dev-server --devtool eval --progress --colors --inline", + "precommit": "lint-staged" }, "keywords": [ "lbry" @@ -52,11 +53,21 @@ "eslint-plugin-import": "^2.2.0", "eslint-plugin-jsx-a11y": "^2.2.3", "eslint-plugin-react": "^6.7.1", + "husky": "^0.13.4", "json-loader": "^0.5.4", + "lint-staged": "^3.6.0", "node-sass": "^3.13.0", + "prettier": "^1.4.2", "webpack": "^1.13.3", "webpack-dev-server": "^2.4.4", "webpack-notifier": "^1.5.0", "webpack-target-electron-renderer": "^0.4.0" + }, + "lint-staged": { + "gitDir": "../", + "js/**/*.{jsx,js}": [ + "prettier --use-tabs --single-quote --write", + "git add" + ] } } From c8b949f020b7bc7711b16c9753c4ff43397d27aa Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Mon, 5 Jun 2017 21:21:55 -0700 Subject: [PATCH 055/106] format with prettier --- ui/js/actions/app.js | 327 +++-- ui/js/actions/availability.js | 48 +- ui/js/actions/content.js | 470 +++---- ui/js/actions/cost_info.js | 129 +- ui/js/actions/file_info.js | 176 ++- ui/js/actions/rewards.js | 53 +- ui/js/actions/search.js | 87 +- ui/js/actions/settings.js | 52 +- ui/js/actions/wallet.js | 190 +-- ui/js/app.js | 30 +- ui/js/component/app/index.js | 35 +- ui/js/component/app/view.jsx | 66 +- ui/js/component/auth.js | 752 ++++++---- ui/js/component/common.js | 275 ++-- ui/js/component/downloadingModal/index.jsx | 36 +- ui/js/component/downloadingModal/view.jsx | 92 +- ui/js/component/errorModal/index.jsx | 33 +- ui/js/component/errorModal/view.jsx | 99 +- ui/js/component/file-selector.js | 102 +- ui/js/component/fileActions/index.js | 115 +- ui/js/component/fileActions/view.jsx | 335 +++-- ui/js/component/fileCard/index.js | 73 +- ui/js/component/fileCard/view.jsx | 194 +-- ui/js/component/fileList/index.js | 16 +- ui/js/component/fileList/view.jsx | 161 ++- ui/js/component/fileListSearch/index.js | 44 +- ui/js/component/fileListSearch/view.jsx | 134 +- ui/js/component/filePrice/index.js | 44 +- ui/js/component/filePrice/view.jsx | 67 +- ui/js/component/fileTile/index.js | 70 +- ui/js/component/fileTile/view.jsx | 219 +-- ui/js/component/form.js | 374 ++--- ui/js/component/header/index.js | 37 +- ui/js/component/header/view.jsx | 81 +- ui/js/component/link/index.jsx | 10 +- ui/js/component/link/view.js | 88 +- ui/js/component/load_screen.js | 78 +- ui/js/component/menu.js | 171 ++- ui/js/component/modal-page.js | 27 +- ui/js/component/modal.js | 178 ++- ui/js/component/notice.js | 34 +- ui/js/component/reward-link.js | 170 ++- ui/js/component/router/index.jsx | 13 +- ui/js/component/router/view.jsx | 62 +- ui/js/component/snackBar/index.js | 33 +- ui/js/component/snackBar/view.jsx | 72 +- ui/js/component/splash.js | 121 +- ui/js/component/subHeader/index.js | 31 +- ui/js/component/subHeader/view.jsx | 51 +- ui/js/component/tooltip.js | 79 +- ui/js/component/transactionList/index.js | 36 +- ui/js/component/transactionList/view.jsx | 124 +- ui/js/component/upgradeModal/index.jsx | 26 +- ui/js/component/upgradeModal/view.jsx | 49 +- ui/js/component/uriIndicator/index.js | 42 +- ui/js/component/uriIndicator/view.jsx | 106 +- ui/js/component/video/index.js | 86 +- ui/js/component/video/view.jsx | 328 +++-- ui/js/component/walletAddress/index.js | 37 +- ui/js/component/walletAddress/view.jsx | 74 +- ui/js/component/walletSend/index.js | 55 +- ui/js/component/walletSend/view.jsx | 122 +- ui/js/component/wunderbar/index.js | 38 +- ui/js/component/wunderbar/view.jsx | 272 ++-- ui/js/config/development.js | 3 +- ui/js/config/production.js | 3 +- ui/js/constants/action_types.js | 117 +- ui/js/jsonrpc.js | 138 +- ui/js/lbry.js | 718 ++++++---- ui/js/lbryio.js | 301 ++-- ui/js/lbryuri.js | 315 +++-- ui/js/lighthouse.js | 93 +- ui/js/main.js | 125 +- ui/js/page/channel/index.js | 42 +- ui/js/page/channel/view.jsx | 91 +- ui/js/page/developer.js | 206 +-- ui/js/page/discover/index.js | 34 +- ui/js/page/discover/view.jsx | 110 +- ui/js/page/fileListDownloaded/index.js | 40 +- ui/js/page/fileListDownloaded/view.jsx | 68 +- ui/js/page/fileListPublished/index.js | 40 +- ui/js/page/fileListPublished/view.jsx | 110 +- ui/js/page/filePage/index.js | 76 +- ui/js/page/filePage/view.jsx | 242 ++-- ui/js/page/help/index.js | 20 +- ui/js/page/help/view.jsx | 272 ++-- ui/js/page/publish/index.js | 33 +- ui/js/page/publish/view.jsx | 1481 ++++++++++++-------- ui/js/page/report.js | 143 +- ui/js/page/rewards.js | 147 +- ui/js/page/search/index.js | 36 +- ui/js/page/search/view.jsx | 71 +- ui/js/page/settings/index.js | 30 +- ui/js/page/settings/view.jsx | 395 +++--- ui/js/page/showPage/index.js | 44 +- ui/js/page/showPage/view.jsx | 99 +- ui/js/page/start.js | 22 +- ui/js/page/wallet/index.js | 26 +- ui/js/page/wallet/view.jsx | 53 +- ui/js/reducers/app.js | 189 ++- ui/js/reducers/availability.js | 52 +- ui/js/reducers/claims.js | 131 +- ui/js/reducers/content.js | 85 +- ui/js/reducers/cost_info.js | 52 +- ui/js/reducers/file_info.js | 213 ++- ui/js/reducers/rewards.js | 13 +- ui/js/reducers/search.js | 66 +- ui/js/reducers/settings.js | 20 +- ui/js/reducers/wallet.js | 184 +-- ui/js/rewards.js | 332 +++-- ui/js/selectors/app.js | 305 ++-- ui/js/selectors/availability.js | 48 +- ui/js/selectors/claims.js | 122 +- ui/js/selectors/content.js | 38 +- ui/js/selectors/cost_info.js | 38 +- ui/js/selectors/file_info.js | 161 ++- ui/js/selectors/rewards.js | 4 +- ui/js/selectors/search.js | 123 +- ui/js/selectors/settings.js | 24 +- ui/js/selectors/wallet.js | 115 +- ui/js/store.js | 94 +- ui/js/util/batchActions.js | 10 +- ui/js/util/query_params.js | 36 +- ui/js/utils.js | 18 +- 124 files changed, 8463 insertions(+), 7383 deletions(-) diff --git a/ui/js/actions/app.js b/ui/js/actions/app.js index bf0451c82..e8b13cf1c 100644 --- a/ui/js/actions/app.js +++ b/ui/js/actions/app.js @@ -1,238 +1,235 @@ -import * as types from 'constants/action_types' -import lbry from 'lbry' +import * as types from 'constants/action_types'; +import lbry from 'lbry'; import { - selectUpdateUrl, - selectUpgradeDownloadPath, - selectUpgradeDownloadItem, - selectUpgradeFilename, - selectPageTitle, - selectCurrentPage, - selectCurrentParams, -} from 'selectors/app' -import { - doSearch, -} from 'actions/search' + selectUpdateUrl, + selectUpgradeDownloadPath, + selectUpgradeDownloadItem, + selectUpgradeFilename, + selectPageTitle, + selectCurrentPage, + selectCurrentParams +} from 'selectors/app'; +import { doSearch } from 'actions/search'; -const {remote, ipcRenderer, shell} = require('electron'); +const { remote, ipcRenderer, shell } = require('electron'); const path = require('path'); const app = require('electron').remote.app; -const {download} = remote.require('electron-dl'); +const { download } = remote.require('electron-dl'); const fs = remote.require('fs'); -const queryStringFromParams = (params) => { - return Object - .keys(params) - .map(key => `${key}=${params[key]}`) - .join('&') -} +const queryStringFromParams = params => { + return Object.keys(params).map(key => `${key}=${params[key]}`).join('&'); +}; export function doNavigate(path, params = {}) { - return function(dispatch, getState) { - let url = path - if (params) - url = `${url}?${queryStringFromParams(params)}` + return function(dispatch, getState) { + let url = path; + if (params) url = `${url}?${queryStringFromParams(params)}`; - dispatch(doChangePath(url)) + dispatch(doChangePath(url)); - const state = getState() - const pageTitle = selectPageTitle(state) - dispatch(doHistoryPush(params, pageTitle, url)) - } + const state = getState(); + const pageTitle = selectPageTitle(state); + dispatch(doHistoryPush(params, pageTitle, url)); + }; } export function doChangePath(path) { - return function(dispatch, getState) { - dispatch({ - type: types.CHANGE_PATH, - data: { - path, - } - }) + return function(dispatch, getState) { + dispatch({ + type: types.CHANGE_PATH, + data: { + path + } + }); - const state = getState() - const pageTitle = selectPageTitle(state) - window.document.title = pageTitle - window.scrollTo(0, 0) + const state = getState(); + const pageTitle = selectPageTitle(state); + window.document.title = pageTitle; + window.scrollTo(0, 0); - const currentPage = selectCurrentPage(state) - if (currentPage === 'search') { - const params = selectCurrentParams(state) - dispatch(doSearch(params.query)) - } - } + const currentPage = selectCurrentPage(state); + if (currentPage === 'search') { + const params = selectCurrentParams(state); + dispatch(doSearch(params.query)); + } + }; } export function doHistoryBack() { - return function(dispatch, getState) { - history.back() - } + return function(dispatch, getState) { + history.back(); + }; } export function doHistoryPush(params, title, relativeUrl) { - return function(dispatch, getState) { - let pathParts = window.location.pathname.split('/') - pathParts[pathParts.length - 1] = relativeUrl.replace(/^\//, '') - const url = pathParts.join('/') - title += " - LBRY" - history.pushState(params, title, url) - } + return function(dispatch, getState) { + let pathParts = window.location.pathname.split('/'); + pathParts[pathParts.length - 1] = relativeUrl.replace(/^\//, ''); + const url = pathParts.join('/'); + title += ' - LBRY'; + history.pushState(params, title, url); + }; } export function doOpenModal(modal) { - return { - type: types.OPEN_MODAL, - data: { - modal - } - } + return { + type: types.OPEN_MODAL, + data: { + modal + } + }; } export function doCloseModal() { - return { - type: types.CLOSE_MODAL, - } + return { + type: types.CLOSE_MODAL + }; } export function doUpdateDownloadProgress(percent) { - return { - type: types.UPGRADE_DOWNLOAD_PROGRESSED, - data: { - percent: percent - } - } + return { + type: types.UPGRADE_DOWNLOAD_PROGRESSED, + data: { + percent: percent + } + }; } export function doSkipUpgrade() { - return { - type: types.SKIP_UPGRADE - } + return { + type: types.SKIP_UPGRADE + }; } export function doStartUpgrade() { - return function(dispatch, getState) { - const state = getState() - const upgradeDownloadPath = selectUpgradeDownloadPath(state) + return function(dispatch, getState) { + const state = getState(); + const upgradeDownloadPath = selectUpgradeDownloadPath(state); - ipcRenderer.send('upgrade', upgradeDownloadPath) - } + ipcRenderer.send('upgrade', upgradeDownloadPath); + }; } export function doDownloadUpgrade() { - return function(dispatch, getState) { - const state = getState() - // Make a new directory within temp directory so the filename is guaranteed to be available - const dir = fs.mkdtempSync(app.getPath('temp') + require('path').sep); - const upgradeFilename = selectUpgradeFilename(state) + return function(dispatch, getState) { + const state = getState(); + // Make a new directory within temp directory so the filename is guaranteed to be available + const dir = fs.mkdtempSync(app.getPath('temp') + require('path').sep); + const upgradeFilename = selectUpgradeFilename(state); - let options = { - onProgress: (p) => dispatch(doUpdateDownloadProgress(Math.round(p * 100))), - directory: dir, - }; - download(remote.getCurrentWindow(), selectUpdateUrl(state), options) - .then(downloadItem => { - /** + let options = { + onProgress: p => dispatch(doUpdateDownloadProgress(Math.round(p * 100))), + directory: dir + }; + download( + remote.getCurrentWindow(), + selectUpdateUrl(state), + options + ).then(downloadItem => { + /** * TODO: get the download path directly from the download object. It should just be * downloadItem.getSavePath(), but the copy on the main process is being garbage collected * too soon. */ - dispatch({ - type: types.UPGRADE_DOWNLOAD_COMPLETED, - data: { - downloadItem, - path: path.join(dir, upgradeFilename) - } - }) - }); + dispatch({ + type: types.UPGRADE_DOWNLOAD_COMPLETED, + data: { + downloadItem, + path: path.join(dir, upgradeFilename) + } + }); + }); - dispatch({ - type: types.UPGRADE_DOWNLOAD_STARTED - }) - dispatch({ - type: types.OPEN_MODAL, - data: { - modal: 'downloading' - } - }) - } + dispatch({ + type: types.UPGRADE_DOWNLOAD_STARTED + }); + dispatch({ + type: types.OPEN_MODAL, + data: { + modal: 'downloading' + } + }); + }; } export function doCancelUpgrade() { - return function(dispatch, getState) { - const state = getState() - const upgradeDownloadItem = selectUpgradeDownloadItem(state) + return function(dispatch, getState) { + const state = getState(); + const upgradeDownloadItem = selectUpgradeDownloadItem(state); - if (upgradeDownloadItem) { - /* + if (upgradeDownloadItem) { + /* * Right now the remote reference to the download item gets garbage collected as soon as the * the download is over (maybe even earlier), so trying to cancel a finished download may * throw an error. */ - try { - upgradeDownloadItem.cancel(); - } catch (err) { - console.error(err) - // Do nothing - } - } + try { + upgradeDownloadItem.cancel(); + } catch (err) { + console.error(err); + // Do nothing + } + } - dispatch({ type: types.UPGRADE_CANCELLED }) - } + dispatch({ type: types.UPGRADE_CANCELLED }); + }; } export function doCheckUpgradeAvailable() { - return function(dispatch, getState) { - const state = getState() + return function(dispatch, getState) { + const state = getState(); - lbry.getAppVersionInfo().then(({remoteVersion, upgradeAvailable}) => { - if (upgradeAvailable) { - dispatch({ - type: types.UPDATE_VERSION, - data: { - version: remoteVersion, - } - }) - dispatch({ - type: types.OPEN_MODAL, - data: { - modal: 'upgrade' - } - }) - } - }); - } + lbry.getAppVersionInfo().then(({ remoteVersion, upgradeAvailable }) => { + if (upgradeAvailable) { + dispatch({ + type: types.UPDATE_VERSION, + data: { + version: remoteVersion + } + }); + dispatch({ + type: types.OPEN_MODAL, + data: { + modal: 'upgrade' + } + }); + } + }); + }; } export function doAlertError(errorList) { - return function(dispatch, getState) { - const state = getState() - console.log('do alert error') - console.log(errorList) - dispatch({ - type: types.OPEN_MODAL, - data: { - modal: 'error', - extraContent: errorList - } - }) - } + return function(dispatch, getState) { + const state = getState(); + console.log('do alert error'); + console.log(errorList); + dispatch({ + type: types.OPEN_MODAL, + data: { + modal: 'error', + extraContent: errorList + } + }); + }; } export function doDaemonReady() { - return { - type: types.DAEMON_READY - } + return { + type: types.DAEMON_READY + }; } export function doShowSnackBar(data) { - return { - type: types.SHOW_SNACKBAR, - data, - } + return { + type: types.SHOW_SNACKBAR, + data + }; } export function doRemoveSnackBarSnack() { - return { - type: types.REMOVE_SNACKBAR_SNACK, - } + return { + type: types.REMOVE_SNACKBAR_SNACK + }; } diff --git a/ui/js/actions/availability.js b/ui/js/actions/availability.js index 501a2eeda..856eff0aa 100644 --- a/ui/js/actions/availability.js +++ b/ui/js/actions/availability.js @@ -1,29 +1,27 @@ -import * as types from 'constants/action_types' -import lbry from 'lbry' -import { - selectFetchingAvailability -} from 'selectors/availability' +import * as types from 'constants/action_types'; +import lbry from 'lbry'; +import { selectFetchingAvailability } from 'selectors/availability'; export function doFetchAvailability(uri) { - return function(dispatch, getState) { - const state = getState() - const alreadyFetching = !!selectFetchingAvailability(state)[uri] + return function(dispatch, getState) { + const state = getState(); + const alreadyFetching = !!selectFetchingAvailability(state)[uri]; - if (!alreadyFetching) { - dispatch({ - type: types.FETCH_AVAILABILITY_STARTED, - data: {uri} - }) + if (!alreadyFetching) { + dispatch({ + type: types.FETCH_AVAILABILITY_STARTED, + data: { uri } + }); - lbry.get_availability({uri}).then((availability) => { - dispatch({ - type: types.FETCH_AVAILABILITY_COMPLETED, - data: { - availability, - uri, - } - }) - }) - } - } -} \ No newline at end of file + lbry.get_availability({ uri }).then(availability => { + dispatch({ + type: types.FETCH_AVAILABILITY_COMPLETED, + data: { + availability, + uri + } + }); + }); + } + }; +} diff --git a/ui/js/actions/content.js b/ui/js/actions/content.js index a7276abf9..6043699cd 100644 --- a/ui/js/actions/content.js +++ b/ui/js/actions/content.js @@ -1,294 +1,288 @@ -import * as types from 'constants/action_types' -import lbry from 'lbry' -import lbryio from 'lbryio' -import lbryuri from 'lbryuri' -import rewards from 'rewards' +import * as types from 'constants/action_types'; +import lbry from 'lbry'; +import lbryio from 'lbryio'; +import lbryuri from 'lbryuri'; +import rewards from 'rewards'; +import { selectBalance } from 'selectors/wallet'; import { - selectBalance, -} from 'selectors/wallet' -import { - selectFileInfoForUri, - selectUrisDownloading, -} from 'selectors/file_info' -import { - selectResolvingUris -} from 'selectors/content' -import { - selectCostInfoForUri, -} from 'selectors/cost_info' -import { - selectClaimsByUri, -} from 'selectors/claims' -import { - doOpenModal, -} from 'actions/app' + selectFileInfoForUri, + selectUrisDownloading +} from 'selectors/file_info'; +import { selectResolvingUris } from 'selectors/content'; +import { selectCostInfoForUri } from 'selectors/cost_info'; +import { selectClaimsByUri } from 'selectors/claims'; +import { doOpenModal } from 'actions/app'; export function doResolveUri(uri) { - return function(dispatch, getState) { + return function(dispatch, getState) { + uri = lbryuri.normalize(uri); - uri = lbryuri.normalize(uri) + const state = getState(); + const alreadyResolving = selectResolvingUris(state).indexOf(uri) !== -1; - const state = getState() - const alreadyResolving = selectResolvingUris(state).indexOf(uri) !== -1 + if (!alreadyResolving) { + dispatch({ + type: types.RESOLVE_URI_STARTED, + data: { uri } + }); - if (!alreadyResolving) { - dispatch({ - type: types.RESOLVE_URI_STARTED, - data: { uri } - }) + lbry.resolve({ uri }).then(resolutionInfo => { + const { claim, certificate } = resolutionInfo + ? resolutionInfo + : { claim: null, certificate: null }; - lbry.resolve({ uri }).then((resolutionInfo) => { - const { - claim, - certificate, - } = resolutionInfo ? resolutionInfo : { claim : null, certificate: null } - - dispatch({ - type: types.RESOLVE_URI_COMPLETED, - data: { - uri, - claim, - certificate, - } - }) - }) - } - } + dispatch({ + type: types.RESOLVE_URI_COMPLETED, + data: { + uri, + claim, + certificate + } + }); + }); + } + }; } export function doCancelResolveUri(uri) { - return function(dispatch, getState) { - lbry.cancelResolve({ uri }) - dispatch({ - type: types.RESOLVE_URI_CANCELED, - data: { uri } - }) - } + return function(dispatch, getState) { + lbry.cancelResolve({ uri }); + dispatch({ + type: types.RESOLVE_URI_CANCELED, + data: { uri } + }); + }; } export function doFetchFeaturedUris() { - return function(dispatch, getState) { - const state = getState() + return function(dispatch, getState) { + const state = getState(); - dispatch({ - type: types.FETCH_FEATURED_CONTENT_STARTED, - }) + dispatch({ + type: types.FETCH_FEATURED_CONTENT_STARTED + }); - const success = ({ Categories, Uris }) => { + const success = ({ Categories, Uris }) => { + let featuredUris = {}; - let featuredUris = {} + Categories.forEach(category => { + if (Uris[category] && Uris[category].length) { + featuredUris[category] = Uris[category]; + } + }); - Categories.forEach((category) => { - if (Uris[category] && Uris[category].length) { - featuredUris[category] = Uris[category] - } - }) + dispatch({ + type: types.FETCH_FEATURED_CONTENT_COMPLETED, + data: { + categories: Categories, + uris: featuredUris + } + }); + }; - dispatch({ - type: types.FETCH_FEATURED_CONTENT_COMPLETED, - data: { - categories: Categories, - uris: featuredUris, - } - }) - } + const failure = () => { + dispatch({ + type: types.FETCH_FEATURED_CONTENT_COMPLETED, + data: { + categories: [], + uris: {} + } + }); + }; - const failure = () => { - dispatch({ - type: types.FETCH_FEATURED_CONTENT_COMPLETED, - data: { - categories: [], - uris: {} - } - }) - } - - lbryio.call('discover', 'list', { version: "early-access" } ) - .then(success, failure) - } + lbryio + .call('discover', 'list', { version: 'early-access' }) + .then(success, failure); + }; } export function doUpdateLoadStatus(uri, outpoint) { - return function(dispatch, getState) { - const state = getState() + return function(dispatch, getState) { + const state = getState(); - lbry.file_list({ - outpoint: outpoint, - full_status: true, - }).then(([fileInfo]) => { - if(!fileInfo || fileInfo.written_bytes == 0) { - // download hasn't started yet - setTimeout(() => { dispatch(doUpdateLoadStatus(uri, outpoint)) }, 250) - } else if (fileInfo.completed) { - // TODO this isn't going to get called if they reload the client before - // the download finished - dispatch({ - type: types.DOWNLOADING_COMPLETED, - data: { - uri, - outpoint, - fileInfo, - } - }) - } else { - // ready to play - const { - total_bytes, - written_bytes, - } = fileInfo - const progress = (written_bytes / total_bytes) * 100 + lbry + .file_list({ + outpoint: outpoint, + full_status: true + }) + .then(([fileInfo]) => { + if (!fileInfo || fileInfo.written_bytes == 0) { + // download hasn't started yet + setTimeout(() => { + dispatch(doUpdateLoadStatus(uri, outpoint)); + }, 250); + } else if (fileInfo.completed) { + // TODO this isn't going to get called if they reload the client before + // the download finished + dispatch({ + type: types.DOWNLOADING_COMPLETED, + data: { + uri, + outpoint, + fileInfo + } + }); + } else { + // ready to play + const { total_bytes, written_bytes } = fileInfo; + const progress = written_bytes / total_bytes * 100; - dispatch({ - type: types.DOWNLOADING_PROGRESSED, - data: { - uri, - outpoint, - fileInfo, - progress, - } - }) - setTimeout(() => { dispatch(doUpdateLoadStatus(uri, outpoint)) }, 250) - } - }) - } + dispatch({ + type: types.DOWNLOADING_PROGRESSED, + data: { + uri, + outpoint, + fileInfo, + progress + } + }); + setTimeout(() => { + dispatch(doUpdateLoadStatus(uri, outpoint)); + }, 250); + } + }); + }; } export function doDownloadFile(uri, streamInfo) { - return function(dispatch, getState) { - const state = getState() + return function(dispatch, getState) { + const state = getState(); - lbry.file_list({ outpoint: streamInfo.outpoint, full_status: true }).then(([fileInfo]) => { - dispatch({ - type: types.DOWNLOADING_STARTED, - data: { - uri, - outpoint: streamInfo.outpoint, - fileInfo, - } - }) + lbry + .file_list({ outpoint: streamInfo.outpoint, full_status: true }) + .then(([fileInfo]) => { + dispatch({ + type: types.DOWNLOADING_STARTED, + data: { + uri, + outpoint: streamInfo.outpoint, + fileInfo + } + }); - dispatch(doUpdateLoadStatus(uri, streamInfo.outpoint)) - }) + dispatch(doUpdateLoadStatus(uri, streamInfo.outpoint)); + }); - lbryio.call('file', 'view', { - uri: uri, - outpoint: streamInfo.outpoint, - claim_id: streamInfo.claim_id, - }).catch(() => {}) + lbryio + .call('file', 'view', { + uri: uri, + outpoint: streamInfo.outpoint, + claim_id: streamInfo.claim_id + }) + .catch(() => {}); - rewards.claimEligiblePurchaseRewards() - - } + rewards.claimEligiblePurchaseRewards(); + }; } export function doLoadVideo(uri) { - return function(dispatch, getState) { - const state = getState() + return function(dispatch, getState) { + const state = getState(); - dispatch({ - type: types.LOADING_VIDEO_STARTED, - data: { - uri - } - }) + dispatch({ + type: types.LOADING_VIDEO_STARTED, + data: { + uri + } + }); - lbry.get({ uri }).then(streamInfo => { - const timeout = streamInfo === null || - typeof streamInfo !== 'object' || - streamInfo.error == 'Timeout' + lbry.get({ uri }).then(streamInfo => { + const timeout = + streamInfo === null || + typeof streamInfo !== 'object' || + streamInfo.error == 'Timeout'; - if(timeout) { - dispatch({ - type: types.LOADING_VIDEO_FAILED, - data: { uri } - }) - dispatch(doOpenModal('timedOut')) - } else { - dispatch(doDownloadFile(uri, streamInfo)) - } - }) - } + if (timeout) { + dispatch({ + type: types.LOADING_VIDEO_FAILED, + data: { uri } + }); + dispatch(doOpenModal('timedOut')); + } else { + dispatch(doDownloadFile(uri, streamInfo)); + } + }); + }; } export function doPurchaseUri(uri, purchaseModalName) { - return function(dispatch, getState) { - const state = getState() - const balance = selectBalance(state) - const fileInfo = selectFileInfoForUri(state, { uri }) - const downloadingByUri = selectUrisDownloading(state) - const alreadyDownloading = !!downloadingByUri[uri] + return function(dispatch, getState) { + const state = getState(); + const balance = selectBalance(state); + const fileInfo = selectFileInfoForUri(state, { uri }); + const downloadingByUri = selectUrisDownloading(state); + const alreadyDownloading = !!downloadingByUri[uri]; - // we already fully downloaded the file. - if (fileInfo && fileInfo.completed) { - // If written_bytes is false that means the user has deleted/moved the - // file manually on their file system, so we need to dispatch a - // doLoadVideo action to reconstruct the file from the blobs - if (!fileInfo.written_bytes) dispatch(doLoadVideo(uri)) + // we already fully downloaded the file. + if (fileInfo && fileInfo.completed) { + // If written_bytes is false that means the user has deleted/moved the + // file manually on their file system, so we need to dispatch a + // doLoadVideo action to reconstruct the file from the blobs + if (!fileInfo.written_bytes) dispatch(doLoadVideo(uri)); - return Promise.resolve() - } + return Promise.resolve(); + } - // we are already downloading the file - if (alreadyDownloading) { - return Promise.resolve() - } + // we are already downloading the file + if (alreadyDownloading) { + return Promise.resolve(); + } - const costInfo = selectCostInfoForUri(state, { uri }) - const { cost } = costInfo + const costInfo = selectCostInfoForUri(state, { uri }); + const { cost } = costInfo; - // the file is free or we have partially downloaded it - if (cost <= 0.01 || (fileInfo && fileInfo.download_directory)) { - dispatch(doLoadVideo(uri)) - return Promise.resolve() - } + // the file is free or we have partially downloaded it + if (cost <= 0.01 || (fileInfo && fileInfo.download_directory)) { + dispatch(doLoadVideo(uri)); + return Promise.resolve(); + } - if (cost > balance) { - dispatch(doOpenModal('notEnoughCredits')) - } else { - dispatch(doOpenModal(purchaseModalName)) - } + if (cost > balance) { + dispatch(doOpenModal('notEnoughCredits')); + } else { + dispatch(doOpenModal(purchaseModalName)); + } - return Promise.resolve() - } + return Promise.resolve(); + }; } export function doFetchClaimsByChannel(uri) { - return function(dispatch, getState) { - dispatch({ - type: types.FETCH_CHANNEL_CLAIMS_STARTED, - data: { uri } - }) + return function(dispatch, getState) { + dispatch({ + type: types.FETCH_CHANNEL_CLAIMS_STARTED, + data: { uri } + }); - lbry.resolve({ uri }).then((resolutionInfo) => { - const { - claims_in_channel, - } = resolutionInfo ? resolutionInfo : { claims_in_channel: [] } + lbry.resolve({ uri }).then(resolutionInfo => { + const { claims_in_channel } = resolutionInfo + ? resolutionInfo + : { claims_in_channel: [] }; - dispatch({ - type: types.FETCH_CHANNEL_CLAIMS_COMPLETED, - data: { - uri, - claims: claims_in_channel - } - }) - }) - } + dispatch({ + type: types.FETCH_CHANNEL_CLAIMS_COMPLETED, + data: { + uri, + claims: claims_in_channel + } + }); + }); + }; } export function doFetchClaimListMine() { - return function(dispatch, getState) { - dispatch({ - type: types.FETCH_CLAIM_LIST_MINE_STARTED - }) + return function(dispatch, getState) { + dispatch({ + type: types.FETCH_CLAIM_LIST_MINE_STARTED + }); - - lbry.claim_list_mine().then((claims) => { - dispatch({ - type: types.FETCH_CLAIM_LIST_MINE_COMPLETED, - data: { - claims - } - }) - }) - } -} \ No newline at end of file + lbry.claim_list_mine().then(claims => { + dispatch({ + type: types.FETCH_CLAIM_LIST_MINE_COMPLETED, + data: { + claims + } + }); + }); + }; +} diff --git a/ui/js/actions/cost_info.js b/ui/js/actions/cost_info.js index dbad86f33..d1f1e60c3 100644 --- a/ui/js/actions/cost_info.js +++ b/ui/js/actions/cost_info.js @@ -1,77 +1,68 @@ - import * as types from 'constants/action_types' -import lbry from 'lbry' -import lbryio from 'lbryio' -import { - doResolveUri -} from 'actions/content' -import { - selectResolvingUris, -} from 'selectors/content' -import { - selectClaimsByUri -} from 'selectors/claims' -import { - selectSettingsIsGenerous -} from 'selectors/settings' +import * as types from 'constants/action_types'; +import lbry from 'lbry'; +import lbryio from 'lbryio'; +import { doResolveUri } from 'actions/content'; +import { selectResolvingUris } from 'selectors/content'; +import { selectClaimsByUri } from 'selectors/claims'; +import { selectSettingsIsGenerous } from 'selectors/settings'; export function doFetchCostInfoForUri(uri) { - return function(dispatch, getState) { - const state = getState(), - claim = selectClaimsByUri(state)[uri], - isResolving = selectResolvingUris(state).indexOf(uri) !== -1, - isGenerous = selectSettingsIsGenerous(state) + return function(dispatch, getState) { + const state = getState(), + claim = selectClaimsByUri(state)[uri], + isResolving = selectResolvingUris(state).indexOf(uri) !== -1, + isGenerous = selectSettingsIsGenerous(state); - if (claim === null) { //claim doesn't exist, nothing to fetch a cost for - return - } + if (claim === null) { + //claim doesn't exist, nothing to fetch a cost for + return; + } - if (!claim) { - setTimeout(() => { - dispatch(doFetchCostInfoForUri(uri)) - }, 1000) - if (!isResolving) { - dispatch(doResolveUri(uri)) - } - return - } + if (!claim) { + setTimeout(() => { + dispatch(doFetchCostInfoForUri(uri)); + }, 1000); + if (!isResolving) { + dispatch(doResolveUri(uri)); + } + return; + } + function begin() { + dispatch({ + type: types.FETCH_COST_INFO_STARTED, + data: { + uri + } + }); + } - function begin() { - dispatch({ - type: types.FETCH_COST_INFO_STARTED, - data: { - uri, - } - }) - } + function resolve(costInfo) { + dispatch({ + type: types.FETCH_COST_INFO_COMPLETED, + data: { + uri, + costInfo + } + }); + } - function resolve(costInfo) { - dispatch({ - type: types.FETCH_COST_INFO_COMPLETED, - data: { - uri, - costInfo, - } - }) - } - - if (isGenerous && claim) { - let cost - const fee = claim.value.stream.metadata.fee; - if (fee === undefined ) { - resolve({ cost: 0, includesData: true }) - } else if (fee.currency == 'LBC') { - resolve({ cost: fee.amount, includesData: true }) - } else { - begin() - lbryio.getExchangeRates().then(({lbc_usd}) => { - resolve({ cost: fee.amount / lbc_usd, includesData: true }) - }); - } - } else { - begin() - lbry.getCostInfo(uri).then(resolve) - } - } + if (isGenerous && claim) { + let cost; + const fee = claim.value.stream.metadata.fee; + if (fee === undefined) { + resolve({ cost: 0, includesData: true }); + } else if (fee.currency == 'LBC') { + resolve({ cost: fee.amount, includesData: true }); + } else { + begin(); + lbryio.getExchangeRates().then(({ lbc_usd }) => { + resolve({ cost: fee.amount / lbc_usd, includesData: true }); + }); + } + } else { + begin(); + lbry.getCostInfo(uri).then(resolve); + } + }; } - diff --git a/ui/js/actions/file_info.js b/ui/js/actions/file_info.js index 44d76885c..18b438015 100644 --- a/ui/js/actions/file_info.js +++ b/ui/js/actions/file_info.js @@ -1,121 +1,113 @@ -import * as types from 'constants/action_types' -import lbry from 'lbry' +import * as types from 'constants/action_types'; +import lbry from 'lbry'; +import { doFetchClaimListMine } from 'actions/content'; import { - doFetchClaimListMine -} from 'actions/content' + selectClaimsByUri, + selectClaimListMineIsPending +} from 'selectors/claims'; import { - selectClaimsByUri, - selectClaimListMineIsPending, -} from 'selectors/claims' -import { - selectFileListIsPending, - selectAllFileInfos, - selectUrisLoading, -} from 'selectors/file_info' -import { - doCloseModal, -} from 'actions/app' + selectFileListIsPending, + selectAllFileInfos, + selectUrisLoading +} from 'selectors/file_info'; +import { doCloseModal } from 'actions/app'; -const { - shell, -} = require('electron') +const { shell } = require('electron'); export function doFetchFileInfo(uri) { - return function(dispatch, getState) { - const state = getState() - const claim = selectClaimsByUri(state)[uri] - const outpoint = claim ? `${claim.txid}:${claim.nout}` : null - const alreadyFetching = !!selectUrisLoading(state)[uri] + return function(dispatch, getState) { + const state = getState(); + const claim = selectClaimsByUri(state)[uri]; + const outpoint = claim ? `${claim.txid}:${claim.nout}` : null; + const alreadyFetching = !!selectUrisLoading(state)[uri]; - if (!alreadyFetching) { - dispatch({ - type: types.FETCH_FILE_INFO_STARTED, - data: { - outpoint, - } - }) + if (!alreadyFetching) { + dispatch({ + type: types.FETCH_FILE_INFO_STARTED, + data: { + outpoint + } + }); - lbry.file_list({outpoint: outpoint, full_status: true}).then(fileInfos => { - - dispatch({ - type: types.FETCH_FILE_INFO_COMPLETED, - data: { - outpoint, - fileInfo: fileInfos && fileInfos.length ? fileInfos[0] : null, - } - }) - }) - } - } + lbry + .file_list({ outpoint: outpoint, full_status: true }) + .then(fileInfos => { + dispatch({ + type: types.FETCH_FILE_INFO_COMPLETED, + data: { + outpoint, + fileInfo: fileInfos && fileInfos.length ? fileInfos[0] : null + } + }); + }); + } + }; } export function doFileList() { - return function(dispatch, getState) { - const state = getState() - const isPending = selectFileListIsPending(state) + return function(dispatch, getState) { + const state = getState(); + const isPending = selectFileListIsPending(state); - if (!isPending) { - dispatch({ - type: types.FILE_LIST_STARTED, - }) + if (!isPending) { + dispatch({ + type: types.FILE_LIST_STARTED + }); - lbry.file_list().then((fileInfos) => { - dispatch({ - type: types.FILE_LIST_COMPLETED, - data: { - fileInfos, - } - }) - }) - } - } + lbry.file_list().then(fileInfos => { + dispatch({ + type: types.FILE_LIST_COMPLETED, + data: { + fileInfos + } + }); + }); + } + }; } export function doOpenFileInShell(fileInfo) { - return function(dispatch, getState) { - shell.openItem(fileInfo.download_path) - } + return function(dispatch, getState) { + shell.openItem(fileInfo.download_path); + }; } export function doOpenFileInFolder(fileInfo) { - return function(dispatch, getState) { - shell.showItemInFolder(fileInfo.download_path) - } + return function(dispatch, getState) { + shell.showItemInFolder(fileInfo.download_path); + }; } export function doDeleteFile(outpoint, deleteFromComputer) { - return function(dispatch, getState) { + return function(dispatch, getState) { + dispatch({ + type: types.FILE_DELETE, + data: { + outpoint + } + }); - dispatch({ - type: types.FILE_DELETE, - data: { - outpoint - } - }) + lbry.file_delete({ + outpoint: outpoint, + delete_target_file: deleteFromComputer + }); - lbry.file_delete({ - outpoint: outpoint, - delete_target_file: deleteFromComputer, - }) - - dispatch(doCloseModal()) - } + dispatch(doCloseModal()); + }; } - export function doFetchFileInfosAndPublishedClaims() { - return function(dispatch, getState) { - const state = getState(), - isClaimListMinePending = selectClaimListMineIsPending(state), - isFileInfoListPending = selectFileListIsPending(state) + return function(dispatch, getState) { + const state = getState(), + isClaimListMinePending = selectClaimListMineIsPending(state), + isFileInfoListPending = selectFileListIsPending(state); - if (isClaimListMinePending === undefined) { - dispatch(doFetchClaimListMine()) - } + if (isClaimListMinePending === undefined) { + dispatch(doFetchClaimListMine()); + } - if (isFileInfoListPending === undefined) { - dispatch(doFileList()) - } - } + if (isFileInfoListPending === undefined) { + dispatch(doFileList()); + } + }; } - diff --git a/ui/js/actions/rewards.js b/ui/js/actions/rewards.js index 84f65047f..588c9c117 100644 --- a/ui/js/actions/rewards.js +++ b/ui/js/actions/rewards.js @@ -1,36 +1,35 @@ -import * as types from 'constants/action_types' -import lbry from 'lbry' +import * as types from 'constants/action_types'; +import lbry from 'lbry'; import lbryio from 'lbryio'; -import rewards from 'rewards' +import rewards from 'rewards'; export function doFetchRewards() { - return function(dispatch, getState) { - const state = getState() + return function(dispatch, getState) { + const state = getState(); - dispatch({ - type: types.FETCH_REWARDS_STARTED, - }) + dispatch({ + type: types.FETCH_REWARDS_STARTED + }); - lbryio.call('reward', 'list', {}).then(function(userRewards) { - dispatch({ - type: types.FETCH_REWARDS_COMPLETED, - data: { userRewards } - }) - }); - } + lbryio.call('reward', 'list', {}).then(function(userRewards) { + dispatch({ + type: types.FETCH_REWARDS_COMPLETED, + data: { userRewards } + }); + }); + }; } export function doClaimReward(rewardType) { - return function(dispatch, getState) { - try { - rewards.claimReward(rewards[rewardType]) - dispatch({ - type: types.REWARD_CLAIMED, - data: { - reward: rewards[rewardType] - } - }) - } catch(err) { - } - } + return function(dispatch, getState) { + try { + rewards.claimReward(rewards[rewardType]); + dispatch({ + type: types.REWARD_CLAIMED, + data: { + reward: rewards[rewardType] + } + }); + } catch (err) {} + }; } diff --git a/ui/js/actions/search.js b/ui/js/actions/search.js index 149aa78ea..9c4e8f00c 100644 --- a/ui/js/actions/search.js +++ b/ui/js/actions/search.js @@ -1,54 +1,47 @@ -import * as types from 'constants/action_types' -import lbryuri from 'lbryuri' -import lighthouse from 'lighthouse' -import { - doResolveUri, -} from 'actions/content' -import { - doNavigate, - doHistoryPush -} from 'actions/app' -import { - selectCurrentPage, -} from 'selectors/app' +import * as types from 'constants/action_types'; +import lbryuri from 'lbryuri'; +import lighthouse from 'lighthouse'; +import { doResolveUri } from 'actions/content'; +import { doNavigate, doHistoryPush } from 'actions/app'; +import { selectCurrentPage } from 'selectors/app'; export function doSearch(query) { - return function(dispatch, getState) { - const state = getState() - const page = selectCurrentPage(state) + return function(dispatch, getState) { + const state = getState(); + const page = selectCurrentPage(state); - if (!query) { - return dispatch({ - type: types.SEARCH_CANCELLED, - }) - } + if (!query) { + return dispatch({ + type: types.SEARCH_CANCELLED + }); + } - dispatch({ - type: types.SEARCH_STARTED, - data: { query } - }) + dispatch({ + type: types.SEARCH_STARTED, + data: { query } + }); - if(page != 'search') { - dispatch(doNavigate('search', { query: query })) - } else { - lighthouse.search(query).then(results => { - results.forEach(result => { - const uri = lbryuri.build({ - channelName: result.channel_name, - contentName: result.name, - claimId: result.channel_id || result.claim_id, - }) - dispatch(doResolveUri(uri)) - }) + if (page != 'search') { + dispatch(doNavigate('search', { query: query })); + } else { + lighthouse.search(query).then(results => { + results.forEach(result => { + const uri = lbryuri.build({ + channelName: result.channel_name, + contentName: result.name, + claimId: result.channel_id || result.claim_id + }); + dispatch(doResolveUri(uri)); + }); - dispatch({ - type: types.SEARCH_COMPLETED, - data: { - query, - results, - } - }) - }) - } - } + dispatch({ + type: types.SEARCH_COMPLETED, + data: { + query, + results + } + }); + }); + } + }; } diff --git a/ui/js/actions/settings.js b/ui/js/actions/settings.js index a0742d377..714b3b676 100644 --- a/ui/js/actions/settings.js +++ b/ui/js/actions/settings.js @@ -1,31 +1,31 @@ -import * as types from 'constants/action_types' -import lbry from 'lbry' +import * as types from 'constants/action_types'; +import lbry from 'lbry'; export function doFetchDaemonSettings() { - return function(dispatch, getState) { - lbry.settings_get().then((settings) => { - dispatch({ - type: types.DAEMON_SETTINGS_RECEIVED, - data: { - settings - } - }) - }) - } + return function(dispatch, getState) { + lbry.settings_get().then(settings => { + dispatch({ + type: types.DAEMON_SETTINGS_RECEIVED, + data: { + settings + } + }); + }); + }; } export function doSetDaemonSetting(key, value) { - return function(dispatch, getState) { - let settings = {}; - settings[key] = value; - lbry.settings_set(settings).then(settings) - lbry.settings_get().then((settings) => { - dispatch({ - type: types.DAEMON_SETTINGS_RECEIVED, - data: { - settings - } - }) - }) - } -} \ No newline at end of file + return function(dispatch, getState) { + let settings = {}; + settings[key] = value; + lbry.settings_set(settings).then(settings); + lbry.settings_get().then(settings => { + dispatch({ + type: types.DAEMON_SETTINGS_RECEIVED, + data: { + settings + } + }); + }); + }; +} diff --git a/ui/js/actions/wallet.js b/ui/js/actions/wallet.js index 53eccfa67..5b5e941ec 100644 --- a/ui/js/actions/wallet.js +++ b/ui/js/actions/wallet.js @@ -1,125 +1,127 @@ -import * as types from 'constants/action_types' -import lbry from 'lbry' +import * as types from 'constants/action_types'; +import lbry from 'lbry'; import { - selectDraftTransaction, - selectDraftTransactionAmount, - selectBalance, -} from 'selectors/wallet' -import { - doOpenModal, -} from 'actions/app' + selectDraftTransaction, + selectDraftTransactionAmount, + selectBalance +} from 'selectors/wallet'; +import { doOpenModal } from 'actions/app'; export function doUpdateBalance(balance) { - return { - type: types.UPDATE_BALANCE, - data: { - balance: balance - } - } + return { + type: types.UPDATE_BALANCE, + data: { + balance: balance + } + }; } export function doFetchTransactions() { - return function(dispatch, getState) { - dispatch({ - type: types.FETCH_TRANSACTIONS_STARTED - }) + return function(dispatch, getState) { + dispatch({ + type: types.FETCH_TRANSACTIONS_STARTED + }); - lbry.call('transaction_list', {}, (results) => { - dispatch({ - type: types.FETCH_TRANSACTIONS_COMPLETED, - data: { - transactions: results - } - }) - }) - } + lbry.call('transaction_list', {}, results => { + dispatch({ + type: types.FETCH_TRANSACTIONS_COMPLETED, + data: { + transactions: results + } + }); + }); + }; } export function doGetNewAddress() { - return function(dispatch, getState) { - dispatch({ - type: types.GET_NEW_ADDRESS_STARTED - }) + return function(dispatch, getState) { + dispatch({ + type: types.GET_NEW_ADDRESS_STARTED + }); - lbry.wallet_new_address().then(function(address) { - localStorage.setItem('wallet_address', address); - dispatch({ - type: types.GET_NEW_ADDRESS_COMPLETED, - data: { address } - }) - }) - } + lbry.wallet_new_address().then(function(address) { + localStorage.setItem('wallet_address', address); + dispatch({ + type: types.GET_NEW_ADDRESS_COMPLETED, + data: { address } + }); + }); + }; } export function doCheckAddressIsMine(address) { - return function(dispatch, getState) { - dispatch({ - type: types.CHECK_ADDRESS_IS_MINE_STARTED - }) + return function(dispatch, getState) { + dispatch({ + type: types.CHECK_ADDRESS_IS_MINE_STARTED + }); - lbry.checkAddressIsMine(address, (isMine) => { - if (!isMine) dispatch(doGetNewAddress()) + lbry.checkAddressIsMine(address, isMine => { + if (!isMine) dispatch(doGetNewAddress()); - dispatch({ - type: types.CHECK_ADDRESS_IS_MINE_COMPLETED - }) - }) - } + dispatch({ + type: types.CHECK_ADDRESS_IS_MINE_COMPLETED + }); + }); + }; } export function doSendDraftTransaction() { - return function(dispatch, getState) { - const state = getState() - const draftTx = selectDraftTransaction(state) - const balance = selectBalance(state) - const amount = selectDraftTransactionAmount(state) + return function(dispatch, getState) { + const state = getState(); + const draftTx = selectDraftTransaction(state); + const balance = selectBalance(state); + const amount = selectDraftTransactionAmount(state); - if (balance - amount < 1) { - return dispatch(doOpenModal('insufficientBalance')) - } + if (balance - amount < 1) { + return dispatch(doOpenModal('insufficientBalance')); + } - dispatch({ - type: types.SEND_TRANSACTION_STARTED, - }) + dispatch({ + type: types.SEND_TRANSACTION_STARTED + }); - const successCallback = (results) => { - if(results === true) { - dispatch({ - type: types.SEND_TRANSACTION_COMPLETED, - }) - dispatch(doOpenModal('transactionSuccessful')) - } - else { - dispatch({ - type: types.SEND_TRANSACTION_FAILED, - data: { error: results } - }) - dispatch(doOpenModal('transactionFailed')) - } - } + const successCallback = results => { + if (results === true) { + dispatch({ + type: types.SEND_TRANSACTION_COMPLETED + }); + dispatch(doOpenModal('transactionSuccessful')); + } else { + dispatch({ + type: types.SEND_TRANSACTION_FAILED, + data: { error: results } + }); + dispatch(doOpenModal('transactionFailed')); + } + }; - const errorCallback = (error) => { - dispatch({ - type: types.SEND_TRANSACTION_FAILED, - data: { error: error.message } - }) - dispatch(doOpenModal('transactionFailed')) - } + const errorCallback = error => { + dispatch({ + type: types.SEND_TRANSACTION_FAILED, + data: { error: error.message } + }); + dispatch(doOpenModal('transactionFailed')); + }; - lbry.sendToAddress(draftTx.amount, draftTx.address, successCallback, errorCallback); - } + lbry.sendToAddress( + draftTx.amount, + draftTx.address, + successCallback, + errorCallback + ); + }; } export function doSetDraftTransactionAmount(amount) { - return { - type: types.SET_DRAFT_TRANSACTION_AMOUNT, - data: { amount } - } + return { + type: types.SET_DRAFT_TRANSACTION_AMOUNT, + data: { amount } + }; } export function doSetDraftTransactionAddress(address) { - return { - type: types.SET_DRAFT_TRANSACTION_ADDRESS, - data: { address } - } + return { + type: types.SET_DRAFT_TRANSACTION_ADDRESS, + data: { address } + }; } diff --git a/ui/js/app.js b/ui/js/app.js index 2f94dc302..1f1f32ecd 100644 --- a/ui/js/app.js +++ b/ui/js/app.js @@ -3,20 +3,26 @@ import lbry from './lbry.js'; const env = ENV; const config = require(`./config/${env}`); -const language = lbry.getClientSetting('language') ? lbry.getClientSetting('language') : 'en'; -const i18n = require('y18n')({directory: 'app/locales', updateFiles: false, locale: language}); +const language = lbry.getClientSetting('language') + ? lbry.getClientSetting('language') + : 'en'; +const i18n = require('y18n')({ + directory: 'app/locales', + updateFiles: false, + locale: language +}); const logs = []; const app = { - env: env, - config: config, - store: store, - i18n: i18n, - logs: logs, - log: function(message) { - console.log(message); - logs.push(message); - } -} + env: env, + config: config, + store: store, + i18n: i18n, + logs: logs, + log: function(message) { + console.log(message); + logs.push(message); + } +}; window.__ = i18n.__; window.__n = i18n.__n; diff --git a/ui/js/component/app/index.js b/ui/js/component/app/index.js index 5de84e28f..cb67dccd7 100644 --- a/ui/js/component/app/index.js +++ b/ui/js/component/app/index.js @@ -1,26 +1,19 @@ import React from 'react'; -import { connect } from 'react-redux' +import { connect } from 'react-redux'; -import { - selectCurrentModal, -} from 'selectors/app' -import { - doCheckUpgradeAvailable, - doAlertError, -} from 'actions/app' -import { - doUpdateBalance, -} from 'actions/wallet' -import App from './view' +import { selectCurrentModal } from 'selectors/app'; +import { doCheckUpgradeAvailable, doAlertError } from 'actions/app'; +import { doUpdateBalance } from 'actions/wallet'; +import App from './view'; -const select = (state) => ({ - modal: selectCurrentModal(state), -}) +const select = state => ({ + modal: selectCurrentModal(state) +}); -const perform = (dispatch) => ({ - alertError: (errorList) => dispatch(doAlertError(errorList)), - checkUpgradeAvailable: () => dispatch(doCheckUpgradeAvailable()), - updateBalance: (balance) => dispatch(doUpdateBalance(balance)) -}) +const perform = dispatch => ({ + alertError: errorList => dispatch(doAlertError(errorList)), + checkUpgradeAvailable: () => dispatch(doCheckUpgradeAvailable()), + updateBalance: balance => dispatch(doUpdateBalance(balance)) +}); -export default connect(select, perform)(App) +export default connect(select, perform)(App); diff --git a/ui/js/component/app/view.jsx b/ui/js/component/app/view.jsx index 1c7ff4eb4..1c8b2ec1c 100644 --- a/ui/js/component/app/view.jsx +++ b/ui/js/component/app/view.jsx @@ -1,42 +1,42 @@ -import React from 'react' -import Router from 'component/router' +import React from 'react'; +import Router from 'component/router'; import Header from 'component/header'; -import ErrorModal from 'component/errorModal' -import DownloadingModal from 'component/downloadingModal' -import UpgradeModal from 'component/upgradeModal' -import lbry from 'lbry' -import {Line} from 'rc-progress' +import ErrorModal from 'component/errorModal'; +import DownloadingModal from 'component/downloadingModal'; +import UpgradeModal from 'component/upgradeModal'; +import lbry from 'lbry'; +import { Line } from 'rc-progress'; class App extends React.Component { - componentWillMount() { - document.addEventListener('unhandledError', (event) => { - this.props.alertError(event.detail); - }); + componentWillMount() { + document.addEventListener('unhandledError', event => { + this.props.alertError(event.detail); + }); - if (!this.props.upgradeSkipped) { - this.props.checkUpgradeAvailable() - } + if (!this.props.upgradeSkipped) { + this.props.checkUpgradeAvailable(); + } - lbry.balanceSubscribe((balance) => { - this.props.updateBalance(balance) - }) - } + lbry.balanceSubscribe(balance => { + this.props.updateBalance(balance); + }); + } - render() { - const { - modal, - } = this.props + render() { + const { modal } = this.props; - return
-
-
- -
- {modal == 'upgrade' && } - {modal == 'downloading' && } - {modal == 'error' && } -
- } + return ( +
+
+
+ +
+ {modal == 'upgrade' && } + {modal == 'downloading' && } + {modal == 'error' && } +
+ ); + } } -export default App +export default App; diff --git a/ui/js/component/auth.js b/ui/js/component/auth.js index 8bea57b38..579ad46eb 100644 --- a/ui/js/component/auth.js +++ b/ui/js/component/auth.js @@ -1,327 +1,517 @@ -import React from "react"; -import lbry from "../lbry.js"; -import lbryio from "../lbryio.js"; -import Modal from "./modal.js"; -import ModalPage from "./modal-page.js"; -import Link from "component/link" -import {RewardLink} from 'component/reward-link'; -import {FormRow} from "../component/form.js"; -import {CreditAmount, Address} from "../component/common.js"; -import {getLocal, setLocal} from '../utils.js'; -import rewards from '../rewards' - +import React from 'react'; +import lbry from '../lbry.js'; +import lbryio from '../lbryio.js'; +import Modal from './modal.js'; +import ModalPage from './modal-page.js'; +import Link from 'component/link'; +import { RewardLink } from 'component/reward-link'; +import { FormRow } from '../component/form.js'; +import { CreditAmount, Address } from '../component/common.js'; +import { getLocal, setLocal } from '../utils.js'; +import rewards from '../rewards'; class SubmitEmailStage extends React.Component { - constructor(props) { - super(props); + constructor(props) { + super(props); - this.state = { - rewardType: null, - email: '', - submitting: false - }; - } + this.state = { + rewardType: null, + email: '', + submitting: false + }; + } - handleEmailChanged(event) { - this.setState({ - email: event.target.value, - }); - } + handleEmailChanged(event) { + this.setState({ + email: event.target.value + }); + } - onEmailSaved(email) { - this.props.setStage("confirm", { email: email }) - } + onEmailSaved(email) { + this.props.setStage('confirm', { email: email }); + } - handleSubmit(event) { - event.preventDefault(); + handleSubmit(event) { + event.preventDefault(); - this.setState({ - submitting: true, - }); - lbryio.call('user_email', 'new', {email: this.state.email}, 'post').then(() => { - this.onEmailSaved(this.state.email); - }, (error) => { - if (error.xhr && (error.xhr.status == 409 || error.message == __("This email is already in use"))) { - this.onEmailSaved(this.state.email); - return; - } else if (this._emailRow) { - this._emailRow.showError(error.message) - } - this.setState({ submitting: false }); - }); - } + this.setState({ + submitting: true + }); + lbryio.call('user_email', 'new', { email: this.state.email }, 'post').then( + () => { + this.onEmailSaved(this.state.email); + }, + error => { + if ( + error.xhr && + (error.xhr.status == 409 || + error.message == __('This email is already in use')) + ) { + this.onEmailSaved(this.state.email); + return; + } else if (this._emailRow) { + this._emailRow.showError(error.message); + } + this.setState({ submitting: false }); + } + ); + } - render() { - return ( -
-
{ this.handleSubmit(event) }}> - { this._emailRow = ref }} type="text" label={__("Email")} placeholder="scrwvwls@lbry.io" - name="email" value={this.state.email} - onChange={(event) => { this.handleEmailChanged(event) }} /> -
- { this.handleSubmit(event) }} /> -
- -
- ); - } + render() { + return ( +
+
{ + this.handleSubmit(event); + }} + > + { + this._emailRow = ref; + }} + type="text" + label={__('Email')} + placeholder="scrwvwls@lbry.io" + name="email" + value={this.state.email} + onChange={event => { + this.handleEmailChanged(event); + }} + /> +
+ { + this.handleSubmit(event); + }} + /> +
+ +
+ ); + } } class ConfirmEmailStage extends React.Component { - constructor(props) { - super(props); + constructor(props) { + super(props); - this.state = { - rewardType: null, - code: '', - submitting: false, - errorMessage: null, - }; - } + this.state = { + rewardType: null, + code: '', + submitting: false, + errorMessage: null + }; + } - handleCodeChanged(event) { - this.setState({ - code: event.target.value, - }); - } + handleCodeChanged(event) { + this.setState({ + code: event.target.value + }); + } - handleSubmit(event) { - event.preventDefault(); - this.setState({ - submitting: true, - }); + handleSubmit(event) { + event.preventDefault(); + this.setState({ + submitting: true + }); - const onSubmitError = (error) => { - if (this._codeRow) { - this._codeRow.showError(error.message) - } - this.setState({ submitting: false }); - }; + const onSubmitError = error => { + if (this._codeRow) { + this._codeRow.showError(error.message); + } + this.setState({ submitting: false }); + }; - lbryio.call('user_email', 'confirm', {verification_token: this.state.code, email: this.props.email}, 'post').then((userEmail) => { - if (userEmail.is_verified) { - this.props.setStage("welcome") - } else { - onSubmitError(new Error(__("Your email is still not verified."))) //shouldn't happen? - } - }, onSubmitError); - } + lbryio + .call( + 'user_email', + 'confirm', + { verification_token: this.state.code, email: this.props.email }, + 'post' + ) + .then(userEmail => { + if (userEmail.is_verified) { + this.props.setStage('welcome'); + } else { + onSubmitError(new Error(__('Your email is still not verified.'))); //shouldn't happen? + } + }, onSubmitError); + } - render() { - return ( -
-
{ this.handleSubmit(event) }}> - { this._codeRow = ref }} type="text" - name="code" placeholder="a94bXXXXXXXXXXXXXX" value={this.state.code} onChange={(event) => { this.handleCodeChanged(event) }} - helper={__("A verification code is required to access this version.")}/> -
- { this.handleSubmit(event)}} /> -
-
- {__("No code?")} { this.props.setStage("nocode")}} label={__("Click here")} />. -
- -
- ); - } + render() { + return ( +
+
{ + this.handleSubmit(event); + }} + > + { + this._codeRow = ref; + }} + type="text" + name="code" + placeholder="a94bXXXXXXXXXXXXXX" + value={this.state.code} + onChange={event => { + this.handleCodeChanged(event); + }} + helper={__( + 'A verification code is required to access this version.' + )} + /> +
+ { + this.handleSubmit(event); + }} + /> +
+
+ {__('No code?')} + {' '} + { + this.props.setStage('nocode'); + }} + label={__('Click here')} + />. +
+ +
+ ); + } } class WelcomeStage extends React.Component { - static propTypes = { - endAuth: React.PropTypes.func, - } + static propTypes = { + endAuth: React.PropTypes.func + }; - constructor(props) { - super(props); + constructor(props) { + super(props); - this.state = { - hasReward: false, - rewardAmount: null, - }; - } + this.state = { + hasReward: false, + rewardAmount: null + }; + } - onRewardClaim(reward) { - this.setState({ - hasReward: true, - rewardAmount: reward.amount - }) - } + onRewardClaim(reward) { + this.setState({ + hasReward: true, + rewardAmount: reward.amount + }); + } - render() { - return ( - !this.state.hasReward ? - -
-

{__("Welcome to LBRY.")}

-

{__("Using LBRY is like dating a centaur. Totally normal up top, and way different underneath.")}

-

{__("Up top, LBRY is similar to popular media sites.")}

-

{__("Below, LBRY is controlled by users -- you -- via blockchain and decentralization.")}

-

{__("Thank you for making content freedom possible! Here's a nickel, kid.")}

-
- { this.onRewardClaim(event) }} onRewardFailure={() => this.props.setStage(null)} onConfirmed={() => { this.props.setStage(null) }} /> -
-
-
: - { this.props.setStage(null) }}> -
-

{__("About Your Reward")}

-

{__("You earned a reward of ")} {__("LBRY credits, or \"LBC\".")}

-

{__("This reward will show in your Wallet momentarily, probably while you are reading this message.")}

-

{__("LBC is used to compensate creators, to publish, and to have say in how the network works.")}

-

{__("No need to understand it all just yet! Try watching or downloading something next.")}

-

{__("Finally, know that LBRY is an early beta and that it earns the name.")}

-
-
- ); - } + render() { + return !this.state.hasReward + ? +
+

{__('Welcome to LBRY.')}

+

+ {__( + 'Using LBRY is like dating a centaur. Totally normal up top, and way different underneath.' + )} +

+

{__('Up top, LBRY is similar to popular media sites.')}

+

+ {__( + 'Below, LBRY is controlled by users -- you -- via blockchain and decentralization.' + )} +

+

+ {__( + "Thank you for making content freedom possible! Here's a nickel, kid." + )} +

+
+ { + this.onRewardClaim(event); + }} + onRewardFailure={() => this.props.setStage(null)} + onConfirmed={() => { + this.props.setStage(null); + }} + /> +
+
+
+ : { + this.props.setStage(null); + }} + > +
+

{__('About Your Reward')}

+

+ {__('You earned a reward of ')} + {' '} + {' '}{__('LBRY credits, or "LBC".')} +

+

+ {__( + 'This reward will show in your Wallet momentarily, probably while you are reading this message.' + )} +

+

+ {__( + 'LBC is used to compensate creators, to publish, and to have say in how the network works.' + )} +

+

+ {__( + 'No need to understand it all just yet! Try watching or downloading something next.' + )} +

+

+ {__( + 'Finally, know that LBRY is an early beta and that it earns the name.' + )} +

+
+
; + } } -const ErrorStage = (props) => { - return
-

{__("An error was encountered that we cannot continue from.")}

-

{__("At least we're earning the name beta.")}

- { props.errorText ?

{__("Message:")} {props.errorText}

: '' } - { window.location.reload() } } /> -
-} - -const PendingStage = (props) => { - return
-

{__("Preparing for first access")}

-
-} +const ErrorStage = props => { + return ( +
+

{__('An error was encountered that we cannot continue from.')}

+

{__("At least we're earning the name beta.")}

+ {props.errorText ?

{__('Message:')} {props.errorText}

: ''} + { + window.location.reload(); + }} + /> +
+ ); +}; +const PendingStage = props => { + return ( +
+

+ {__('Preparing for first access')} +

+
+ ); +}; class CodeRequiredStage extends React.Component { - constructor(props) { - super(props); + constructor(props) { + super(props); - this._balanceSubscribeId = null + this._balanceSubscribeId = null; - this.state = { - balance: 0, - address: getLocal('wallet_address') - }; - } + this.state = { + balance: 0, + address: getLocal('wallet_address') + }; + } - componentWillMount() { - this._balanceSubscribeId = lbry.balanceSubscribe((balance) => { - this.setState({ - balance: balance - }); - }) + componentWillMount() { + this._balanceSubscribeId = lbry.balanceSubscribe(balance => { + this.setState({ + balance: balance + }); + }); - if (!this.state.address) { - lbry.wallet_unused_address().then((address) => { - setLocal('wallet_address', address); - this.setState({ address: address }); - }); - } - } + if (!this.state.address) { + lbry.wallet_unused_address().then(address => { + setLocal('wallet_address', address); + this.setState({ address: address }); + }); + } + } - componentWillUnmount() { - if (this._balanceSubscribeId) { - lbry.balanceUnsubscribe(this._balanceSubscribeId) - } - } + componentWillUnmount() { + if (this._balanceSubscribeId) { + lbry.balanceUnsubscribe(this._balanceSubscribeId); + } + } - render() { - const disabled = this.state.balance < 1; - return ( -
-
-

{__("Access to LBRY is restricted as we build and scale the network.")}

-

{__("There are two ways in:")}

-

{__("Own LBRY Credits")}

-

{__("If you own at least 1 LBC, you can get in right now.")}

-

{ setLocal('auth_bypassed', true); this.props.setStage(null); }} - disabled={disabled} label={__("Let Me In")} button={ disabled ? "alt" : "primary" } />

-

{__("Your balance is ")}. {__("To increase your balance, send credits to this address:")}

-

-

{__("If you don't understand how to send credits, then...")}

-
-
-

{__("Wait For A Code")}

-

{__("If you provide your email, you'll automatically receive a notification when the system is open.")}

-

{ this.props.setStage("email"); }} label={__("Return")} />

-
-
- ); - } + render() { + const disabled = this.state.balance < 1; + return ( +
+
+

+ {__( + 'Access to LBRY is restricted as we build and scale the network.' + )} +

+

{__('There are two ways in:')}

+

{__('Own LBRY Credits')}

+

{__('If you own at least 1 LBC, you can get in right now.')}

+

+ { + setLocal('auth_bypassed', true); + this.props.setStage(null); + }} + disabled={disabled} + label={__('Let Me In')} + button={disabled ? 'alt' : 'primary'} + /> +

+

+ {__('Your balance is ')}. {__('To increase your balance, send credits to this address:')} +

+

+

+

+

{__("If you don't understand how to send credits, then...")}

+
+
+

{__('Wait For A Code')}

+

+ {__( + "If you provide your email, you'll automatically receive a notification when the system is open." + )} +

+

+ { + this.props.setStage('email'); + }} + label={__('Return')} + /> +

+
+
+ ); + } } - export class AuthOverlay extends React.Component { - constructor(props) { - super(props); + constructor(props) { + super(props); - this._stages = { - pending: PendingStage, - error: ErrorStage, - nocode: CodeRequiredStage, - email: SubmitEmailStage, - confirm: ConfirmEmailStage, - welcome: WelcomeStage - } + this._stages = { + pending: PendingStage, + error: ErrorStage, + nocode: CodeRequiredStage, + email: SubmitEmailStage, + confirm: ConfirmEmailStage, + welcome: WelcomeStage + }; - this.state = { - stage: "pending", - stageProps: {} - }; - } + this.state = { + stage: 'pending', + stageProps: {} + }; + } - setStage(stage, stageProps = {}) { - this.setState({ - stage: stage, - stageProps: stageProps - }) - } + setStage(stage, stageProps = {}) { + this.setState({ + stage: stage, + stageProps: stageProps + }); + } - componentWillMount() { - lbryio.authenticate().then((user) => { - if (!user.has_verified_email) { - if (getLocal('auth_bypassed')) { - this.setStage(null) - } else { - this.setStage("email", {}) - } - } else { - lbryio.call('reward', 'list', {}).then((userRewards) => { - userRewards.filter(function(reward) { - return reward.reward_type == rewards.TYPE_NEW_USER && reward.transaction_id; - }).length ? - this.setStage(null) : - this.setStage("welcome") - }); - } - }).catch((err) => { - this.setStage("error", { errorText: err.message }) - document.dispatchEvent(new CustomEvent('unhandledError', { - detail: { - message: err.message, - data: err.stack - } - })); - }) - } + componentWillMount() { + lbryio + .authenticate() + .then(user => { + if (!user.has_verified_email) { + if (getLocal('auth_bypassed')) { + this.setStage(null); + } else { + this.setStage('email', {}); + } + } else { + lbryio.call('reward', 'list', {}).then(userRewards => { + userRewards.filter(function(reward) { + return ( + reward.reward_type == rewards.TYPE_NEW_USER && + reward.transaction_id + ); + }).length + ? this.setStage(null) + : this.setStage('welcome'); + }); + } + }) + .catch(err => { + this.setStage('error', { errorText: err.message }); + document.dispatchEvent( + new CustomEvent('unhandledError', { + detail: { + message: err.message, + data: err.stack + } + }) + ); + }); + } - render() { - if (!this.state.stage) { - return null; - } - const StageContent = this._stages[this.state.stage]; + render() { + if (!this.state.stage) { + return null; + } + const StageContent = this._stages[this.state.stage]; - if (!StageContent) { - return {__("Unknown authentication step.")} - } + if (!StageContent) { + return ( + {__('Unknown authentication step.')} + ); + } - return ( - this.state.stage != "welcome" ? - -

{__("LBRY Early Access")}

- { this.setStage(stage, stageProps) }} /> -
: - { this.setStage(stage, stageProps) }} {...this.state.stageProps} /> - ); - } + return this.state.stage != 'welcome' + ? +

{__('LBRY Early Access')}

+ { + this.setStage(stage, stageProps); + }} + /> +
+ : { + this.setStage(stage, stageProps); + }} + {...this.state.stageProps} + />; + } } diff --git a/ui/js/component/common.js b/ui/js/component/common.js index cc5578f1a..dc9c02816 100644 --- a/ui/js/component/common.js +++ b/ui/js/component/common.js @@ -3,155 +3,202 @@ import lbry from '../lbry.js'; //component/icon.js export class Icon extends React.Component { - static propTypes = { - icon: React.PropTypes.string.isRequired, - className: React.PropTypes.string, - fixed: React.PropTypes.bool, - } + static propTypes = { + icon: React.PropTypes.string.isRequired, + className: React.PropTypes.string, + fixed: React.PropTypes.bool + }; - render() { - const {fixed, className} = this.props; - const spanClassName = ('icon ' + ('fixed' in this.props ? 'icon-fixed-width ' : '') + - this.props.icon + ' ' + (this.props.className || '')); - return - } + render() { + const { fixed, className } = this.props; + const spanClassName = + 'icon ' + + ('fixed' in this.props ? 'icon-fixed-width ' : '') + + this.props.icon + + ' ' + + (this.props.className || ''); + return ; + } } export class TruncatedText extends React.Component { - static propTypes = { - lines: React.PropTypes.number, - } + static propTypes = { + lines: React.PropTypes.number + }; - static defaultProps = { - lines: null - } + static defaultProps = { + lines: null + }; - render() { - return {this.props.children}; - } + render() { + return ( + + {this.props.children} + + ); + } } export class BusyMessage extends React.Component { - static propTypes = { - message: React.PropTypes.string, - } + static propTypes = { + message: React.PropTypes.string + }; - render() { - return {this.props.message} - } + render() { + return ( + {this.props.message} + ); + } } export class CurrencySymbol extends React.Component { - render() { - return LBC; - } + render() { + return LBC; + } } export class CreditAmount extends React.Component { - static propTypes = { - amount: React.PropTypes.number.isRequired, - precision: React.PropTypes.number, - isEstimate: React.PropTypes.bool, - label: React.PropTypes.bool, - showFree: React.PropTypes.bool, - look: React.PropTypes.oneOf(['indicator', 'plain']), - } + static propTypes = { + amount: React.PropTypes.number.isRequired, + precision: React.PropTypes.number, + isEstimate: React.PropTypes.bool, + label: React.PropTypes.bool, + showFree: React.PropTypes.bool, + look: React.PropTypes.oneOf(['indicator', 'plain']) + }; - static defaultProps = { - precision: 1, - label: true, - showFree: false, - look: 'indicator', - } + static defaultProps = { + precision: 1, + label: true, + showFree: false, + look: 'indicator' + }; - render() { - const formattedAmount = lbry.formatCredits(this.props.amount, this.props.precision); - let amountText; - if (this.props.showFree && parseFloat(formattedAmount) == 0) { - amountText = __('free'); - } else if (this.props.label) { - amountText = formattedAmount + ' ' + (parseFloat(formattedAmount) == 1 ? __('credit') : __('credits')); - } else { - amountText = formattedAmount; - } + render() { + const formattedAmount = lbry.formatCredits( + this.props.amount, + this.props.precision + ); + let amountText; + if (this.props.showFree && parseFloat(formattedAmount) == 0) { + amountText = __('free'); + } else if (this.props.label) { + amountText = + formattedAmount + + ' ' + + (parseFloat(formattedAmount) == 1 ? __('credit') : __('credits')); + } else { + amountText = formattedAmount; + } - return ( - - - {amountText} - - { this.props.isEstimate ? * : null } - - ); - } + return ( + + + {amountText} + + {this.props.isEstimate + ? + * + + : null} + + ); + } } let addressStyle = { - fontFamily: '"Consolas", "Lucida Console", "Adobe Source Code Pro", monospace', + fontFamily: '"Consolas", "Lucida Console", "Adobe Source Code Pro", monospace' }; export class Address extends React.Component { - static propTypes = { - address: React.PropTypes.string, - } + static propTypes = { + address: React.PropTypes.string + }; - constructor(props) { - super(props); + constructor(props) { + super(props); - this._inputElem = null; - } + this._inputElem = null; + } - render() { - return ( - { this._inputElem = input; }} - onFocus={() => { this._inputElem.select(); }} style={addressStyle} readOnly="readonly" value={this.props.address}> - ); - } + render() { + return ( + { + this._inputElem = input; + }} + onFocus={() => { + this._inputElem.select(); + }} + style={addressStyle} + readOnly="readonly" + value={this.props.address} + /> + ); + } } export class Thumbnail extends React.Component { - static propTypes = { - src: React.PropTypes.string, - } + static propTypes = { + src: React.PropTypes.string + }; - handleError() { - if (this.state.imageUrl != this._defaultImageUri) { - this.setState({ - imageUri: this._defaultImageUri, - }); - } - } + handleError() { + if (this.state.imageUrl != this._defaultImageUri) { + this.setState({ + imageUri: this._defaultImageUri + }); + } + } - constructor(props) { - super(props); + constructor(props) { + super(props); - this._defaultImageUri = lbry.imagePath('default-thumb.svg') - this._maxLoadTime = 10000 - this._isMounted = false + this._defaultImageUri = lbry.imagePath('default-thumb.svg'); + this._maxLoadTime = 10000; + this._isMounted = false; - this.state = { - imageUri: this.props.src || this._defaultImageUri, - }; - } + this.state = { + imageUri: this.props.src || this._defaultImageUri + }; + } - componentDidMount() { - this._isMounted = true; - setTimeout(() => { - if (this._isMounted && !this.refs.img.complete) { - this.setState({ - imageUri: this._defaultImageUri, - }); - } - }, this._maxLoadTime); - } + componentDidMount() { + this._isMounted = true; + setTimeout(() => { + if (this._isMounted && !this.refs.img.complete) { + this.setState({ + imageUri: this._defaultImageUri + }); + } + }, this._maxLoadTime); + } - componentWillUnmount() { - this._isMounted = false; - } + componentWillUnmount() { + this._isMounted = false; + } - render() { - const className = this.props.className ? this.props.className : '', - otherProps = Object.assign({}, this.props) - delete otherProps.className; - return { this.handleError() }} {...otherProps} className={className} src={this.state.imageUri} /> - } + render() { + const className = this.props.className ? this.props.className : '', + otherProps = Object.assign({}, this.props); + delete otherProps.className; + return ( + { + this.handleError(); + }} + {...otherProps} + className={className} + src={this.state.imageUri} + /> + ); + } } diff --git a/ui/js/component/downloadingModal/index.jsx b/ui/js/component/downloadingModal/index.jsx index 618f335fb..3fcab8b98 100644 --- a/ui/js/component/downloadingModal/index.jsx +++ b/ui/js/component/downloadingModal/index.jsx @@ -1,25 +1,17 @@ -import React from 'react' -import { - connect -} from 'react-redux' -import { - doStartUpgrade, - doCancelUpgrade, -} from 'actions/app' -import { - selectDownloadProgress, - selectDownloadComplete, -} from 'selectors/app' -import DownloadingModal from './view' +import React from 'react'; +import { connect } from 'react-redux'; +import { doStartUpgrade, doCancelUpgrade } from 'actions/app'; +import { selectDownloadProgress, selectDownloadComplete } from 'selectors/app'; +import DownloadingModal from './view'; -const select = (state) => ({ - downloadProgress: selectDownloadProgress(state), - downloadComplete: selectDownloadComplete(state), -}) +const select = state => ({ + downloadProgress: selectDownloadProgress(state), + downloadComplete: selectDownloadComplete(state) +}); -const perform = (dispatch) => ({ - startUpgrade: () => dispatch(doStartUpgrade()), - cancelUpgrade: () => dispatch(doCancelUpgrade()) -}) +const perform = dispatch => ({ + startUpgrade: () => dispatch(doStartUpgrade()), + cancelUpgrade: () => dispatch(doCancelUpgrade()) +}); -export default connect(select, perform)(DownloadingModal) +export default connect(select, perform)(DownloadingModal); diff --git a/ui/js/component/downloadingModal/view.jsx b/ui/js/component/downloadingModal/view.jsx index 053668437..fb29184f9 100644 --- a/ui/js/component/downloadingModal/view.jsx +++ b/ui/js/component/downloadingModal/view.jsx @@ -1,40 +1,62 @@ -import React from 'react' -import { - Modal -} from 'component/modal' -import {Line} from 'rc-progress'; -import Link from 'component/link' +import React from 'react'; +import { Modal } from 'component/modal'; +import { Line } from 'rc-progress'; +import Link from 'component/link'; class DownloadingModal extends React.Component { - render() { - const { - downloadProgress, - downloadComplete, - startUpgrade, - cancelUpgrade, - } = this.props + render() { + const { + downloadProgress, + downloadComplete, + startUpgrade, + cancelUpgrade + } = this.props; - return ( - - {__("Downloading Update")}{downloadProgress ? `: ${downloadProgress}%` : null} - - {downloadComplete ? ( -
-
-

{__("Click \"Begin Upgrade\" to start the upgrade process.")}

-

{__("The app will close, and you will be prompted to install the latest version of LBRY.")}

-

{__("After the install is complete, please reopen the app.")}

-
- ) : null } -
- {downloadComplete - ? - : null} - -
-
- ) - } + return ( + + {__('Downloading Update')} + {downloadProgress ? `: ${downloadProgress}%` : null} + + {downloadComplete + ?
+
+

{__('Click "Begin Upgrade" to start the upgrade process.')}

+

+ {__( + 'The app will close, and you will be prompted to install the latest version of LBRY.' + )} +

+

+ {__('After the install is complete, please reopen the app.')} +

+
+ : null} +
+ {downloadComplete + ? + : null} + +
+
+ ); + } } -export default DownloadingModal +export default DownloadingModal; diff --git a/ui/js/component/errorModal/index.jsx b/ui/js/component/errorModal/index.jsx index e4e4bc24b..3fb546adc 100644 --- a/ui/js/component/errorModal/index.jsx +++ b/ui/js/component/errorModal/index.jsx @@ -1,23 +1,16 @@ -import React from 'react' -import { - connect -} from 'react-redux' -import { - selectCurrentModal, - selectModalExtraContent, -} from 'selectors/app' -import { - doCloseModal, -} from 'actions/app' -import ErrorModal from './view' +import React from 'react'; +import { connect } from 'react-redux'; +import { selectCurrentModal, selectModalExtraContent } from 'selectors/app'; +import { doCloseModal } from 'actions/app'; +import ErrorModal from './view'; -const select = (state) => ({ - modal: selectCurrentModal(state), - error: selectModalExtraContent(state), -}) +const select = state => ({ + modal: selectCurrentModal(state), + error: selectModalExtraContent(state) +}); -const perform = (dispatch) => ({ - closeModal: () => dispatch(doCloseModal()) -}) +const perform = dispatch => ({ + closeModal: () => dispatch(doCloseModal()) +}); -export default connect(select, perform)(ErrorModal) +export default connect(select, perform)(ErrorModal); diff --git a/ui/js/component/errorModal/view.jsx b/ui/js/component/errorModal/view.jsx index a5cbcd8c7..5994e0771 100644 --- a/ui/js/component/errorModal/view.jsx +++ b/ui/js/component/errorModal/view.jsx @@ -1,54 +1,63 @@ -import React from 'react' -import lbry from 'lbry' -import { - ExpandableModal -} from 'component/modal' +import React from 'react'; +import lbry from 'lbry'; +import { ExpandableModal } from 'component/modal'; class ErrorModal extends React.Component { - render() { - const { - modal, - closeModal, - error - } = this.props + render() { + const { modal, closeModal, error } = this.props; - const errorObj = typeof error === "string" ? { error: error } : error + const errorObj = typeof error === 'string' ? { error: error } : error; - const error_key_labels = { - connectionString: __('API connection string'), - method: __('Method'), - params: __('Parameters'), - code: __('Error code'), - message: __('Error message'), - data: __('Error data'), - } + const error_key_labels = { + connectionString: __('API connection string'), + method: __('Method'), + params: __('Parameters'), + code: __('Error code'), + message: __('Error message'), + data: __('Error data') + }; + const errorInfoList = []; + for (let key of Object.keys(error)) { + let val = typeof error[key] == 'string' + ? error[key] + : JSON.stringify(error[key]); + let label = error_key_labels[key]; + errorInfoList.push( +
  • {label}: {val}
  • + ); + } + const errorInfo = ( +
      {errorInfoList}
    + ); - const errorInfoList = [] - for (let key of Object.keys(error)) { - let val = typeof error[key] == 'string' ? error[key] : JSON.stringify(error[key]); - let label = error_key_labels[key]; - errorInfoList.push(
  • {label}: {val}
  • ); - } - const errorInfo =
      {errorInfoList}
    + return ( + +

    {__('Error')}

    - return( - -

    {__("Error")}

    - -
    -
    -

    {__("We're sorry that LBRY has encountered an error. This has been reported and we will investigate the problem.")}

    -
    -
    - ) - } +
    +
    + +
    +

    + {__( + "We're sorry that LBRY has encountered an error. This has been reported and we will investigate the problem." + )} +

    +
    +
    + ); + } } -export default ErrorModal +export default ErrorModal; diff --git a/ui/js/component/file-selector.js b/ui/js/component/file-selector.js index 786d82caf..acac8749f 100644 --- a/ui/js/component/file-selector.js +++ b/ui/js/component/file-selector.js @@ -1,58 +1,64 @@ import React from 'react'; -const {remote} = require('electron'); +const { remote } = require('electron'); class FileSelector extends React.Component { - static propTypes = { - type: React.PropTypes.oneOf(['file', 'directory']), - initPath: React.PropTypes.string, - onFileChosen: React.PropTypes.func, - } + static propTypes = { + type: React.PropTypes.oneOf(['file', 'directory']), + initPath: React.PropTypes.string, + onFileChosen: React.PropTypes.func + }; - static defaultProps = { - type: 'file', - } + static defaultProps = { + type: 'file' + }; - componentWillMount() { - this.setState({ - path: this.props.initPath || null, - }); - } + componentWillMount() { + this.setState({ + path: this.props.initPath || null + }); + } - handleButtonClick() { - remote.dialog.showOpenDialog({ - properties: [this.props.type == 'file' ? 'openFile' : 'openDirectory'], - }, (paths) => { - if (!paths) { // User hit cancel, so do nothing - return; - } + handleButtonClick() { + remote.dialog.showOpenDialog( + { + properties: [this.props.type == 'file' ? 'openFile' : 'openDirectory'] + }, + paths => { + if (!paths) { + // User hit cancel, so do nothing + return; + } - const path = paths[0]; - this.setState({ - path: path, - }); - if (this.props.onFileChosen) { - this.props.onFileChosen(path); - } - }); - } + const path = paths[0]; + this.setState({ + path: path + }); + if (this.props.onFileChosen) { + this.props.onFileChosen(path); + } + } + ); + } - render() { - return ( -
    - - {' '} - - {this.state.path ? - this.state.path : - __('No File Chosen')} - -
    - ); - } -}; + render() { + return ( +
    + + {' '} + + {this.state.path ? this.state.path : __('No File Chosen')} + +
    + ); + } +} export default FileSelector; diff --git a/ui/js/component/fileActions/index.js b/ui/js/component/fileActions/index.js index 1d8ba6088..6efc48287 100644 --- a/ui/js/component/fileActions/index.js +++ b/ui/js/component/fileActions/index.js @@ -1,75 +1,56 @@ -import React from 'react' +import React from 'react'; +import { connect } from 'react-redux'; +import { selectPlatform } from 'selectors/app'; import { - connect, -} from 'react-redux' + makeSelectFileInfoForUri, + makeSelectDownloadingForUri, + makeSelectLoadingForUri +} from 'selectors/file_info'; +import { makeSelectIsAvailableForUri } from 'selectors/availability'; +import { selectCurrentModal } from 'selectors/app'; +import { makeSelectCostInfoForUri } from 'selectors/cost_info'; +import { doCloseModal, doOpenModal, doHistoryBack } from 'actions/app'; +import { doFetchAvailability } from 'actions/availability'; import { - selectPlatform, -} from 'selectors/app' -import { - makeSelectFileInfoForUri, - makeSelectDownloadingForUri, - makeSelectLoadingForUri, -} from 'selectors/file_info' -import { - makeSelectIsAvailableForUri, -} from 'selectors/availability' -import { - selectCurrentModal, -} from 'selectors/app' -import { - makeSelectCostInfoForUri, -} from 'selectors/cost_info' -import { - doCloseModal, - doOpenModal, - doHistoryBack, -} from 'actions/app' -import { - doFetchAvailability -} from 'actions/availability' -import { - doOpenFileInShell, - doOpenFileInFolder, - doDeleteFile, -} from 'actions/file_info' -import { - doPurchaseUri, - doLoadVideo, -} from 'actions/content' -import FileActions from './view' + doOpenFileInShell, + doOpenFileInFolder, + doDeleteFile +} from 'actions/file_info'; +import { doPurchaseUri, doLoadVideo } from 'actions/content'; +import FileActions from './view'; const makeSelect = () => { - const selectFileInfoForUri = makeSelectFileInfoForUri() - const selectIsAvailableForUri = makeSelectIsAvailableForUri() - const selectDownloadingForUri = makeSelectDownloadingForUri() - const selectCostInfoForUri = makeSelectCostInfoForUri() - const selectLoadingForUri = makeSelectLoadingForUri() + const selectFileInfoForUri = makeSelectFileInfoForUri(); + const selectIsAvailableForUri = makeSelectIsAvailableForUri(); + const selectDownloadingForUri = makeSelectDownloadingForUri(); + const selectCostInfoForUri = makeSelectCostInfoForUri(); + const selectLoadingForUri = makeSelectLoadingForUri(); - const select = (state, props) => ({ - fileInfo: selectFileInfoForUri(state, props), - isAvailable: selectIsAvailableForUri(state, props), - platform: selectPlatform(state), - modal: selectCurrentModal(state), - downloading: selectDownloadingForUri(state, props), - costInfo: selectCostInfoForUri(state, props), - loading: selectLoadingForUri(state, props), - }) + const select = (state, props) => ({ + fileInfo: selectFileInfoForUri(state, props), + isAvailable: selectIsAvailableForUri(state, props), + platform: selectPlatform(state), + modal: selectCurrentModal(state), + downloading: selectDownloadingForUri(state, props), + costInfo: selectCostInfoForUri(state, props), + loading: selectLoadingForUri(state, props) + }); - return select -} + return select; +}; -const perform = (dispatch) => ({ - checkAvailability: (uri) => dispatch(doFetchAvailability(uri)), - closeModal: () => dispatch(doCloseModal()), - openInFolder: (fileInfo) => dispatch(doOpenFileInFolder(fileInfo)), - openInShell: (fileInfo) => dispatch(doOpenFileInShell(fileInfo)), - deleteFile: (fileInfo, deleteFromComputer) => { - dispatch(doHistoryBack()) - dispatch(doDeleteFile(fileInfo, deleteFromComputer)) - }, - openModal: (modal) => dispatch(doOpenModal(modal)), - startDownload: (uri) => dispatch(doPurchaseUri(uri, 'affirmPurchase')), - loadVideo: (uri) => dispatch(doLoadVideo(uri)), -}) +const perform = dispatch => ({ + checkAvailability: uri => dispatch(doFetchAvailability(uri)), + closeModal: () => dispatch(doCloseModal()), + openInFolder: fileInfo => dispatch(doOpenFileInFolder(fileInfo)), + openInShell: fileInfo => dispatch(doOpenFileInShell(fileInfo)), + deleteFile: (fileInfo, deleteFromComputer) => { + dispatch(doHistoryBack()); + dispatch(doDeleteFile(fileInfo, deleteFromComputer)); + }, + openModal: modal => dispatch(doOpenModal(modal)), + startDownload: uri => dispatch(doPurchaseUri(uri, 'affirmPurchase')), + loadVideo: uri => dispatch(doLoadVideo(uri)) +}); -export default connect(makeSelect, perform)(FileActions) \ No newline at end of file +export default connect(makeSelect, perform)(FileActions); diff --git a/ui/js/component/fileActions/view.jsx b/ui/js/component/fileActions/view.jsx index 0d45514f7..4d83f30a9 100644 --- a/ui/js/component/fileActions/view.jsx +++ b/ui/js/component/fileActions/view.jsx @@ -1,151 +1,222 @@ import React from 'react'; -import {Icon,BusyMessage} from 'component/common'; -import FilePrice from 'component/filePrice' -import {Modal} from 'component/modal'; -import {FormField} from 'component/form'; +import { Icon, BusyMessage } from 'component/common'; +import FilePrice from 'component/filePrice'; +import { Modal } from 'component/modal'; +import { FormField } from 'component/form'; import Link from 'component/link'; -import {ToolTip} from 'component/tooltip'; -import {DropDownMenu, DropDownMenuItem} from 'component/menu'; +import { ToolTip } from 'component/tooltip'; +import { DropDownMenu, DropDownMenuItem } from 'component/menu'; class FileActions extends React.Component { - constructor(props) { - super(props) - this.state = { - forceShowActions: false, - deleteChecked: false, - } - } + constructor(props) { + super(props); + this.state = { + forceShowActions: false, + deleteChecked: false + }; + } - componentWillMount() { - this.checkAvailability(this.props.uri) - } + componentWillMount() { + this.checkAvailability(this.props.uri); + } - componentWillReceiveProps(nextProps) { - this.checkAvailability(nextProps.uri) - } + componentWillReceiveProps(nextProps) { + this.checkAvailability(nextProps.uri); + } - checkAvailability(uri) { - if (!this._uri || uri !== this._uri) { - this._uri = uri; - this.props.checkAvailability(uri) - } - } + checkAvailability(uri) { + if (!this._uri || uri !== this._uri) { + this._uri = uri; + this.props.checkAvailability(uri); + } + } - onShowFileActionsRowClicked() { - this.setState({ - forceShowActions: true, - }); - } + onShowFileActionsRowClicked() { + this.setState({ + forceShowActions: true + }); + } - handleDeleteCheckboxClicked(event) { - this.setState({ - deleteChecked: event.target.checked, - }) - } + handleDeleteCheckboxClicked(event) { + this.setState({ + deleteChecked: event.target.checked + }); + } - onAffirmPurchase() { - this.props.closeModal() - this.props.loadVideo(this.props.uri) - } + onAffirmPurchase() { + this.props.closeModal(); + this.props.loadVideo(this.props.uri); + } - render() { - const { - fileInfo, - isAvailable, - platform, - downloading, - uri, - deleteFile, - openInFolder, - openInShell, - modal, - openModal, - closeModal, - startDownload, - costInfo, - loading, - } = this.props + render() { + const { + fileInfo, + isAvailable, + platform, + downloading, + uri, + deleteFile, + openInFolder, + openInShell, + modal, + openModal, + closeModal, + startDownload, + costInfo, + loading + } = this.props; - const deleteChecked = this.state.deleteChecked, - metadata = fileInfo ? fileInfo.metadata : null, - openInFolderMessage = platform.startsWith('Mac') ? __('Open in Finder') : __('Open in Folder'), - showMenu = fileInfo && Object.keys(fileInfo).length > 0, - title = metadata ? metadata.title : uri; + const deleteChecked = this.state.deleteChecked, + metadata = fileInfo ? fileInfo.metadata : null, + openInFolderMessage = platform.startsWith('Mac') + ? __('Open in Finder') + : __('Open in Folder'), + showMenu = fileInfo && Object.keys(fileInfo).length > 0, + title = metadata ? metadata.title : uri; - let content + let content; - if (loading || downloading) { + if (loading || downloading) { + const progress = fileInfo && fileInfo.written_bytes + ? fileInfo.written_bytes / fileInfo.total_bytes * 100 + : 0, + label = fileInfo + ? progress.toFixed(0) + __('% complete') + : __('Connecting...'), + labelWithIcon = ( + + {label} + + ); - const - progress = (fileInfo && fileInfo.written_bytes) ? fileInfo.written_bytes / fileInfo.total_bytes * 100 : 0, - label = fileInfo ? progress.toFixed(0) + __('% complete') : __('Connecting...'), - labelWithIcon = {label}; + content = ( +
    +
    + {labelWithIcon} +
    + {labelWithIcon} +
    + ); + } else if (!fileInfo && isAvailable === undefined) { + content = ; + } else if (!fileInfo && !isAvailable && !this.state.forceShowActions) { + content = ( +
    +
    + {__('Content unavailable.')} +
    + + +
    + ); + } else if (fileInfo === null && !downloading) { + if (!costInfo) { + content = ; + } else { + content = ( + { + startDownload(uri); + }} + /> + ); + } + } else if (fileInfo && fileInfo.download_path) { + content = ( + openInShell(fileInfo)} + /> + ); + } else { + console.log('handle this case of file action props?'); + } - content =
    -
    {labelWithIcon}
    - {labelWithIcon} -
    + return ( +
    + {content} + {showMenu + ? + openInFolder(fileInfo)} + label={openInFolderMessage} + /> + openModal('confirmRemove')} + label={__('Remove...')} + /> + + : ''} + + {__('This will purchase')} {title} {__('for')} + {' '} + {' '}{__('credits')}. + + + {__("You don't have enough LBRY credits to pay for this stream.")} + + + {__('LBRY was unable to download the stream')} {uri}. + + deleteFile(fileInfo.outpoint, deleteChecked)} + onAborted={closeModal} + > +

    + {__("Are you sure you'd like to remove")} {title} + {' '}{__('from LBRY?')} +

    - } else if (!fileInfo && isAvailable === undefined) { - - content = - - } else if (!fileInfo && !isAvailable && !this.state.forceShowActions) { - - content =
    -
    {__("Content unavailable.")}
    - - -
    - - } else if (fileInfo === null && !downloading) { - if (!costInfo) { - content = - } else { - content = { startDownload(uri) } } />; - } - - } else if (fileInfo && fileInfo.download_path) { - content = openInShell(fileInfo)} />; - } else { - console.log('handle this case of file action props?'); - } - - return ( -
    - { content } - { showMenu ? - - openInFolder(fileInfo)} label={openInFolderMessage} /> - openModal('confirmRemove')} label={__("Remove...")} /> - : '' } - - {__("This will purchase")} {title} {__("for")} {__("credits")}. - - - {__("You don't have enough LBRY credits to pay for this stream.")} - - - {__("LBRY was unable to download the stream")} {uri}. - - deleteFile(fileInfo.outpoint, deleteChecked)} - onAborted={closeModal}> -

    {__("Are you sure you'd like to remove")} {title} {__("from LBRY?")}

    - - -
    -
    - ); - } + +
    +
    + ); + } } -export default FileActions +export default FileActions; diff --git a/ui/js/component/fileCard/index.js b/ui/js/component/fileCard/index.js index 89ebc5040..2d17912b9 100644 --- a/ui/js/component/fileCard/index.js +++ b/ui/js/component/fileCard/index.js @@ -1,50 +1,37 @@ -import React from 'react' +import React from 'react'; +import { connect } from 'react-redux'; +import { doNavigate } from 'actions/app'; +import { doResolveUri, doCancelResolveUri } from 'actions/content'; +import { selectObscureNsfw } from 'selectors/app'; import { - connect -} from 'react-redux' -import { - doNavigate, -} from 'actions/app' -import { - doResolveUri, - doCancelResolveUri, -} from 'actions/content' -import { - selectObscureNsfw, -} from 'selectors/app' -import { - makeSelectClaimForUri, - makeSelectMetadataForUri, -} from 'selectors/claims' -import { - makeSelectFileInfoForUri, -} from 'selectors/file_info' -import { - makeSelectIsResolvingForUri, -} from 'selectors/content' -import FileCard from './view' + makeSelectClaimForUri, + makeSelectMetadataForUri +} from 'selectors/claims'; +import { makeSelectFileInfoForUri } from 'selectors/file_info'; +import { makeSelectIsResolvingForUri } from 'selectors/content'; +import FileCard from './view'; const makeSelect = () => { - const selectClaimForUri = makeSelectClaimForUri() - const selectFileInfoForUri = makeSelectFileInfoForUri() - const selectMetadataForUri = makeSelectMetadataForUri() - const selectResolvingUri = makeSelectIsResolvingForUri() + const selectClaimForUri = makeSelectClaimForUri(); + const selectFileInfoForUri = makeSelectFileInfoForUri(); + const selectMetadataForUri = makeSelectMetadataForUri(); + const selectResolvingUri = makeSelectIsResolvingForUri(); - const select = (state, props) => ({ - claim: selectClaimForUri(state, props), - fileInfo: selectFileInfoForUri(state, props), - obscureNsfw: selectObscureNsfw(state), - metadata: selectMetadataForUri(state, props), - isResolvingUri: selectResolvingUri(state, props), - }) + const select = (state, props) => ({ + claim: selectClaimForUri(state, props), + fileInfo: selectFileInfoForUri(state, props), + obscureNsfw: selectObscureNsfw(state), + metadata: selectMetadataForUri(state, props), + isResolvingUri: selectResolvingUri(state, props) + }); - return select -} + return select; +}; -const perform = (dispatch) => ({ - navigate: (path, params) => dispatch(doNavigate(path, params)), - resolveUri: (uri) => dispatch(doResolveUri(uri)), - cancelResolveUri: (uri) => dispatch(doCancelResolveUri(uri)) -}) +const perform = dispatch => ({ + navigate: (path, params) => dispatch(doNavigate(path, params)), + resolveUri: uri => dispatch(doResolveUri(uri)), + cancelResolveUri: uri => dispatch(doCancelResolveUri(uri)) +}); -export default connect(makeSelect, perform)(FileCard) +export default connect(makeSelect, perform)(FileCard); diff --git a/ui/js/component/fileCard/view.jsx b/ui/js/component/fileCard/view.jsx index d333c03c9..36cc68e69 100644 --- a/ui/js/component/fileCard/view.jsx +++ b/ui/js/component/fileCard/view.jsx @@ -2,111 +2,121 @@ import React from 'react'; import lbry from 'lbry.js'; import lbryuri from 'lbryuri.js'; import Link from 'component/link'; -import {Thumbnail, TruncatedText, Icon} from 'component/common'; -import FilePrice from 'component/filePrice' +import { Thumbnail, TruncatedText, Icon } from 'component/common'; +import FilePrice from 'component/filePrice'; import UriIndicator from 'component/uriIndicator'; class FileCard extends React.Component { - componentWillMount() { - this.resolve(this.props) - } + componentWillMount() { + this.resolve(this.props); + } - componentWillReceiveProps(nextProps) { - this.resolve(nextProps) - } + componentWillReceiveProps(nextProps) { + this.resolve(nextProps); + } - resolve(props) { - const { - isResolvingUri, - resolveUri, - claim, - uri, - } = props + resolve(props) { + const { isResolvingUri, resolveUri, claim, uri } = props; - if(!isResolvingUri && claim === undefined && uri) { - resolveUri(uri) - } - } + if (!isResolvingUri && claim === undefined && uri) { + resolveUri(uri); + } + } - componentWillUnmount() { - const { - isResolvingUri, - cancelResolveUri, - uri - } = this.props + componentWillUnmount() { + const { isResolvingUri, cancelResolveUri, uri } = this.props; - if (isResolvingUri) { - cancelResolveUri(uri) - } - } + if (isResolvingUri) { + cancelResolveUri(uri); + } + } - handleMouseOver() { - this.setState({ - hovered: true, - }); - } + handleMouseOver() { + this.setState({ + hovered: true + }); + } - handleMouseOut() { - this.setState({ - hovered: false, - }); - } + handleMouseOut() { + this.setState({ + hovered: false + }); + } - render() { + render() { + const { claim, fileInfo, metadata, isResolvingUri, navigate } = this.props; - const { - claim, - fileInfo, - metadata, - isResolvingUri, - navigate, - } = this.props + const uri = lbryuri.normalize(this.props.uri); + const title = !isResolvingUri && metadata && metadata.title + ? metadata.title + : uri; + const obscureNsfw = this.props.obscureNsfw && metadata && metadata.nsfw; - const uri = lbryuri.normalize(this.props.uri); - const title = !isResolvingUri && metadata && metadata.title ? metadata.title : uri; - const obscureNsfw = this.props.obscureNsfw && metadata && metadata.nsfw; + let description = ''; + if (isResolvingUri) { + description = __('Loading...'); + } else if (metadata && metadata.description) { + description = metadata.description; + } else if (claim === null) { + description = __('This address contains no content.'); + } - let description = "" - if (isResolvingUri) { - description = __("Loading...") - } else if (metadata && metadata.description) { - description = metadata.description - } else if (claim === null) { - description = __("This address contains no content.") - } - - return ( -
    -
    - navigate('/show', { uri })} className="card__link"> -
    -
    {title}
    -
    - - - { fileInfo ? {' '} : '' } - - -
    -
    - {metadata && metadata.thumbnail && -
    - } -
    - {description} -
    - - {obscureNsfw && this.state.hovered - ?
    -

    - {__("This content is Not Safe For Work. To view adult content, please change your")} navigate('settings')} label={__("Settings")} />. -

    -
    - : null} -
    -
    - ); - } + return ( +
    +
    + navigate('/show', { uri })} + className="card__link" + > +
    +
    + {title} +
    +
    + + + {fileInfo + ? {' '} + : ''} + + +
    +
    + {metadata && + metadata.thumbnail && +
    } +
    + {description} +
    + + {obscureNsfw && this.state.hovered + ?
    +

    + {__( + 'This content is Not Safe For Work. To view adult content, please change your' + )} + {' '} navigate('settings')} + label={__('Settings')} + />. +

    +
    + : null} +
    +
    + ); + } } -export default FileCard +export default FileCard; diff --git a/ui/js/component/fileList/index.js b/ui/js/component/fileList/index.js index dd0209b40..3b6ced934 100644 --- a/ui/js/component/fileList/index.js +++ b/ui/js/component/fileList/index.js @@ -1,13 +1,9 @@ -import React from 'react' -import { - connect -} from 'react-redux' -import FileList from './view' +import React from 'react'; +import { connect } from 'react-redux'; +import FileList from './view'; -const select = (state) => ({ -}) +const select = state => ({}); -const perform = (dispatch) => ({ -}) +const perform = dispatch => ({}); -export default connect(select, perform)(FileList) +export default connect(select, perform)(FileList); diff --git a/ui/js/component/fileList/view.jsx b/ui/js/component/fileList/view.jsx index cd85a7b84..8c62944b3 100644 --- a/ui/js/component/fileList/view.jsx +++ b/ui/js/component/fileList/view.jsx @@ -2,92 +2,99 @@ import React from 'react'; import lbry from 'lbry.js'; import lbryuri from 'lbryuri.js'; import Link from 'component/link'; -import {FormField} from 'component/form.js'; +import { FormField } from 'component/form.js'; import FileTile from 'component/fileTile'; import rewards from 'rewards.js'; import lbryio from 'lbryio.js'; -import {BusyMessage, Thumbnail} from 'component/common.js'; +import { BusyMessage, Thumbnail } from 'component/common.js'; class FileList extends React.Component { - constructor(props) { - super(props) + constructor(props) { + super(props); - this.state = { - sortBy: 'date', - } + this.state = { + sortBy: 'date' + }; - this._sortFunctions = { - date: function(fileInfos) { - return fileInfos.slice().reverse(); - }, - title: function(fileInfos) { - return fileInfos.slice().sort(function(fileInfo1, fileInfo2) { - const title1 = fileInfo1.metadata ? fileInfo1.metadata.stream.metadata.title.toLowerCase() : fileInfo1.name; - const title2 = fileInfo2.metadata ? fileInfo2.metadata.stream.metadata.title.toLowerCase() : fileInfo2.name; - if (title1 < title2) { - return -1; - } else if (title1 > title2) { - return 1; - } else { - return 0; - } - }) - }, - filename: function(fileInfos) { - return fileInfos.slice().sort(function({file_name: fileName1}, {file_name: fileName2}) { - const fileName1Lower = fileName1.toLowerCase(); - const fileName2Lower = fileName2.toLowerCase(); - if (fileName1Lower < fileName2Lower) { - return -1; - } else if (fileName2Lower > fileName1Lower) { - return 1; - } else { - return 0; - } - }) - }, - } - } + this._sortFunctions = { + date: function(fileInfos) { + return fileInfos.slice().reverse(); + }, + title: function(fileInfos) { + return fileInfos.slice().sort(function(fileInfo1, fileInfo2) { + const title1 = fileInfo1.metadata + ? fileInfo1.metadata.stream.metadata.title.toLowerCase() + : fileInfo1.name; + const title2 = fileInfo2.metadata + ? fileInfo2.metadata.stream.metadata.title.toLowerCase() + : fileInfo2.name; + if (title1 < title2) { + return -1; + } else if (title1 > title2) { + return 1; + } else { + return 0; + } + }); + }, + filename: function(fileInfos) { + return fileInfos + .slice() + .sort(function({ file_name: fileName1 }, { file_name: fileName2 }) { + const fileName1Lower = fileName1.toLowerCase(); + const fileName2Lower = fileName2.toLowerCase(); + if (fileName1Lower < fileName2Lower) { + return -1; + } else if (fileName2Lower > fileName1Lower) { + return 1; + } else { + return 0; + } + }); + } + }; + } - handleSortChanged(event) { - this.setState({ - sortBy: event.target.value, - }) - } + handleSortChanged(event) { + this.setState({ + sortBy: event.target.value + }); + } - render() { - const { - handleSortChanged, - fetching, - fileInfos, - } = this.props - const { - sortBy, - } = this.state - const content = [] + render() { + const { handleSortChanged, fetching, fileInfos } = this.props; + const { sortBy } = this.state; + const content = []; - this._sortFunctions[sortBy](fileInfos).forEach(fileInfo => { - const uri = lbryuri.build({ - contentName: fileInfo.name, - channelName: fileInfo.channel_name, - }) - content.push() - }) - return ( -
    - { fetching && } - - {__("Sort by")} { ' ' } - - - - - - - {content} -
    - ) - } + this._sortFunctions[sortBy](fileInfos).forEach(fileInfo => { + const uri = lbryuri.build({ + contentName: fileInfo.name, + channelName: fileInfo.channel_name + }); + content.push( + + ); + }); + return ( +
    + {fetching && } + + {__('Sort by')} {' '} + + + + + + + {content} +
    + ); + } } -export default FileList +export default FileList; diff --git a/ui/js/component/fileListSearch/index.js b/ui/js/component/fileListSearch/index.js index ed452052b..c8169c607 100644 --- a/ui/js/component/fileListSearch/index.js +++ b/ui/js/component/fileListSearch/index.js @@ -1,29 +1,23 @@ -import React from 'react' +import React from 'react'; +import { connect } from 'react-redux'; +import { doSearch } from 'actions/search'; import { - connect, -} from 'react-redux' -import { - doSearch, -} from 'actions/search' -import { - selectIsSearching, - selectCurrentSearchResults, - selectSearchQuery, -} from 'selectors/search' -import { - doNavigate, -} from 'actions/app' -import FileListSearch from './view' + selectIsSearching, + selectCurrentSearchResults, + selectSearchQuery +} from 'selectors/search'; +import { doNavigate } from 'actions/app'; +import FileListSearch from './view'; -const select = (state) => ({ - isSearching: selectIsSearching(state), - query: selectSearchQuery(state), - results: selectCurrentSearchResults(state) -}) +const select = state => ({ + isSearching: selectIsSearching(state), + query: selectSearchQuery(state), + results: selectCurrentSearchResults(state) +}); -const perform = (dispatch) => ({ - navigate: (path) => dispatch(doNavigate(path)), - search: (search) => dispatch(doSearch(search)) -}) +const perform = dispatch => ({ + navigate: path => dispatch(doNavigate(path)), + search: search => dispatch(doSearch(search)) +}); -export default connect(select, perform)(FileListSearch) +export default connect(select, perform)(FileListSearch); diff --git a/ui/js/component/fileListSearch/view.jsx b/ui/js/component/fileListSearch/view.jsx index 7666c54fc..0e4d4ef98 100644 --- a/ui/js/component/fileListSearch/view.jsx +++ b/ui/js/component/fileListSearch/view.jsx @@ -3,74 +3,74 @@ import lbry from 'lbry'; import lbryio from 'lbryio'; import lbryuri from 'lbryuri'; import lighthouse from 'lighthouse'; -import FileTile from 'component/fileTile' -import Link from 'component/link' -import {ToolTip} from 'component/tooltip.js'; -import {BusyMessage} from 'component/common.js'; +import FileTile from 'component/fileTile'; +import Link from 'component/link'; +import { ToolTip } from 'component/tooltip.js'; +import { BusyMessage } from 'component/common.js'; -const SearchNoResults = (props) => { - const { - navigate, - query, - } = props +const SearchNoResults = props => { + const { navigate, query } = props; - return
    - - {__("No one has checked anything in for %s yet."), query} { ' ' } - navigate('/publish')} /> - -
    ; + return ( +
    + + {(__('No one has checked anything in for %s yet.'), query)} {' '} + navigate('/publish')} /> + +
    + ); +}; + +const FileListSearchResults = props => { + const { results } = props; + + const rows = [], + seenNames = {}; //fix this when the search API returns claim IDs + + for (let { + name, + claim, + claim_id, + channel_name, + channel_id, + txid, + nout + } of results) { + const uri = lbryuri.build({ + channelName: channel_name, + contentName: name, + claimId: channel_id || claim_id + }); + + rows.push(); + } + return
    {rows}
    ; +}; + +class FileListSearch extends React.Component { + componentWillMount() { + this.props.search(this.props.query); + } + + render() { + const { isSearching, results } = this.props; + + return ( +
    + {isSearching && + !results && + } + + {isSearching && + results && + } + + {results && !!results.length + ? + : } +
    + ); + } } -const FileListSearchResults = (props) => { - const { - results, - } = props - - const rows = [], - seenNames = {}; //fix this when the search API returns claim IDs - - for (let {name, claim, claim_id, channel_name, channel_id, txid, nout} of results) { - const uri = lbryuri.build({ - channelName: channel_name, - contentName: name, - claimId: channel_id || claim_id, - }); - - rows.push( - - ); - } - return ( -
    {rows}
    - ); -} - -class FileListSearch extends React.Component{ - componentWillMount() { - this.props.search(this.props.query) - } - - render() { - const { - isSearching, - results - } = this.props - - return ( -
    - {isSearching && !results && - } - - {isSearching && results && - } - - {(results && !!results.length) ? - : - } -
    - ) - } -} - -export default FileListSearch +export default FileListSearch; diff --git a/ui/js/component/filePrice/index.js b/ui/js/component/filePrice/index.js index 65e870a58..0e8572783 100644 --- a/ui/js/component/filePrice/index.js +++ b/ui/js/component/filePrice/index.js @@ -1,31 +1,27 @@ -import React from 'react' +import React from 'react'; +import { connect } from 'react-redux'; +import { doFetchCostInfoForUri } from 'actions/cost_info'; import { - connect, -} from 'react-redux' -import { - doFetchCostInfoForUri, -} from 'actions/cost_info' -import { - makeSelectCostInfoForUri, - makeSelectFetchingCostInfoForUri, -} from 'selectors/cost_info' -import FilePrice from './view' + makeSelectCostInfoForUri, + makeSelectFetchingCostInfoForUri +} from 'selectors/cost_info'; +import FilePrice from './view'; const makeSelect = () => { - const selectCostInfoForUri = makeSelectCostInfoForUri() - const selectFetchingCostInfoForUri = makeSelectFetchingCostInfoForUri() + const selectCostInfoForUri = makeSelectCostInfoForUri(); + const selectFetchingCostInfoForUri = makeSelectFetchingCostInfoForUri(); - const select = (state, props) => ({ - costInfo: selectCostInfoForUri(state, props), - fetching: selectFetchingCostInfoForUri(state, props), - }) + const select = (state, props) => ({ + costInfo: selectCostInfoForUri(state, props), + fetching: selectFetchingCostInfoForUri(state, props) + }); - return select -} + return select; +}; -const perform = (dispatch) => ({ - fetchCostInfo: (uri) => dispatch(doFetchCostInfoForUri(uri)), - // cancelFetchCostInfo: (uri) => dispatch(doCancelFetchCostInfoForUri(uri)) -}) +const perform = dispatch => ({ + fetchCostInfo: uri => dispatch(doFetchCostInfoForUri(uri)) + // cancelFetchCostInfo: (uri) => dispatch(doCancelFetchCostInfoForUri(uri)) +}); -export default connect(makeSelect, perform)(FilePrice) +export default connect(makeSelect, perform)(FilePrice); diff --git a/ui/js/component/filePrice/view.jsx b/ui/js/component/filePrice/view.jsx index 2a0872492..67b21c545 100644 --- a/ui/js/component/filePrice/view.jsx +++ b/ui/js/component/filePrice/view.jsx @@ -1,44 +1,43 @@ -import React from 'react' -import { - CreditAmount, -} from 'component/common' +import React from 'react'; +import { CreditAmount } from 'component/common'; -class FilePrice extends React.Component{ - componentWillMount() { - this.fetchCost(this.props) - } +class FilePrice extends React.Component { + componentWillMount() { + this.fetchCost(this.props); + } - componentWillReceiveProps(nextProps) { - this.fetchCost(nextProps) - } + componentWillReceiveProps(nextProps) { + this.fetchCost(nextProps); + } - fetchCost(props) { - const { - costInfo, - fetchCostInfo, - uri, - fetching, - } = props + fetchCost(props) { + const { costInfo, fetchCostInfo, uri, fetching } = props; - if (costInfo === undefined && !fetching) { - fetchCostInfo(uri) - } - } + if (costInfo === undefined && !fetching) { + fetchCostInfo(uri); + } + } - render() { - const { - costInfo, - look = 'indicator', - } = this.props + render() { + const { costInfo, look = 'indicator' } = this.props; - const isEstimate = costInfo ? !costInfo.includesData : null + const isEstimate = costInfo ? !costInfo.includesData : null; - if (!costInfo) { - return ???; - } + if (!costInfo) { + return ( + ??? + ); + } - return - } + return ( + + ); + } } -export default FilePrice +export default FilePrice; diff --git a/ui/js/component/fileTile/index.js b/ui/js/component/fileTile/index.js index d61e58b64..2008df1ad 100644 --- a/ui/js/component/fileTile/index.js +++ b/ui/js/component/fileTile/index.js @@ -1,48 +1,36 @@ -import React from 'react' +import React from 'react'; +import { connect } from 'react-redux'; +import { doNavigate } from 'actions/app'; +import { doResolveUri } from 'actions/content'; import { - connect -} from 'react-redux' -import { - doNavigate, -} from 'actions/app' -import { - doResolveUri, -} from 'actions/content' -import { - makeSelectClaimForUri, - makeSelectMetadataForUri, -} from 'selectors/claims' -import { - makeSelectFileInfoForUri, -} from 'selectors/file_info' -import { - selectObscureNsfw, -} from 'selectors/app' -import { - makeSelectIsResolvingForUri, -} from 'selectors/content' -import FileTile from './view' + makeSelectClaimForUri, + makeSelectMetadataForUri +} from 'selectors/claims'; +import { makeSelectFileInfoForUri } from 'selectors/file_info'; +import { selectObscureNsfw } from 'selectors/app'; +import { makeSelectIsResolvingForUri } from 'selectors/content'; +import FileTile from './view'; const makeSelect = () => { - const selectClaimForUri = makeSelectClaimForUri() - const selectFileInfoForUri = makeSelectFileInfoForUri() - const selectMetadataForUri = makeSelectMetadataForUri() - const selectResolvingUri = makeSelectIsResolvingForUri() + const selectClaimForUri = makeSelectClaimForUri(); + const selectFileInfoForUri = makeSelectFileInfoForUri(); + const selectMetadataForUri = makeSelectMetadataForUri(); + const selectResolvingUri = makeSelectIsResolvingForUri(); - const select = (state, props) => ({ - claim: selectClaimForUri(state, props), - fileInfo: selectFileInfoForUri(state, props), - obscureNsfw: selectObscureNsfw(state), - metadata: selectMetadataForUri(state, props), - isResolvingUri: selectResolvingUri(state, props), - }) + const select = (state, props) => ({ + claim: selectClaimForUri(state, props), + fileInfo: selectFileInfoForUri(state, props), + obscureNsfw: selectObscureNsfw(state), + metadata: selectMetadataForUri(state, props), + isResolvingUri: selectResolvingUri(state, props) + }); - return select -} + return select; +}; -const perform = (dispatch) => ({ - navigate: (path, params) => dispatch(doNavigate(path, params)), - resolveUri: (uri) => dispatch(doResolveUri(uri)), -}) +const perform = dispatch => ({ + navigate: (path, params) => dispatch(doNavigate(path, params)), + resolveUri: uri => dispatch(doResolveUri(uri)) +}); -export default connect(makeSelect, perform)(FileTile) \ No newline at end of file +export default connect(makeSelect, perform)(FileTile); diff --git a/ui/js/component/fileTile/view.jsx b/ui/js/component/fileTile/view.jsx index 610ad2d28..1d26f1e17 100644 --- a/ui/js/component/fileTile/view.jsx +++ b/ui/js/component/fileTile/view.jsx @@ -3,113 +3,140 @@ import lbry from 'lbry.js'; import lbryuri from 'lbryuri.js'; import Link from 'component/link'; import FileActions from 'component/fileActions'; -import {Thumbnail, TruncatedText,} from 'component/common.js'; -import FilePrice from 'component/filePrice' +import { Thumbnail, TruncatedText } from 'component/common.js'; +import FilePrice from 'component/filePrice'; import UriIndicator from 'component/uriIndicator'; class FileTile extends React.Component { - static SHOW_EMPTY_PUBLISH = "publish" - static SHOW_EMPTY_PENDING = "pending" + static SHOW_EMPTY_PUBLISH = 'publish'; + static SHOW_EMPTY_PENDING = 'pending'; - constructor(props) { - super(props) - this.state = { - showNsfwHelp: false, - } - } + constructor(props) { + super(props); + this.state = { + showNsfwHelp: false + }; + } - componentDidMount() { - const { - isResolvingUri, - resolveUri, - claim, - uri, - } = this.props + componentDidMount() { + const { isResolvingUri, resolveUri, claim, uri } = this.props; - if(!isResolvingUri && !claim && uri) { - resolveUri(uri) - } - } + if (!isResolvingUri && !claim && uri) { + resolveUri(uri); + } + } - handleMouseOver() { - if (this.props.obscureNsfw && this.props.metadata && this.props.metadata.nsfw) { - this.setState({ - showNsfwHelp: true, - }); - } - } + handleMouseOver() { + if ( + this.props.obscureNsfw && + this.props.metadata && + this.props.metadata.nsfw + ) { + this.setState({ + showNsfwHelp: true + }); + } + } - handleMouseOut() { - if (this.state.showNsfwHelp) { - this.setState({ - showNsfwHelp: false, - }); - } - } + handleMouseOut() { + if (this.state.showNsfwHelp) { + this.setState({ + showNsfwHelp: false + }); + } + } - render() { - const { - claim, - metadata, - isResolvingUri, - showEmpty, - navigate, - hidePrice, - } = this.props + render() { + const { + claim, + metadata, + isResolvingUri, + showEmpty, + navigate, + hidePrice + } = this.props; - const uri = lbryuri.normalize(this.props.uri); - const isClaimed = !!claim; - const isClaimable = lbryuri.isClaimable(uri) - const title = isClaimed && metadata && metadata.title ? metadata.title : uri; - const obscureNsfw = this.props.obscureNsfw && metadata && metadata.nsfw; - let onClick = () => navigate('/show', { uri }) + const uri = lbryuri.normalize(this.props.uri); + const isClaimed = !!claim; + const isClaimable = lbryuri.isClaimable(uri); + const title = isClaimed && metadata && metadata.title + ? metadata.title + : uri; + const obscureNsfw = this.props.obscureNsfw && metadata && metadata.nsfw; + let onClick = () => navigate('/show', { uri }); - let description = "" - if (isClaimed) { - description = metadata && metadata.description - } else if (isResolvingUri) { - description = __("Loading...") - } else if (showEmpty === FileTile.SHOW_EMPTY_PUBLISH) { - onClick = () => navigate('/publish', { }) - description = - {__("This location is unused.")} { ' ' } - { isClaimable && {__("Put something here!")} } - - } else if (showEmpty === FileTile.SHOW_EMPTY_PENDING) { - description = {__("This file is pending confirmation.")} - } + let description = ''; + if (isClaimed) { + description = metadata && metadata.description; + } else if (isResolvingUri) { + description = __('Loading...'); + } else if (showEmpty === FileTile.SHOW_EMPTY_PUBLISH) { + onClick = () => navigate('/publish', {}); + description = ( + + {__('This location is unused.')} {' '} + {isClaimable && + {__('Put something here!')}} + + ); + } else if (showEmpty === FileTile.SHOW_EMPTY_PENDING) { + description = ( + + {__('This file is pending confirmation.')} + + ); + } - return ( -
    - -
    -
    -
    -
    -
    - { !hidePrice ? : null} -
    {uri}
    -

    {title}

    -
    -
    - - {description} - -
    -
    -
    - - {this.state.showNsfwHelp - ?
    -

    - {__("This content is Not Safe For Work. To view adult content, please change your")} navigate('/settings')} label={__("Settings")} />. -

    -
    - : null} -
    - ); - } + return ( +
    + +
    +
    +
    +
    + {!hidePrice ? : null} +
    {uri}
    +

    {title}

    +
    +
    + + {description} + +
    +
    +
    + + {this.state.showNsfwHelp + ?
    +

    + {__( + 'This content is Not Safe For Work. To view adult content, please change your' + )} + {' '} navigate('/settings')} + label={__('Settings')} + />. +

    +
    + : null} +
    + ); + } } -export default FileTile +export default FileTile; diff --git a/ui/js/component/form.js b/ui/js/component/form.js index 809ebe534..299961a44 100644 --- a/ui/js/component/form.js +++ b/ui/js/component/form.js @@ -1,199 +1,259 @@ import React from 'react'; import FileSelector from './file-selector.js'; -import {Icon} from './common.js'; +import { Icon } from './common.js'; var formFieldCounter = 0, - formFieldFileSelectorTypes = ['file', 'directory'], - formFieldNestedLabelTypes = ['radio', 'checkbox']; + formFieldFileSelectorTypes = ['file', 'directory'], + formFieldNestedLabelTypes = ['radio', 'checkbox']; function formFieldId() { - return "form-field-" + (++formFieldCounter); + return 'form-field-' + ++formFieldCounter; } export class FormField extends React.Component { - static propTypes = { - type: React.PropTypes.string.isRequired, - prefix: React.PropTypes.string, - postfix: React.PropTypes.string, - hasError: React.PropTypes.bool - } + static propTypes = { + type: React.PropTypes.string.isRequired, + prefix: React.PropTypes.string, + postfix: React.PropTypes.string, + hasError: React.PropTypes.bool + }; - constructor(props) { - super(props); + constructor(props) { + super(props); - this._fieldRequiredText = __('This field is required'); - this._type = null; - this._element = null; + this._fieldRequiredText = __('This field is required'); + this._type = null; + this._element = null; - this.state = { - isError: null, - errorMessage: null, - }; - } + this.state = { + isError: null, + errorMessage: null + }; + } - componentWillMount() { - if (['text', 'number', 'radio', 'checkbox'].includes(this.props.type)) { - this._element = 'input'; - this._type = this.props.type; - } else if (this.props.type == 'text-number') { - this._element = 'input'; - this._type = 'text'; - } else if (formFieldFileSelectorTypes.includes(this.props.type)) { - this._element = 'input'; - this._type = 'hidden'; - } else { - // Non field, e.g.