-
Local addresses
- {(aliases.local.length === 0) &&
No local addresses}
+
{t("Molecules.RoomAliases.local_addresses.title")}
+ {(aliases.local.length === 0) &&
{t("Molecules.RoomAliases.local_addresses.none")}}
{aliases.local.map(renderAlias)}
- {`Set local addresses for this ${room.isSpaceRoom() ? 'space' : 'room'} so users can find this ${room.isSpaceRoom() ? 'space' : 'room'} through your homeserver.`}
+ {t(room.isSpaceRoom() ? "Molecules.RoomAliases.local_addresses.message_space" : "Molecules.RoomAliases.local_addresses.message_room" )}
-
Add local address
+
{t("Molecules.RoomAliases.local_addresses.add")}
{validate.status === cons.status.SUCCESS &&
{validate.msg}}
@@ -342,7 +350,7 @@ function RoomAliases({ roomId }) {
)}
diff --git a/src/app/molecules/room-encryption/RoomEncryption.jsx b/src/app/molecules/room-encryption/RoomEncryption.jsx
index 1657f363..33737171 100644
--- a/src/app/molecules/room-encryption/RoomEncryption.jsx
+++ b/src/app/molecules/room-encryption/RoomEncryption.jsx
@@ -10,6 +10,9 @@ import SettingTile from '../setting-tile/SettingTile';
import { confirmDialog } from '../confirm-dialog/ConfirmDialog';
+import '../../i18n.jsx'
+import { useTranslation } from 'react-i18next';
+
function RoomEncryption({ roomId }) {
const mx = initMatrix.matrixClient;
const room = mx.getRoom(roomId);
@@ -17,16 +20,18 @@ function RoomEncryption({ roomId }) {
const [isEncrypted, setIsEncrypted] = useState(encryptionEvents.length > 0);
const canEnableEncryption = room.currentState.maySendStateEvent('m.room.encryption', mx.getUserId());
+ const { t } = useTranslation();
+
const handleEncryptionEnable = async () => {
const joinRule = room.getJoinRule();
- const confirmMsg1 = 'It is not recommended to add encryption in public room. Anyone can find and join public rooms, so anyone can read messages in them.';
- const confirmMsg2 = 'Once enabled, encryption for a room cannot be disabled. Messages sent in an encrypted room cannot be seen by the server, only by the participants of the room. Enabling encryption may prevent many bots and bridges from working correctly';
+ const confirmMsg1 = t("Molecules.RoomEncryption.encryption_public_room_message");
+ const confirmMsg2 = t("Molecules.RoomEncryption.encryption_message");
const isConfirmed1 = (joinRule === 'public')
- ? await confirmDialog('Enable encryption', confirmMsg1, 'Continue', 'caution')
+ ? await confirmDialog(t("Molecules.RoomEncryption.enable_encryption_prompt"), confirmMsg1, t("Molecules.RoomEncryption.continue_button"), 'caution')
: true;
if (!isConfirmed1) return;
- if (await confirmDialog('Enable encryption', confirmMsg2, 'Enable', 'caution')) {
+ if (await confirmDialog(t("Molecules.RoomEncryption.enable_encryption_prompt"), confirmMsg2, t("Molecules.RoomEncryption.enable_encryption_button"), 'caution')) {
setIsEncrypted(true);
mx.sendStateEvent(roomId, 'm.room.encryption', {
algorithm: 'm.megolm.v1.aes-sha2',
@@ -37,9 +42,9 @@ function RoomEncryption({ roomId }) {
return (
Once enabled, encryption cannot be disabled.
+ {t("Molecules.RoomEncryption.encryption_cannot_be_disabled")}
)}
options={(
{
@@ -81,13 +86,13 @@ function RoomHistoryVisibility({ roomId }) {
disabled={(!canChange)}
>
- {item.text}
+ {t(item.text)}
))
}
- Changes to history visibility will only apply to future messages. The visibility of existing history will have no effect.
+ {t("Molecules.RoomHistoryVisibility.changes_only_affect_future")}
);
}
diff --git a/src/app/molecules/room-members/RoomMembers.jsx b/src/app/molecules/room-members/RoomMembers.jsx
index f931f9dd..aa506210 100644
--- a/src/app/molecules/room-members/RoomMembers.jsx
+++ b/src/app/molecules/room-members/RoomMembers.jsx
@@ -18,6 +18,9 @@ import { MenuHeader } from '../../atoms/context-menu/ContextMenu';
import SegmentedControls from '../../atoms/segmented-controls/SegmentedControls';
import PeopleSelector from '../people-selector/PeopleSelector';
+import '../../i18n.jsx'
+import { useTranslation } from 'react-i18next';
+
const PER_PAGE_MEMBER = 50;
function normalizeMembers(members) {
@@ -113,6 +116,8 @@ function RoomMembers({ roomId }) {
const [members] = useMemberOfMembership(roomId, membership);
const [searchMembers, handleSearch] = useSearchMembers(members);
+ const { t } = useTranslation();
+
useEffect(() => {
setItemCount(PER_PAGE_MEMBER);
}, [searchMembers]);
@@ -124,14 +129,14 @@ function RoomMembers({ roomId }) {
const mList = searchMembers ? searchMembers.data : members.slice(0, itemCount);
return (
-
Search member
+
{t("Molecules.RoomMembers.search_title")}
-
{`${searchMembers ? `Found — ${mList.length}` : members.length} members`}
+
{t("Molecules.RoomMembers.found_members", {count: mList.length})}
{
@@ -139,7 +144,7 @@ function RoomMembers({ roomId }) {
return getSegmentIndex[membership];
})()
}
- segments={[{ text: 'Joined' }, { text: 'Invited' }, { text: 'Banned' }]}
+ segments={[{ text: t("Molecules.RoomMembers.joined") }, { text: t("Molecules.RoomMembers.invited") }, { text: t("Molecules.RoomMembers.banned") }]}
onSelect={(index) => {
const memberships = ['join', 'invite', 'ban'];
setMembership(memberships[index]);
@@ -162,7 +167,7 @@ function RoomMembers({ roomId }) {
&& (
- {searchMembers ? `No results found for "${searchMembers.term}"` : 'No members to display'}
+ {searchMembers ? t("Molecules.RoomMembers.invited", {term: searchMembers.term}) : t("Molecules.RoomMembers.no_members")}
)
@@ -171,7 +176,7 @@ function RoomMembers({ roomId }) {
mList.length !== 0
&& members.length > itemCount
&& searchMembers === null
- &&
+ &&
}
diff --git a/src/app/molecules/room-notification/RoomNotification.jsx b/src/app/molecules/room-notification/RoomNotification.jsx
index 1c088e5f..3051a66a 100644
--- a/src/app/molecules/room-notification/RoomNotification.jsx
+++ b/src/app/molecules/room-notification/RoomNotification.jsx
@@ -14,21 +14,24 @@ import BellRingIC from '../../../../public/res/ic/outlined/bell-ring.svg';
import BellPingIC from '../../../../public/res/ic/outlined/bell-ping.svg';
import BellOffIC from '../../../../public/res/ic/outlined/bell-off.svg';
+import '../../i18n.jsx'
+import { useTranslation } from 'react-i18next';
+
const items = [{
iconSrc: BellIC,
- text: 'Global',
+ text: 'Molecules.RoomNotification.default',
type: cons.notifs.DEFAULT,
}, {
iconSrc: BellRingIC,
- text: 'All messages',
+ text: 'Molecules.RoomNotification.all_messages',
type: cons.notifs.ALL_MESSAGES,
}, {
iconSrc: BellPingIC,
- text: 'Mentions & Keywords',
+ text: 'Molecules.RoomNotification.mentions_and_keywords',
type: cons.notifs.MENTIONS_AND_KEYWORDS,
}, {
iconSrc: BellOffIC,
- text: 'Mute',
+ text: 'Molecules.RoomNotification.mute',
type: cons.notifs.MUTE,
}];
@@ -114,6 +117,8 @@ function useNotifications(roomId) {
}
function RoomNotification({ roomId }) {
+
+ const { t } = useTranslation();
const [activeType, setNotification] = useNotifications(roomId);
return (
@@ -127,7 +132,7 @@ function RoomNotification({ roomId }) {
onClick={() => setNotification(item)}
>
- {item.text}
+ {t(item.text)}
diff --git a/src/app/molecules/room-options/RoomOptions.jsx b/src/app/molecules/room-options/RoomOptions.jsx
index af18d712..fd2bf3cf 100644
--- a/src/app/molecules/room-options/RoomOptions.jsx
+++ b/src/app/molecules/room-options/RoomOptions.jsx
@@ -17,11 +17,16 @@ import LeaveArrowIC from '../../../../public/res/ic/outlined/leave-arrow.svg';
import { confirmDialog } from '../confirm-dialog/ConfirmDialog';
+import '../../i18n.jsx'
+import { useTranslation } from 'react-i18next';
+
function RoomOptions({ roomId, afterOptionSelect }) {
const mx = initMatrix.matrixClient;
const room = mx.getRoom(roomId);
const canInvite = room?.canInvite(mx.getUserId());
+ const { t } = useTranslation();
+
const handleMarkAsRead = () => {
markAsRead(roomId);
afterOptionSelect();
@@ -34,9 +39,9 @@ function RoomOptions({ roomId, afterOptionSelect }) {
const handleLeaveClick = async () => {
afterOptionSelect();
const isConfirmed = await confirmDialog(
- 'Leave room',
- `Are you sure that you want to leave "${room.name}" room?`,
- 'Leave',
+ t("Molecules.RoomOptions.leave.title"),
+ t("Molecules.RoomOptions.leave.subtitle", {room_name: room.name}),
+ t("Molecules.RoomOptions.leave.button_text"),
'danger',
);
if (!isConfirmed) return;
@@ -45,17 +50,17 @@ function RoomOptions({ roomId, afterOptionSelect }) {
return (
- {twemojify(`Options for ${initMatrix.matrixClient.getRoom(roomId)?.name}`)}
-
+ {twemojify(t("Molecules.RoomOptions.title", {room_name: initMatrix.matrixClient.getRoom(roomId)?.name}))}
+
-
- Notification
+
+ {t("Molecules.RoomOptions.notifications_heading")}
);
diff --git a/src/app/molecules/room-permissions/RoomPermissions.jsx b/src/app/molecules/room-permissions/RoomPermissions.jsx
index 989a9396..def9c173 100644
--- a/src/app/molecules/room-permissions/RoomPermissions.jsx
+++ b/src/app/molecules/room-permissions/RoomPermissions.jsx
@@ -17,142 +17,145 @@ import ChevronBottomIC from '../../../../public/res/ic/outlined/chevron-bottom.s
import { useForceUpdate } from '../../hooks/useForceUpdate';
+import '../../i18n.jsx'
+import { useTranslation } from 'react-i18next';
+
const permissionsInfo = {
users_default: {
- name: 'Default role',
- description: 'Set default role for all members.',
+ name: 'Molecules.RoomPermissions.default_role.name',
+ description: 'Molecules.RoomPermissions.default_role.description',
default: 0,
},
events_default: {
- name: 'Send messages',
- description: 'Set minimum power level to send messages in room.',
+ name: 'Molecules.RoomPermissions.send_messages.name',
+ description: 'Molecules.RoomPermissions.send_messages.description',
default: 0,
},
'm.reaction': {
parent: 'events',
- name: 'Send reactions',
- description: 'Set minimum power level to send reactions in room.',
+ name: 'Molecules.RoomPermissions.reactions.name',
+ description: 'Molecules.RoomPermissions.reactions.description',
default: 0,
},
redact: {
- name: 'Delete messages sent by others',
- description: 'Set minimum power level to delete messages in room.',
+ name: 'Molecules.RoomPermissions.delete.name',
+ description: 'Molecules.RoomPermissions.delete.description',
default: 50,
},
notifications: {
- name: 'Ping room',
- description: 'Set minimum power level to ping room.',
+ name: 'Molecules.RoomPermissions.notifications.name',
+ description: 'Molecules.RoomPermissions.notifications.description',
default: {
room: 50,
},
},
'm.space.child': {
parent: 'events',
- name: 'Manage rooms in space',
- description: 'Set minimum power level to manage rooms in space.',
+ name: 'Molecules.RoomPermissions.manage_rooms.name',
+ description: 'Molecules.RoomPermissions.manage_rooms.description',
default: 50,
},
invite: {
- name: 'Invite',
- description: 'Set minimum power level to invite members.',
+ name: 'Molecules.RoomPermissions.invite.name',
+ description: 'Molecules.RoomPermissions.invite.description',
default: 50,
},
kick: {
- name: 'Kick',
- description: 'Set minimum power level to kick members.',
+ name: 'Molecules.RoomPermissions.kick.name',
+ description: 'Molecules.RoomPermissions.kick.description',
default: 50,
},
ban: {
- name: 'Ban',
- description: 'Set minimum power level to ban members.',
+ name: 'Molecules.RoomPermissions.ban.name',
+ description: 'Molecules.RoomPermissions.ban.description',
default: 50,
},
'm.room.avatar': {
parent: 'events',
- name: 'Change avatar',
- description: 'Set minimum power level to change room/space avatar.',
+ name: 'Molecules.RoomPermissions.change_avatar.name',
+ description: 'Molecules.RoomPermissions.change_avatar.description',
default: 50,
},
'm.room.name': {
parent: 'events',
- name: 'Change name',
- description: 'Set minimum power level to change room/space name.',
+ name: 'Molecules.RoomPermissions.change_name.name',
+ description: 'Molecules.RoomPermissions.change_name.description',
default: 50,
},
'm.room.topic': {
parent: 'events',
- name: 'Change topic',
- description: 'Set minimum power level to change room/space topic.',
+ name: 'Molecules.RoomPermissions.change_topic.name',
+ description: 'Molecules.RoomPermissions.change_topic.description',
default: 50,
},
state_default: {
- name: 'Change settings',
- description: 'Set minimum power level to change settings.',
+ name: 'Molecules.RoomPermissions.change_settings.name',
+ description: 'Molecules.RoomPermissions.change_settings.description',
default: 50,
},
'm.room.canonical_alias': {
parent: 'events',
- name: 'Change published address',
- description: 'Set minimum power level to publish and set main address.',
+ name: 'Molecules.RoomPermissions.change_published_address.name',
+ description: 'Molecules.RoomPermissions.change_published_address.description',
default: 50,
},
'm.room.power_levels': {
parent: 'events',
- name: 'Change permissions',
- description: 'Set minimum power level to change permissions.',
+ name: 'Molecules.RoomPermissions.change_permissions.name',
+ description: 'Molecules.RoomPermissions.change_permissions.description',
default: 50,
},
'm.room.encryption': {
parent: 'events',
- name: 'Enable room encryption',
- description: 'Set minimum power level to enable room encryption.',
+ name: 'Molecules.RoomPermissions.enable_room_encryption.name',
+ description: 'Molecules.RoomPermissions.enable_room_encryption.description',
default: 50,
},
'm.room.history_visibility': {
parent: 'events',
- name: 'Change history visibility',
- description: 'Set minimum power level to change room messages history visibility.',
+ name: 'Molecules.RoomPermissions.change_history_visibility.name',
+ description: 'Molecules.RoomPermissions.change_history_visibility.description',
default: 50,
},
'm.room.tombstone': {
parent: 'events',
- name: 'Upgrade room',
- description: 'Set minimum power level to upgrade room.',
+ name: 'Molecules.RoomPermissions.upgrade_room.name',
+ description: 'Molecules.RoomPermissions.upgrade_room.description',
default: 50,
},
'm.room.pinned_events': {
parent: 'events',
- name: 'Pin messages',
- description: 'Set minimum power level to pin messages in room.',
+ name: 'Molecules.RoomPermissions.pin_messages.name',
+ description: 'Molecules.RoomPermissions.pin_messages.description',
default: 50,
},
'm.room.server_acl': {
parent: 'events',
- name: 'Change server ACLs',
- description: 'Set minimum power level to change server ACLs.',
+ name: 'Molecules.RoomPermissions.change_acls.name',
+ description: 'Molecules.RoomPermissions.change_acls.description',
default: 50,
},
'im.vector.modular.widgets': {
parent: 'events',
- name: 'Modify widgets',
- description: 'Set minimum power level to modify room widgets.',
+ name: 'Molecules.RoomPermissions.modify_widgets.name',
+ description: 'Molecules.RoomPermissions.modify_widgets.description',
default: 50,
},
};
const roomPermsGroups = {
- 'General Permissions': ['users_default', 'events_default', 'm.reaction', 'redact', 'notifications'],
- 'Manage members permissions': ['invite', 'kick', 'ban'],
- 'Room profile permissions': ['m.room.avatar', 'm.room.name', 'm.room.topic'],
- 'Settings permissions': ['state_default', 'm.room.canonical_alias', 'm.room.power_levels', 'm.room.encryption', 'm.room.history_visibility'],
- 'Other permissions': ['m.room.tombstone', 'm.room.pinned_events', 'm.room.server_acl', 'im.vector.modular.widgets'],
+ 'Molecules.RoomPermissions.groups.general': ['users_default', 'events_default', 'm.reaction', 'redact', 'notifications'],
+ 'Molecules.RoomPermissions.groups.manage_members': ['invite', 'kick', 'ban'],
+ 'Molecules.RoomPermissions.groups.room': ['m.room.avatar', 'm.room.name', 'm.room.topic'],
+ 'Molecules.RoomPermissions.groups.settings': ['state_default', 'm.room.canonical_alias', 'm.room.power_levels', 'm.room.encryption', 'm.room.history_visibility'],
+ 'Molecules.RoomPermissions.groups.other': ['m.room.tombstone', 'm.room.pinned_events', 'm.room.server_acl', 'im.vector.modular.widgets'],
};
const spacePermsGroups = {
- 'General Permissions': ['users_default', 'm.space.child'],
- 'Manage members permissions': ['invite', 'kick', 'ban'],
- 'Space profile permissions': ['m.room.avatar', 'm.room.name', 'm.room.topic'],
- 'Settings permissions': ['state_default', 'm.room.canonical_alias', 'm.room.power_levels'],
+ 'Molecules.RoomPermissions.groups.general': ['users_default', 'm.space.child'],
+ 'Molecules.RoomPermissions.groups.manage_members': ['invite', 'kick', 'ban'],
+ 'Molecules.RoomPermissions.groups.space': ['m.room.avatar', 'm.room.name', 'm.room.topic'],
+ 'Molecules.RoomPermissions.groups.settings': ['state_default', 'm.room.canonical_alias', 'm.room.power_levels'],
};
function useRoomStateUpdate(roomId) {
@@ -181,6 +184,8 @@ function RoomPermissions({ roomId }) {
const canChangePermission = room.currentState.maySendStateEvent('m.room.power_levels', mx.getUserId());
const myPowerLevel = room.getMember(mx.getUserId())?.powerLevel ?? 100;
+ const { t } = useTranslation();
+
const handlePowerSelector = (e, permKey, parentKey, powerLevel) => {
const handlePowerLevelChange = (newPowerLevel) => {
if (powerLevel === newPowerLevel) return;
@@ -227,7 +232,7 @@ function RoomPermissions({ roomId }) {
const groupedPermKeys = permsGroups[groupKey];
return (
-
{groupKey}
+
{t(groupKey)}
{
groupedPermKeys.map((permKey) => {
const permInfo = permissionsInfo[permKey];
@@ -247,8 +252,8 @@ function RoomPermissions({ roomId }) {
return (
{permInfo.description}}
+ title={t(permInfo.name)}
+ content={{t(permInfo.description)}}
options={(