Skip to content

Commit

Permalink
MM-13476 Fix for channel types are not being translated in channel si…
Browse files Browse the repository at this point in the history
…debar (mattermost#2191)
  • Loading branch information
sudheerDev committed Dec 13, 2018
1 parent b730e45 commit 9608e5e
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion components/sidebar/channel_name.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'];

Expand All @@ -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;

Expand All @@ -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}
/>
);
Expand Down

0 comments on commit 9608e5e

Please sign in to comment.