Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Commit

Permalink
Issue #245 - localize whitepaper and product briefing links (#270)
Browse files Browse the repository at this point in the history
* Issue #245 - Localize PDF links in footer

* Issue #245 - using componentDidMount instead of componentWillMount
  • Loading branch information
jordajm authored and micahalcorn committed Jun 17, 2018
1 parent 4c39404 commit fbd42da
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/components/footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,16 @@ class Footer extends Component {
constructor(props) {
super(props)

this.state = {
companyWebsiteLanguageAbbrev: 'en'
}

this.localizeApp = this.localizeApp.bind(this)
this.localizeWhitepaperUrl = this.localizeWhitepaperUrl.bind(this)
}

componentDidMount() {
this.localizeWhitepaperUrl()
}

localizeApp(langAbbrev) {
Expand All @@ -18,6 +27,13 @@ class Footer extends Component {
}
}

localizeWhitepaperUrl() {
const { selectedLanguageAbbrev: langAbbrev } = this.props
const companyWebsiteLanguageAbbrev = langAbbrev === 'zh' ? `${langAbbrev}_Hans` : langAbbrev

this.setState({ companyWebsiteLanguageAbbrev })
}

render() {
return (
<footer className="dark-footer">
Expand Down Expand Up @@ -72,15 +88,15 @@ class Footer extends Component {
</div>
<ul className="footer-links">
<li>
<a href="https://www.originprotocol.com/product-brief">
<a href={ `https://www.originprotocol.com/${this.state.companyWebsiteLanguageAbbrev}/product-brief` }>
<FormattedMessage
id={ 'footer.productBriefLink' }
defaultMessage={ 'Product Brief' }
/>
</a>
</li>
<li>
<a href="https://www.originprotocol.com/whitepaper">
<a href={ `https://www.originprotocol.com/${this.state.companyWebsiteLanguageAbbrev}/whitepaper` }>
<FormattedMessage
id={ 'footer.whitepaperLink' }
defaultMessage={ 'Whitepaper' }
Expand Down

0 comments on commit fbd42da

Please sign in to comment.