Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added translations for "edited" label in chats #4776

Merged
merged 8 commits into from
Aug 27, 2021
6 changes: 4 additions & 2 deletions src/components/HTMLEngineProvider/BaseHTMLEngineProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import ThumbnailImage from '../ThumbnailImage';
import variables from '../../styles/variables';
import themeColors from '../../styles/themes/default';
import Text from '../Text';
import withLocalize from '../withLocalize';

const propTypes = {
/** Whether text elements should be selectable */
Expand Down Expand Up @@ -136,7 +137,7 @@ function EditedRenderer(props) {
>
{/* Native devices do not support margin between nested text */}
<Text style={styles.w1}>{' '}</Text>
(edited)
{props.translate('reportActionCompose.edited')}
</Text>
);
}
Expand Down Expand Up @@ -211,7 +212,7 @@ const renderers = {
a: AnchorRenderer,
code: CodeRenderer,
img: ImgRenderer,
edited: EditedRenderer,
edited: withLocalize(EditedRenderer),
};

const renderersProps = {
Expand All @@ -233,6 +234,7 @@ const defaultViewProps = {style: {alignItems: 'flex-start'}};
const BaseHTMLEngineProvider = ({children, textSelectable}) => {
// We need to memoize this prop to make it referentially stable.
const defaultTextProps = useMemo(() => ({selectable: textSelectable}), [textSelectable]);

return (
<TRenderEngineProvider
customHTMLElementModels={customHTMLElementModels}
Expand Down
1 change: 1 addition & 0 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export default {
fileUploadFailed: 'Upload Failed. File is not supported.',
roomIsArchived: 'This chat room has been deleted',
localTime: ({user, time}) => `It's ${time} for ${user}`,
edited: '(edited)',
emoji: 'Emoji',
},
reportActionContextMenu: {
Expand Down
1 change: 1 addition & 0 deletions src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export default {
fileUploadFailed: 'Subida fallida. El archivo no es compatible.',
roomIsArchived: 'Esta sala de chat ha sido eliminada',
localTime: ({user, time}) => `Son las ${time} para ${user}`,
edited: '(editado)',
emoji: 'Emoji',
},
reportActionContextMenu: {
Expand Down
12 changes: 10 additions & 2 deletions src/pages/home/report/ReportActionItemFragment.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import Text from '../../../components/Text';
import Tooltip from '../../../components/Tooltip';
import {isSingleEmoji} from '../../../libs/ValidationUtils';
import withWindowDimensions, {windowDimensionsPropTypes} from '../../../components/withWindowDimensions';
import withLocalize, {withLocalizePropTypes} from '../../../components/withLocalize';
import canUseTouchScreen from '../../../libs/canUseTouchscreen';
import compose from '../../../libs/compose';

const propTypes = {
/** The message fragment needing to be displayed */
Expand All @@ -30,6 +32,9 @@ const propTypes = {
isSingleLine: PropTypes.bool,

...windowDimensionsPropTypes,

/** localization props */
...withLocalizePropTypes,
};

const defaultProps = {
Expand Down Expand Up @@ -76,7 +81,7 @@ class ReportActionItemFragment extends React.PureComponent {
>
{/* Native devices do not support margin between nested text */}
<Text style={styles.w1}>{' '}</Text>
(edited)
{this.props.translate('reportActionCompose.edited')}
</Text>
)}
</Text>
Expand Down Expand Up @@ -117,4 +122,7 @@ ReportActionItemFragment.propTypes = propTypes;
ReportActionItemFragment.defaultProps = defaultProps;
ReportActionItemFragment.displayName = 'ReportActionItemFragment';

export default withWindowDimensions(ReportActionItemFragment);
export default compose(
withWindowDimensions,
withLocalize,
)(ReportActionItemFragment);