From 215c61d460462346ee31355f4393dd181aa333eb Mon Sep 17 00:00:00 2001 From: Andre Fonseca Date: Wed, 28 Dec 2022 16:31:06 +0000 Subject: [PATCH 1/6] try the other translate --- .../home/report/ContextMenu/PopoverReportActionContextMenu.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js index da1c83348f5e..a4e77b5707bd 100644 --- a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js +++ b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js @@ -9,6 +9,7 @@ import withLocalize, {withLocalizePropTypes} from '../../../../components/withLo import PopoverWithMeasuredContent from '../../../../components/PopoverWithMeasuredContent'; import BaseReportActionContextMenu from './BaseReportActionContextMenu'; import ConfirmModal from '../../../../components/ConfirmModal'; +import * as Localize from "../../../../libs/Localize"; const propTypes = { /** Flag to check if the chat participant is Chronos */ @@ -315,7 +316,7 @@ class PopoverReportActionContextMenu extends React.Component { /> Date: Wed, 28 Dec 2022 16:36:13 +0000 Subject: [PATCH 2/6] this was breaking everything, and it wasn't the "" weird --- .../home/report/ContextMenu/PopoverReportActionContextMenu.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js index a4e77b5707bd..8139810dfb9e 100644 --- a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js +++ b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js @@ -9,7 +9,7 @@ import withLocalize, {withLocalizePropTypes} from '../../../../components/withLo import PopoverWithMeasuredContent from '../../../../components/PopoverWithMeasuredContent'; import BaseReportActionContextMenu from './BaseReportActionContextMenu'; import ConfirmModal from '../../../../components/ConfirmModal'; -import * as Localize from "../../../../libs/Localize"; +import * as Localize from '../../../../libs/Localize'; const propTypes = { /** Flag to check if the chat participant is Chronos */ From 11f61dc517b8c0b858c6f3eea16ca9d4b05fed3a Mon Sep 17 00:00:00 2001 From: Andre Fonseca Date: Wed, 28 Dec 2022 16:52:43 +0000 Subject: [PATCH 3/6] I think it's missing this --- .../home/report/ContextMenu/PopoverReportActionContextMenu.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js index 8139810dfb9e..c5b7d5694918 100644 --- a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js +++ b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js @@ -75,7 +75,8 @@ class PopoverReportActionContextMenu extends React.Component { shouldComponentUpdate(nextProps, nextState) { return this.state.isPopoverVisible !== nextState.isPopoverVisible || this.state.popoverAnchorPosition !== nextState.popoverAnchorPosition - || this.state.isDeleteCommentConfirmModalVisible !== nextState.isDeleteCommentConfirmModalVisible; + || this.state.isDeleteCommentConfirmModalVisible !== nextState.isDeleteCommentConfirmModalVisible + || this.props.preferredLocale !== this.nextProps.preferredLocale; } componentWillUnmount() { From 6746afacfd19a603c8d945a0ed4c87e2236079f4 Mon Sep 17 00:00:00 2001 From: Andre Fonseca Date: Wed, 28 Dec 2022 17:07:50 +0000 Subject: [PATCH 4/6] trying a few things --- .../PopoverReportActionContextMenu.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js index c5b7d5694918..56ea09ed9988 100644 --- a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js +++ b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js @@ -10,6 +10,10 @@ import PopoverWithMeasuredContent from '../../../../components/PopoverWithMeasur import BaseReportActionContextMenu from './BaseReportActionContextMenu'; import ConfirmModal from '../../../../components/ConfirmModal'; import * as Localize from '../../../../libs/Localize'; +import {withOnyx} from 'react-native-onyx'; +import ONYXKEYS from '../../../../ONYXKEYS'; +import compose from '../../../../libs/compose'; +import lodashGet from "lodash/get"; const propTypes = { /** Flag to check if the chat participant is Chronos */ @@ -73,10 +77,12 @@ class PopoverReportActionContextMenu extends React.Component { } shouldComponentUpdate(nextProps, nextState) { + const previousLocale = lodashGet(this.props, 'preferredLocale', 'en'); + const nextLocale = lodashGet(nextProps, 'preferredLocale', 'en'); return this.state.isPopoverVisible !== nextState.isPopoverVisible || this.state.popoverAnchorPosition !== nextState.popoverAnchorPosition || this.state.isDeleteCommentConfirmModalVisible !== nextState.isDeleteCommentConfirmModalVisible - || this.props.preferredLocale !== this.nextProps.preferredLocale; + || previousLocale !== nextLocale; } componentWillUnmount() { @@ -336,4 +342,12 @@ class PopoverReportActionContextMenu extends React.Component { PopoverReportActionContextMenu.propTypes = propTypes; PopoverReportActionContextMenu.defaultProps = defaultProps; -export default withLocalize(PopoverReportActionContextMenu); +export default compose( + withLocalize, + withOnyx({ + preferredLocale: { + key: ONYXKEYS.NVP_PREFERRED_LOCALE, + }, + }, + ) +)(PopoverReportActionContextMenu); From 34fad51bf02912ef199ece7b2f6d336ceafc92d3 Mon Sep 17 00:00:00 2001 From: Andre Fonseca Date: Wed, 28 Dec 2022 17:09:44 +0000 Subject: [PATCH 5/6] cleaning things up --- .../PopoverReportActionContextMenu.js | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js index 56ea09ed9988..331e847cd1bd 100644 --- a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js +++ b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js @@ -9,10 +9,6 @@ import withLocalize, {withLocalizePropTypes} from '../../../../components/withLo import PopoverWithMeasuredContent from '../../../../components/PopoverWithMeasuredContent'; import BaseReportActionContextMenu from './BaseReportActionContextMenu'; import ConfirmModal from '../../../../components/ConfirmModal'; -import * as Localize from '../../../../libs/Localize'; -import {withOnyx} from 'react-native-onyx'; -import ONYXKEYS from '../../../../ONYXKEYS'; -import compose from '../../../../libs/compose'; import lodashGet from "lodash/get"; const propTypes = { @@ -323,7 +319,7 @@ class PopoverReportActionContextMenu extends React.Component { /> Date: Wed, 28 Dec 2022 17:17:43 +0000 Subject: [PATCH 6/6] linter --- .../home/report/ContextMenu/PopoverReportActionContextMenu.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js index 331e847cd1bd..2f174ce5ccf2 100644 --- a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js +++ b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js @@ -4,12 +4,12 @@ import { } from 'react-native'; import _ from 'underscore'; import PropTypes from 'prop-types'; +import lodashGet from 'lodash/get'; import * as Report from '../../../../libs/actions/Report'; import withLocalize, {withLocalizePropTypes} from '../../../../components/withLocalize'; import PopoverWithMeasuredContent from '../../../../components/PopoverWithMeasuredContent'; import BaseReportActionContextMenu from './BaseReportActionContextMenu'; import ConfirmModal from '../../../../components/ConfirmModal'; -import lodashGet from "lodash/get"; const propTypes = { /** Flag to check if the chat participant is Chronos */