diff --git a/.changeset/new-poems-compare.md b/.changeset/new-poems-compare.md
new file mode 100644
index 0000000000000..84a83bc6e5cff
--- /dev/null
+++ b/.changeset/new-poems-compare.md
@@ -0,0 +1,5 @@
+---
+"@rocket.chat/meteor": patch
+---
+
+Fixes a missing translation on the create channel/team modal
diff --git a/apps/meteor/client/NavBarV2/NavBarPagesGroup/actions/useEncryptedRoomDescription.spec.tsx b/apps/meteor/client/NavBarV2/NavBarPagesGroup/actions/useEncryptedRoomDescription.spec.tsx
index 06757f1c03225..28f288d76797f 100644
--- a/apps/meteor/client/NavBarV2/NavBarPagesGroup/actions/useEncryptedRoomDescription.spec.tsx
+++ b/apps/meteor/client/NavBarV2/NavBarPagesGroup/actions/useEncryptedRoomDescription.spec.tsx
@@ -54,3 +54,80 @@ describe.each([
});
});
});
+
+describe('useEncryptedRoomDescription, Portuguese (pt-BR)', () => {
+ it('returns "Encrypted_not_available" when channel is not private and E2E is enabled,', () => {
+ const { result } = renderHook(() => useEncryptedRoomDescription('channel'), {
+ wrapper: mockAppRoot()
+ .withSetting('E2E_Enable', true)
+ .withDefaultLanguage('pt-BR')
+ .withTranslations('pt-BR', 'core', {
+ Encrypted_not_available: 'Indisponível para {{roomType}} público',
+ channel: 'canal',
+ team: 'equipe',
+ })
+ .build(),
+ });
+ const describe = result.current;
+
+ expect(describe({ isPrivate: false, encrypted: false })).toBe('Indisponível para canal público');
+ });
+
+ it('returns "Encrypted_not_available" when team is not private and E2E is enabled,', () => {
+ const { result } = renderHook(() => useEncryptedRoomDescription('team'), {
+ wrapper: mockAppRoot()
+ .withSetting('E2E_Enable', true)
+ .withDefaultLanguage('pt-BR')
+ .withTranslations('pt-BR', 'core', {
+ Encrypted_not_available: 'Indisponível para {{roomType}} público',
+ channel: 'canal',
+ team: 'equipe',
+ })
+ .build(),
+ });
+ const describe = result.current;
+
+ expect(describe({ isPrivate: false, encrypted: false })).toBe('Indisponível para equipe público');
+ });
+
+ it('returns "Encrypted_messages" when channel is private and encrypted are true and E2E is enabled', () => {
+ const { result } = renderHook(() => useEncryptedRoomDescription('channel'), {
+ wrapper: mockAppRoot()
+ .withSetting('E2E_Enable', true)
+ .withDefaultLanguage('pt-BR')
+ .withTranslations('pt-BR', 'core', {
+ // TODO: Improve the portuguese translation with a way to captalize the room type for it to be in the start of the sentence
+ Encrypted_messages:
+ 'Criptografado de ponta a ponta {{roomType}}. A pesquisa não funcionará com {{roomType}} criptografado e as notificações podem não mostrar o conteúdo das mensagens.',
+ team: 'equipe',
+ channel: 'canal',
+ })
+ .build(),
+ });
+ const describe = result.current;
+
+ expect(describe({ isPrivate: true, encrypted: true })).toBe(
+ 'Criptografado de ponta a ponta canal. A pesquisa não funcionará com canal criptografado e as notificações podem não mostrar o conteúdo das mensagens.',
+ );
+ });
+
+ it('returns "Encrypted_messages" when team is private and encrypted are true and E2E is enabled', () => {
+ const { result } = renderHook(() => useEncryptedRoomDescription('team'), {
+ wrapper: mockAppRoot()
+ .withSetting('E2E_Enable', true)
+ .withTranslations('pt-BR', 'core', {
+ Encrypted_messages:
+ 'Criptografado de ponta a ponta {{roomType}}. A pesquisa não funcionará com {{roomType}} criptografado e as notificações podem não mostrar o conteúdo das mensagens.',
+ channel: 'canal',
+ team: 'equipe',
+ })
+ .withDefaultLanguage('pt-BR')
+ .build(),
+ });
+ const describe = result.current;
+
+ expect(describe({ isPrivate: true, encrypted: true })).toBe(
+ 'Criptografado de ponta a ponta equipe. A pesquisa não funcionará com equipe criptografado e as notificações podem não mostrar o conteúdo das mensagens.',
+ );
+ });
+});
diff --git a/apps/meteor/client/NavBarV2/NavBarPagesGroup/actions/useEncryptedRoomDescription.tsx b/apps/meteor/client/NavBarV2/NavBarPagesGroup/actions/useEncryptedRoomDescription.tsx
index 32b54f89601e5..a442946fd2e2e 100644
--- a/apps/meteor/client/NavBarV2/NavBarPagesGroup/actions/useEncryptedRoomDescription.tsx
+++ b/apps/meteor/client/NavBarV2/NavBarPagesGroup/actions/useEncryptedRoomDescription.tsx
@@ -1,7 +1,7 @@
import { useSetting } from '@rocket.chat/ui-contexts';
import { useTranslation } from 'react-i18next';
-export const useEncryptedRoomDescription = (roomType: 'channel' | 'team') => {
+export const useEncryptedRoomDescription = (roomType: 'channel' | 'team' | 'discussion') => {
const { t } = useTranslation();
const e2eEnabled = useSetting('E2E_Enable');
@@ -10,10 +10,10 @@ export const useEncryptedRoomDescription = (roomType: 'channel' | 'team') => {
return t('Not_available_for_this_workspace');
}
if (!isPrivate) {
- return t('Encrypted_not_available', { roomType });
+ return t('Encrypted_not_available', { roomType: t(roomType) });
}
if (encrypted) {
- return t('Encrypted_messages', { roomType });
+ return t('Encrypted_messages', { roomType: t(roomType) });
}
return t('Encrypted_messages_false');
};
diff --git a/apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx b/apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx
index fad9fde0c2da1..438efbcd3e957 100644
--- a/apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx
+++ b/apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx
@@ -30,6 +30,7 @@ import { goToRoomById } from '../../lib/utils/goToRoomById';
import RoomAutoComplete from '../RoomAutoComplete';
import UserAutoCompleteMultiple from '../UserAutoCompleteMultiple';
import DefaultParentRoomField from './DefaultParentRoomField';
+import { useEncryptedRoomDescription } from '../../NavBarV2/NavBarPagesGroup/actions/useEncryptedRoomDescription';
type CreateDiscussionFormValues = {
name: string;
@@ -91,6 +92,8 @@ const CreateDiscussion = ({ onClose, defaultParentRoom, parentMessageId, nameSug
});
};
+ const getEncryptedHint = useEncryptedRoomDescription('discussion');
+
const parentRoomId = useId();
const encryptedId = useId();
const discussionNameId = useId();
@@ -242,11 +245,7 @@ const CreateDiscussion = ({ onClose, defaultParentRoom, parentMessageId, nameSug
render={({ field: { value, ...field } }) => }
/>
- {encrypted ? (
- {t('Encrypted_messages', { roomType: 'discussion' })}
- ) : (
- {t('Encrypted_messages_false')}
- )}
+ {getEncryptedHint({ isPrivate: true, encrypted })}
diff --git a/apps/meteor/client/sidebar/header/hooks/useEncryptedRoomDescription.tsx b/apps/meteor/client/sidebar/header/hooks/useEncryptedRoomDescription.tsx
index 32b54f89601e5..a442946fd2e2e 100644
--- a/apps/meteor/client/sidebar/header/hooks/useEncryptedRoomDescription.tsx
+++ b/apps/meteor/client/sidebar/header/hooks/useEncryptedRoomDescription.tsx
@@ -1,7 +1,7 @@
import { useSetting } from '@rocket.chat/ui-contexts';
import { useTranslation } from 'react-i18next';
-export const useEncryptedRoomDescription = (roomType: 'channel' | 'team') => {
+export const useEncryptedRoomDescription = (roomType: 'channel' | 'team' | 'discussion') => {
const { t } = useTranslation();
const e2eEnabled = useSetting('E2E_Enable');
@@ -10,10 +10,10 @@ export const useEncryptedRoomDescription = (roomType: 'channel' | 'team') => {
return t('Not_available_for_this_workspace');
}
if (!isPrivate) {
- return t('Encrypted_not_available', { roomType });
+ return t('Encrypted_not_available', { roomType: t(roomType) });
}
if (encrypted) {
- return t('Encrypted_messages', { roomType });
+ return t('Encrypted_messages', { roomType: t(roomType) });
}
return t('Encrypted_messages_false');
};