Make footer items localizable

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2021-06-25 20:56:39 +02:00
parent 81af1bb274
commit ecdbb80c35

View file

@ -5,6 +5,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { List as ImmutableList } from 'immutable'; import { List as ImmutableList } from 'immutable';
import { getSettings } from 'soapbox/actions/settings';
import { getSoapboxConfig } from 'soapbox/actions/soapbox'; import { getSoapboxConfig } from 'soapbox/actions/soapbox';
const mapStateToProps = (state, props) => { const mapStateToProps = (state, props) => {
@ -13,6 +14,7 @@ const mapStateToProps = (state, props) => {
return { return {
copyright: soapboxConfig.get('copyright'), copyright: soapboxConfig.get('copyright'),
navlinks: soapboxConfig.getIn(['navlinks', 'homeFooter'], ImmutableList()), navlinks: soapboxConfig.getIn(['navlinks', 'homeFooter'], ImmutableList()),
locale: getSettings(state).get('locale'),
}; };
}; };
@ -25,7 +27,7 @@ class Footer extends ImmutablePureComponent {
} }
render() { render() {
const { copyright, navlinks } = this.props; const { copyright, locale, navlinks } = this.props;
return ( return (
<div className='footer'> <div className='footer'>
@ -36,7 +38,7 @@ class Footer extends ImmutablePureComponent {
<ul> <ul>
{navlinks.map((link, i) => ( {navlinks.map((link, i) => (
<li key={i}> <li key={i}>
<Link to={link.get('url')}>{link.get('title')}</Link> <Link to={link.get('url')}>{link.getIn(['titleLocales', locale]) || link.get('title')}</Link>
</li> </li>
))} ))}
</ul> </ul>