From 81af1bb274143541ce88ffad4095dd15ee8a5987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Fri, 25 Jun 2021 20:52:24 +0200 Subject: [PATCH 1/3] Make promo panel items localizable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- app/soapbox/features/ui/components/promo_panel.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/soapbox/features/ui/components/promo_panel.js b/app/soapbox/features/ui/components/promo_panel.js index 08311346c..38b242738 100644 --- a/app/soapbox/features/ui/components/promo_panel.js +++ b/app/soapbox/features/ui/components/promo_panel.js @@ -1,22 +1,26 @@ import React from 'react'; +import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import Icon from 'soapbox/components/icon'; import { connect } from 'react-redux'; +import { getSettings } from 'soapbox/actions/settings'; import { getSoapboxConfig } from 'soapbox/actions/soapbox'; const mapStateToProps = state => ({ promoItems: getSoapboxConfig(state).getIn(['promoPanel', 'items']), + locale: getSettings(state).get('locale'), }); export default @connect(mapStateToProps) class PromoPanel extends React.PureComponent { static propTypes = { + locale: PropTypes.string, promoItems: ImmutablePropTypes.list, } render() { - const { promoItems } = this.props; + const { locale, promoItems } = this.props; if (!promoItems) return null; return ( @@ -25,7 +29,7 @@ class PromoPanel extends React.PureComponent { {promoItems.map((item, i) => ( - {item.get('text')} + {item.getIn(['textLocales', locale]) || item.get('text')} ), )} From ecdbb80c35348ea08d334082b217b05b3a7a3f69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Fri, 25 Jun 2021 20:56:39 +0200 Subject: [PATCH 2/3] Make footer items localizable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- app/soapbox/features/public_layout/components/footer.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/soapbox/features/public_layout/components/footer.js b/app/soapbox/features/public_layout/components/footer.js index d34248bc4..3da2588d6 100644 --- a/app/soapbox/features/public_layout/components/footer.js +++ b/app/soapbox/features/public_layout/components/footer.js @@ -5,6 +5,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { Link } from 'react-router-dom'; import { List as ImmutableList } from 'immutable'; +import { getSettings } from 'soapbox/actions/settings'; import { getSoapboxConfig } from 'soapbox/actions/soapbox'; const mapStateToProps = (state, props) => { @@ -13,6 +14,7 @@ const mapStateToProps = (state, props) => { return { copyright: soapboxConfig.get('copyright'), navlinks: soapboxConfig.getIn(['navlinks', 'homeFooter'], ImmutableList()), + locale: getSettings(state).get('locale'), }; }; @@ -25,7 +27,7 @@ class Footer extends ImmutablePureComponent { } render() { - const { copyright, navlinks } = this.props; + const { copyright, locale, navlinks } = this.props; return (
@@ -36,7 +38,7 @@ class Footer extends ImmutablePureComponent {
    {navlinks.map((link, i) => (
  • - {link.get('title')} + {link.getIn(['titleLocales', locale]) || link.get('title')}
  • ))}
From ecbad41bd9f3800532fd1f639225b09d05036b55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Fri, 25 Jun 2021 21:01:10 +0200 Subject: [PATCH 3/3] proptypes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- app/soapbox/features/public_layout/components/footer.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/soapbox/features/public_layout/components/footer.js b/app/soapbox/features/public_layout/components/footer.js index 3da2588d6..1c6d38354 100644 --- a/app/soapbox/features/public_layout/components/footer.js +++ b/app/soapbox/features/public_layout/components/footer.js @@ -23,6 +23,7 @@ class Footer extends ImmutablePureComponent { static propTypes = { copyright: PropTypes.string, + locale: PropTypes.string, navlinks: ImmutablePropTypes.list, } @@ -38,7 +39,9 @@ class Footer extends ImmutablePureComponent {
    {navlinks.map((link, i) => (
  • - {link.getIn(['titleLocales', locale]) || link.get('title')} + + {link.getIn(['titleLocales', locale]) || link.get('title')} +
  • ))}