RocketChat/Rocket.Chat

View on GitHub
apps/meteor/client/views/room/Header/icons/Translate.tsx

Summary

Maintainability
A
2 hrs
Test Coverage
import type { IRoom } from '@rocket.chat/core-typings';
import { useSetting, useTranslation } from '@rocket.chat/ui-contexts';
import React, { memo } from 'react';

import { HeaderState } from '../../../../components/Header';

type TranslateProps = {
    room: IRoom;
};

const Translate = ({ room: { autoTranslateLanguage, autoTranslate } }: TranslateProps) => {
    const t = useTranslation();
    const autoTranslateEnabled = useSetting('AutoTranslate_Enabled');
    const encryptedLabel = t('Translated');
    return autoTranslateEnabled && autoTranslate && autoTranslateLanguage ? (
        <HeaderState title={encryptedLabel} icon='language' color='info' />
    ) : null;
};

export default memo(Translate);