Commit ccf761a9 authored by Sudheer's avatar Sudheer Committed by sudheer

MM-13476 Fix for channel types are not being translated in channel sidebar (#2191)

parent 9b986fda
......@@ -7,6 +7,7 @@ import {OverlayTrigger, Tooltip} from 'react-bootstrap';
import {PropTypes} from 'prop-types';
import * as Utils from 'utils/utils.jsx';
import {t} from 'utils/i18n';
const clickableChannelHeader = ['recent', 'alpha'];
......@@ -17,6 +18,25 @@ export default class ChannelName extends React.PureComponent {
browsePublicDirectChannels: PropTypes.func.isRequired,
};
sectionTypeFormatMessageId = (sectionType) => {
switch (sectionType) {
case 'public':
return t('sidebar.types.public');
case 'private':
return t('sidebar.types.private');
case 'direct':
return t('sidebar.types.direct');
case 'favorite':
return t('sidebar.types.favorite');
case 'unreads':
return t('sidebar.types.unreads');
case 'recent':
return t('sidebar.types.recent');
default:
return t('sidebar.types.alpha');
}
}
render() {
const {sectionType, channelName, browsePublicDirectChannels} = this.props;
......@@ -26,9 +46,10 @@ export default class ChannelName extends React.PureComponent {
tooltipTriggers = [];
}
const formattedMessageId = this.sectionTypeFormatMessageId(sectionType);
let name = (
<FormattedMessage
id={`sidebar.types.${sectionType}`}
id={formattedMessageId}
defaultMessage={channelName}
/>
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment