Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/new-poems-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixes a missing translation on the create channel/team modal
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,117 @@ describe.each([
});
});
});

describe('useEncryptedRoomDescription', () => {
describe('actual translation values comparison', () => {
describe('Portuguese translations', () => {
it('should return correct Portuguese translations for channel type', () => {
const { result } = renderHook(() => useEncryptedRoomDescription('channel'), {
wrapper: mockAppRoot()
.withSetting('E2E_Enable', true)
.withSetting('E2E_Enabled_Default_PrivateRooms', false)
.withSetting('language', 'pt-BR')
.withUserPreference('language', 'pt-BR')
.withDefaultLanguage('pt-BR')
.withTranslations('pt-BR', 'core', {
Encrypted_not_available: 'Indisponível para {{roomType}} públicos',
Not_available_for_broadcast: 'Não disponível para transmissão {{roomType}}',
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',
})
.build(),
});

// Test all scenarios with Portuguese translations
expect(result.current({ isPrivate: false, broadcast: false, encrypted: false })).toBe('Indisponível para canal públicos');
expect(result.current({ isPrivate: true, broadcast: true, encrypted: false })).toBe('Não disponível para transmissão canal');
expect(result.current({ isPrivate: true, broadcast: false, 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('should return correct Portuguese translations for team type', () => {
const { result } = renderHook(() => useEncryptedRoomDescription('team'), {
wrapper: mockAppRoot()
.withSetting('E2E_Enable', true)
.withSetting('E2E_Enabled_Default_PrivateRooms', false)
.withDefaultLanguage('pt-BR')
.withTranslations('pt-BR', 'core', {
Encrypted_not_available: 'Indisponível para {{roomType}} públicos',
Not_available_for_broadcast: 'Não disponível para transmissão {{roomType}}',
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',
})
.build(),
});

// Test all scenarios with Portuguese translations
expect(result.current({ isPrivate: false, broadcast: false, encrypted: false })).toBe('Indisponível para Equipe públicos');
expect(result.current({ isPrivate: true, broadcast: true, encrypted: false })).toBe('Não disponível para transmissão Equipe');
expect(result.current({ isPrivate: true, broadcast: false, 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.',
);
});
});

describe('English translations', () => {
it('should return correct English translations for channel type', () => {
const { result } = renderHook(() => useEncryptedRoomDescription('channel'), {
wrapper: mockAppRoot()
.withSetting('E2E_Enable', true)
.withSetting('E2E_Enabled_Default_PrivateRooms', false)
.withTranslations('en', 'core', {
Not_available_for_this_workspace: 'Not available for this workspace',
Encrypted_not_available: 'Not available for public {{roomType}}',
Not_available_for_broadcast: 'Not available for broadcast {{roomType}}',
Encrypted_messages:
'End-to-end encrypted {{roomType}}. Search will not work with encrypted {{roomType}} and notifications may not show the messages content.',
Encrypted_messages_false: 'Messages are not encrypted',
channel: 'Channel',
team: 'Team',
})
.build(),
});

// Test all scenarios with English translations
expect(result.current({ isPrivate: false, broadcast: false, encrypted: false })).toBe('Not available for public Channel');
expect(result.current({ isPrivate: true, broadcast: true, encrypted: false })).toBe('Not available for broadcast Channel');
expect(result.current({ isPrivate: true, broadcast: false, encrypted: true })).toBe(
'End-to-end encrypted Channel. Search will not work with encrypted Channel and notifications may not show the messages content.',
);
expect(result.current({ isPrivate: true, broadcast: false, encrypted: false })).toBe('Messages are not encrypted');
});

it('should return correct English translations for team type', () => {
const { result } = renderHook(() => useEncryptedRoomDescription('team'), {
wrapper: mockAppRoot()
.withSetting('E2E_Enable', true)
.withSetting('E2E_Enabled_Default_PrivateRooms', false)
.withTranslations('en', 'core', {
Not_available_for_this_workspace: 'Not available for this workspace',
Encrypted_not_available: 'Not available for public {{roomType}}',
Not_available_for_broadcast: 'Not available for broadcast {{roomType}}',
Encrypted_messages:
'End-to-end encrypted {{roomType}}. Search will not work with encrypted {{roomType}} and notifications may not show the messages content.',
Encrypted_messages_false: 'Messages are not encrypted',
channel: 'Channel',
team: 'Team',
})
.build(),
});

// Test all scenarios with English translations
expect(result.current({ isPrivate: false, broadcast: false, encrypted: false })).toBe('Not available for public Team');
expect(result.current({ isPrivate: true, broadcast: true, encrypted: false })).toBe('Not available for broadcast Team');
expect(result.current({ isPrivate: true, broadcast: false, encrypted: true })).toBe(
'End-to-end encrypted Team. Search will not work with encrypted Team and notifications may not show the messages content.',
);
expect(result.current({ isPrivate: true, broadcast: false, encrypted: false })).toBe('Messages are not encrypted');
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ 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) });
}
// TODO: This case will be removed once we enable E2E for broadcast teams in teams creation modal
if (broadcast !== undefined && broadcast) {
return t('Not_available_for_broadcast', { roomType });
return t('Not_available_for_broadcast', { roomType: t(roomType) });
}
if (encrypted) {
return t('Encrypted_messages', { roomType });
return t('Encrypted_messages', { roomType: t(roomType) });
}
return t('Encrypted_messages_false');
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ 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) });
}
// TODO: This case will be removed once we enable E2E for broadcast teams in teams creation modal
if (broadcast !== undefined && broadcast) {
return t('Not_available_for_broadcast', { roomType });
return t('Not_available_for_broadcast', { roomType: t(roomType) });
}
if (encrypted) {
return t('Encrypted_messages', { roomType });
return t('Encrypted_messages', { roomType: t(roomType) });
}
return t('Encrypted_messages_false');
};
Expand Down
Loading