Skip to content

Commit

Permalink
Translate components
Browse files Browse the repository at this point in the history
  • Loading branch information
aceArt-GmbH committed Dec 20, 2023
1 parent ef27638 commit 8ce21f7
Show file tree
Hide file tree
Showing 10 changed files with 225 additions and 62 deletions.
65 changes: 62 additions & 3 deletions public/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"sponsor": "Unterstützen",
"delete": "Löschen",
"continue": "Weiter",
"cancel": "Abbrechen",
"save": "Speichern",
"view_more": "Mehr ansehen",
"view_less": "Weniger ansehen",
"copy": "Kopieren",
Expand All @@ -15,7 +17,9 @@
"setup": "Einrichtung",
"search": "Suche",
"invite": "Einladen",
"message_prompt": "Nachricht"
"message_prompt": "Nachricht",
"and": " und ",
"edit": "Bearbeiten"
},
"errors": {
"generic": "Etwas ist schiefgegangen!"
Expand All @@ -27,7 +31,10 @@
"retry": "Erneut Versuchen",
"previous": "Vorherige",
"jump_to_page": "Spring zu Seite",
"next": "Nächste"
"next": "Nächste",
"open_pdf": "PDF öffnen",
"retry_download": "Herunterladen neu versuchen",
"open_file": "Datei öffnen"
},
"UploadBoard": {
"files": "Dateien",
Expand Down Expand Up @@ -56,6 +63,9 @@
"not_decrypted_yet": "Diese Nachricht ist noch nicht entschlüsselt",
"broken_message": "Kaputte Nachricht",
"empty_message": "Leere Nachricht"
},
"EventReaders": {
"seen_by": "Gesehen von"
}
},
"Organisms": {
Expand Down Expand Up @@ -228,6 +238,26 @@
"reset_keys_subtitle": "Das Zurücksetzen der Quersignatur-Schlüssel ist nicht umkehrbar.",
"reset_keys_message": "Jeder, bei dem du dich verifiziert hast, wird Sicherheitswarnungen erhalten und deine Nachrichtensicherung geht verloren. Dies ist mit hoher Wahrscheinlichkeit nicht das was du tun möchtest, es sei denn du hast den Sicherheitsschlüssel oder die Sicherheitsphrase und jede Sitzung von der aus du quersignieren könntest verloren."
},
"RoomSettings": {
"General": "Allgemein",
"Search": "Suche",
"Members": "Mitglieder",
"Emojis": "Emojis",
"Permissions": "Berechtigungen",
"Security": "Sicherheit",
"options": "Optionen",
"invite": "Einladen",
"leave": "Verlassen",
"leave_room": "Raum verlassen",
"leave_room_confirm_message": "Bist du sicher, dass du {{room_name}} verlassen möchtest?",
"leave_room_confirm_button": "Verlassen",
"notification_header": "Benachrichtigungen (Änderung betrifft nur dich)",
"visibility_header": "Sichtbarkeit des Raums (wer beitreten kann)",
"address_header": "Adressen des Raums",
"encryption_header": "Verschlüsselung",
"message_history_header": "Sichtbarkeit des Nachrichtenverlaufs",
"room_settings_subtitle": "Einstellungen des Raums"
},
"RoomCommon": {
"user_joined": "<bold><user/></bold> ist dem Raum beigetreten",
"user_left": "<bold><user/></bold> hat den Raum verlassen",
Expand All @@ -247,7 +277,15 @@
"name_changed": "<bold><user_name/></bold> hat den Anzeigenamen in <bold><new_name/></bold> geändert",
"name_removed": "<bold><user_name/></bold> hat den Anzeigenamen <bold><new_name/></bold> entfernt",
"changed_room_name": " hat den Raum Name geändert",
"new_messages": "Neue Nachrichten"
"new_messages": "Neue Nachrichten",
"drop_files": "Dateien fallenlassen in",
"room": "Raum",
"drag_and_drop": "Dateien hierher ziehen und ablegen oder anklicken für Auswahldialog",
"jump_to_latest": "Zur neusten Nachricht springen",
"jump_to_unread": "Zu Ungelesen springen",
"mark_as_read": "Als gelesen markieren",
"is_following": " verfolgt das Gespräch.",
"are_following": " verfolgen das Gespräch."
},
"DrawerBreadcrumb": {
"home": "Home"
Expand Down Expand Up @@ -413,6 +451,27 @@
"settings": "Berechtigungen für Einstellungen"
}
},
"RoomProfile": {
"saving_room_name": "Speichere Namen des Raums...",
"saving_room_topic": "Speichere Thema des Raums...",
"save_success": "Erfolgreich gespeichert",
"save_failed": "Speichern fehlgeschlagen",
"remove_avatar_title": "Avatar entfernen",
"remove_avatar_subtitle": "Bist du sicher, dass du den Avatar des Raums entfernen möchtest?",
"remove_avatar_button": "Entfernen",
"permission_change_room_name": "Du hast nur die Berechtigung, den Namen des Raums zu ändern",
"permission_change_room_topic": "Du hast nur die Berechtigung, das Thema des Raums zu ändern",
"permission_change_space_name": "Du hast nur die Berechtigung, den Namen des Spaces zu ändern",
"permission_change_space_topic": "Du hast nur die Berechtigung, das Thema des Spaces zu ändern",
"name_label": "Name",
"topic_label": "Thema"
},
"RoomVisibility": {
"private": "Privat (nur mit Einladung)",
"restricted": "Eingeschränkt (Mitglieder des Spaces können beitreten)",
"restricted_unsupported": "Eingeschränkt (Nicht unterstützt: Aktualisierung des Raums erforderlich)",
"public": "Öffentlich (jeder kann beitreten)"
},
"SpaceOptions": {
"leave_space": "Space verlassen",
"leave_space_confirmation": "Bist du sicher, dass du den Space {{space}} verlassen möchtest?",
Expand Down
65 changes: 62 additions & 3 deletions public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"sponsor": "Support",
"delete": "Delete",
"continue": "Continue",
"cancel": "Cancel",
"save": "Save",
"view_more": "View more",
"view_less": "View less",
"copy": "Copy",
Expand All @@ -15,7 +17,9 @@
"setup": "Setup",
"search": "Search",
"invite": "Invite",
"message_prompt": "Message"
"message_prompt": "Message",
"and": " and ",
"edit": "Edit"
},
"errors": {
"generic": "Something went wrong!"
Expand All @@ -27,7 +31,10 @@
"retry": "Retry",
"previous": "Previous",
"jump_to_page": "Jump To Page",
"next": "Next"
"next": "Next",
"open_pdf": "Open PDF",
"retry_download": "Retry Download",
"open_file": "Open File"
},
"UploadBoard": {
"files": "Files",
Expand Down Expand Up @@ -56,6 +63,9 @@
"not_decrypted_yet": "This message is not decrypted yet",
"broken_message": "Broken message",
"empty_message": "Empty message"
},
"EventReaders": {
"seen_by": "Seen by"
}
},
"Organisms": {
Expand Down Expand Up @@ -228,6 +238,26 @@
"reset_keys_subtitle": "Resetting cross-signing keys is permanent.",
"reset_keys_message": "Anyone you have verified with will see security alerts and your message backup will lost. You almost certainly do not want to do this, unless you have lost Security Key or Phrase and every session you can cross-sign from."
},
"RoomSettings": {
"General": "General",
"Search": "Search",
"Members": "Members",
"Emojis": "Emojis",
"Permissions": "Permissions",
"Security": "Security",
"options": "Options",
"invite": "Invite",
"leave": "Leave",
"leave_room": "Leave room",
"leave_room_confirm_message": "Are you sure you want to leave {{room_name}}?",
"leave_room_confirm_button": "Leave",
"notification_header": "Notifications (Changing this will only affect you)",
"visibility_header": "Room visibility (Who can join)",
"address_header": "Room addresses",
"encryption_header": "Encryption",
"message_history_header": "Message history visibility",
"room_settings_subtitle": "room settings"
},
"RoomCommon": {
"user_joined": "<bold><user/></bold> joined the room",
"user_left": "<bold><user/></bold> left the room",
Expand All @@ -247,7 +277,15 @@
"name_changed": "<bold><user/></bold> changed their display name to <bold><new_name/></bold>",
"name_removed": "<bold><user/></bold> removed their display name <bold><last_name/></bold>",
"changed_room_name": " changed room name",
"new_messages": "New Messages"
"new_messages": "New Messages",
"drop_files": "Drop Files in",
"room": "Room",
"drag_and_drop": "Drag and drop files here or click for selection dialog",
"jump_to_latest": "Jump to Latest",
"jump_to_unread": "Jump to Unread",
"mark_as_read": "Mark as Read",
"is_following": " is following the conversation.",
"are_following": " are following the conversation."
},
"DrawerBreadcrumb": {
"home": "Home"
Expand Down Expand Up @@ -413,6 +451,27 @@
"settings": "Settings permissions"
}
},
"RoomProfile": {
"saving_room_name": "Saving room name...",
"saving_room_topic": "Saving room topic...",
"save_success": "Saved successfully",
"save_failed": "Unable to save",
"remove_avatar_title": "Remove avatar",
"remove_avatar_subtitle": "Are you sure that you want to remove room avatar?",
"remove_avatar_button": "Remove",
"permission_change_room_name": "You have permission to change room name only",
"permission_change_room_topic": "You have permission to change room topic only",
"permission_change_space_name": "You have permission to change space name only",
"permission_change_space_topic": "You have permission to change space topic only",
"name_label": "Name",
"topic_label": "Topic"
},
"RoomVisibility": {
"private": "Private (invite only)",
"restricted": "Restricted (space members can join)",
"restricted_unsupported": "Restricted (Unsupported: room required upgrade)",
"public": "Public (anyone can join)"
},
"SpaceOptions": {
"leave_space": "Leave Space",
"leave_space_confirmation": "Are you sure that you want to leave the {{space}} space?",
Expand Down
5 changes: 4 additions & 1 deletion src/app/components/event-readers/EventReaders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
config,
} from 'folds';
import { Room } from 'matrix-js-sdk';
import { useTranslation } from 'react-i18next';
import { useRoomEventReaders } from '../../hooks/useRoomEventReaders';
import { getMemberDisplayName } from '../../utils/room';
import { getMxIdLocalPart } from '../../utils/matrix';
Expand All @@ -37,6 +38,8 @@ export const EventReaders = as<'div', EventReadersProps>(
const getName = (userId: string) =>
getMemberDisplayName(room, userId) ?? getMxIdLocalPart(userId) ?? userId;

const { t } = useTranslation();

return (
<Box
className={classNames(css.EventReaders, className)}
Expand All @@ -46,7 +49,7 @@ export const EventReaders = as<'div', EventReadersProps>(
>
<Header className={css.Header} variant="Surface" size="600">
<Box grow="Yes">
<Text size="H3">Seen by</Text>
<Text size="H3">{t('Components.EventReaders.seen_by')}</Text>
</Box>
<IconButton size="300" onClick={requestClose}>
<Icon src={Icons.Cross} />
Expand Down
40 changes: 26 additions & 14 deletions src/app/molecules/room-profile/RoomProfile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react';
import PropTypes from 'prop-types';
import './RoomProfile.scss';

import { useTranslation } from 'react-i18next';
import { twemojify } from '../../../util/twemojify';

import initMatrix from '../../../client/initMatrix';
Expand Down Expand Up @@ -30,6 +31,8 @@ function RoomProfile({ roomId }) {
type: cons.status.PRE_FLIGHT,
});

const { t } = useTranslation();

const mx = initMatrix.matrixClient;
const isDM = initMatrix.roomList.directs.has(roomId);
let avatarSrc = mx.getRoom(roomId).getAvatarUrl(mx.baseUrl, 36, 36, 'crop');
Expand Down Expand Up @@ -76,7 +79,7 @@ function RoomProfile({ roomId }) {
const newName = roomNameInput.value;
if (newName !== roomName && roomName.trim() !== '') {
setStatus({
msg: 'Saving room name...',
msg: t('Molecules.RoomProfile.saving_room_name'),
type: cons.status.IN_FLIGHT,
});
await mx.setRoomName(roomId, newName);
Expand All @@ -87,7 +90,7 @@ function RoomProfile({ roomId }) {
if (newTopic !== roomTopic) {
if (isMountStore.getItem()) {
setStatus({
msg: 'Saving room topic...',
msg: t('Molecules.RoomProfile.saving_room_topic'),
type: cons.status.IN_FLIGHT,
});
}
Expand All @@ -96,13 +99,13 @@ function RoomProfile({ roomId }) {
}
if (!isMountStore.getItem()) return;
setStatus({
msg: 'Saved successfully',
msg: t('Molecules.RoomProfile.save_success'),
type: cons.status.SUCCESS,
});
} catch (err) {
if (!isMountStore.getItem()) return;
setStatus({
msg: err.message || 'Unable to save.',
msg: err.message || t('Molecules.RoomProfile.save_failed'),
type: cons.status.ERROR,
});
}
Expand All @@ -119,9 +122,9 @@ function RoomProfile({ roomId }) {
const handleAvatarUpload = async (url) => {
if (url === null) {
const isConfirmed = await confirmDialog(
'Remove avatar',
'Are you sure that you want to remove room avatar?',
'Remove',
t('Molecules.RoomProfile.remove_avatar_title'),
t('Molecules.RoomProfile.remove_avatar_subtitle'),
t('Molecules.RoomProfile.remove_avatar_button'),
'caution',
);
if (isConfirmed) {
Expand All @@ -132,16 +135,25 @@ function RoomProfile({ roomId }) {

const renderEditNameAndTopic = () => (
<form className="room-profile__edit-form" onSubmit={handleOnSubmit}>
{canChangeName && <Input value={roomName} name="room-name" disabled={status.type === cons.status.IN_FLIGHT} label="Name" />}
{canChangeTopic && <Input value={roomTopic} name="room-topic" disabled={status.type === cons.status.IN_FLIGHT} minHeight={100} resizable label="Topic" />}
{(!canChangeName || !canChangeTopic) && <Text variant="b3">{`You have permission to change ${room.isSpaceRoom() ? 'space' : 'room'} ${canChangeName ? 'name' : 'topic'} only.`}</Text>}
{canChangeName && <Input value={roomName} name="room-name" disabled={status.type === cons.status.IN_FLIGHT} label={t('Molecules.RoomProfile.name_label')} />}
{canChangeTopic && <Input value={roomTopic} name="room-topic" disabled={status.type === cons.status.IN_FLIGHT} minHeight={100} resizable label={t('Molecules.RoomProfile.topic_label')} />}
{(!canChangeName || !canChangeTopic) && (
<Text variant="b3">
{
// eslint-disable-next-line no-nested-ternary
room.isSpaceRoom()
? canChangeName ? 'Molecules.RoomProfile.permission_change_space_name' : 'Molecules.RoomProfile.permission_change_space_topic'
: canChangeName ? 'Molecules.RoomProfile.permission_change_room_name' : 'Molecules.RoomProfile.permission_change_room_topic'
}
</Text>
)}
{ status.type === cons.status.IN_FLIGHT && <Text variant="b2">{status.msg}</Text>}
{ status.type === cons.status.SUCCESS && <Text style={{ color: 'var(--tc-positive-high)' }} variant="b2">{status.msg}</Text>}
{ status.type === cons.status.ERROR && <Text style={{ color: 'var(--tc-danger-high)' }} variant="b2">{status.msg}</Text>}
{ status.type !== cons.status.IN_FLIGHT && (
<div>
<Button type="submit" variant="primary">Save</Button>
<Button onClick={handleCancelEditing}>Cancel</Button>
<Button type="submit" variant="primary">{t('common.save')}</Button>
<Button onClick={handleCancelEditing}>{t('common.cancel')}</Button>
</div>
)}
</form>
Expand All @@ -155,7 +167,7 @@ function RoomProfile({ roomId }) {
<IconButton
src={PencilIC}
size="extra-small"
tooltip="Edit"
tooltip={t('common.edit')}
onClick={() => setIsEditing(true)}
/>
)}
Expand Down Expand Up @@ -189,4 +201,4 @@ RoomProfile.propTypes = {
roomId: PropTypes.string.isRequired,
};

export default RoomProfile;
export default RoomProfile;
Loading

0 comments on commit 8ce21f7

Please sign in to comment.