Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit b1f17f5

Browse files
authored
Migrate more strings to translation keys (#11510)
1 parent 0e8f79b commit b1f17f5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+3507
-3306
lines changed

src/components/views/dialogs/devtools/AccountData.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export const AccountDataExplorer: React.FC<IDevtoolsProps> = ({ onBack, setTool
9898
<BaseAccountDataExplorer
9999
events={cli.store.accountData}
100100
Editor={AccountDataEventEditor}
101-
actionLabel={_t("Send custom account data event")}
101+
actionLabel={_t("devtools|send_custom_account_data_event")}
102102
onBack={onBack}
103103
setTool={setTool}
104104
/>
@@ -112,7 +112,7 @@ export const RoomAccountDataExplorer: React.FC<IDevtoolsProps> = ({ onBack, setT
112112
<BaseAccountDataExplorer
113113
events={context.room.accountData}
114114
Editor={RoomAccountDataEventEditor}
115-
actionLabel={_t("Send custom room account data event")}
115+
actionLabel={_t("devtools|send_custom_room_account_data_event")}
116116
onBack={onBack}
117117
setTool={setTool}
118118
/>

src/components/views/dialogs/devtools/Event.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ interface IFieldDef {
4343

4444
export const eventTypeField = (defaultValue?: string): IFieldDef => ({
4545
id: "eventType",
46-
label: _td("Event Type"),
46+
label: _td("devtools|event_type"),
4747
default: defaultValue,
4848
});
4949

5050
export const stateKeyField = (defaultValue?: string): IFieldDef => ({
5151
id: "stateKey",
52-
label: _td("State Key"),
52+
label: _td("devtools|state_key"),
5353
default: defaultValue,
5454
});
5555

@@ -69,7 +69,7 @@ const validateEventContent = withValidation<any, Error | undefined>({
6969
if (!value) return true;
7070
return !error;
7171
},
72-
invalid: (error) => _t("Doesn't look like valid JSON.") + " " + error,
72+
invalid: (error) => _t("devtools|invalid_json") + " " + error,
7373
},
7474
],
7575
});
@@ -111,9 +111,9 @@ export const EventEditor: React.FC<IEventEditorProps> = ({ fieldDefs, defaultCon
111111
const json = JSON.parse(content);
112112
await onSend(fieldData, json);
113113
} catch (e) {
114-
return _t("Failed to send event!") + (e instanceof Error ? ` (${e.message})` : "");
114+
return _t("devtools|failed_to_send") + (e instanceof Error ? ` (${e.message})` : "");
115115
}
116-
return _t("Event sent!");
116+
return _t("devtools|event_sent");
117117
};
118118

119119
return (
@@ -122,7 +122,7 @@ export const EventEditor: React.FC<IEventEditorProps> = ({ fieldDefs, defaultCon
122122

123123
<Field
124124
id="evContent"
125-
label={_t("Event Content")}
125+
label={_t("devtools|event_content")}
126126
type="text"
127127
className="mx_DevTools_textarea"
128128
autoComplete="off"

src/components/views/dialogs/devtools/RoomNotifications.tsx

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,29 @@ function UserReadUpTo({ target }: { target: ReadReceipt<any, any> }): JSX.Elemen
3333
return (
3434
<>
3535
<li>
36-
{_t("User read up to: ")}
37-
<strong>{target.getReadReceiptForUserId(userId)?.eventId ?? _t("No receipt found")}</strong>
36+
{_t("devtools|user_read_up_to")}
37+
<strong>{target.getReadReceiptForUserId(userId)?.eventId ?? _t("devtools|no_receipt_found")}</strong>
3838
</li>
3939
<li>
40-
{_t("User read up to (ignoreSynthetic): ")}
41-
<strong>{target.getReadReceiptForUserId(userId, true)?.eventId ?? _t("No receipt found")}</strong>
40+
{_t("devtools|user_read_up_to_ignore_synthetic")}
41+
<strong>
42+
{target.getReadReceiptForUserId(userId, true)?.eventId ?? _t("devtools|no_receipt_found")}
43+
</strong>
4244
</li>
4345
{hasPrivate && (
4446
<>
4547
<li>
46-
{_t("User read up to (m.read.private): ")}
48+
{_t("devtools|user_read_up_to_private")}
4749
<strong>
4850
{target.getReadReceiptForUserId(userId, false, ReceiptType.ReadPrivate)?.eventId ??
49-
_t("No receipt found")}
51+
_t("devtools|no_receipt_found")}
5052
</strong>
5153
</li>
5254
<li>
53-
{_t("User read up to (m.read.private;ignoreSynthetic): ")}
55+
{_t("devtools|user_read_up_to_private_ignore_synthetic")}
5456
<strong>
5557
{target.getReadReceiptForUserId(userId, true, ReceiptType.ReadPrivate)?.eventId ??
56-
_t("No receipt found")}
58+
_t("devtools|no_receipt_found")}
5759
</strong>
5860
</li>
5961
</>
@@ -72,12 +74,12 @@ export default function RoomNotifications({ onBack }: IDevtoolsProps): JSX.Eleme
7274
return (
7375
<BaseTool onBack={onBack}>
7476
<section>
75-
<h2>{_t("Room status")}</h2>
77+
<h2>{_t("devtools|room_status")}</h2>
7678
<ul>
7779
<li>
7880
{count > 0
7981
? _t(
80-
"Room unread status: <strong>%(status)s</strong>, count: <strong>%(count)s</strong>",
82+
"devtools|room_unread_status_count",
8183
{
8284
status: humanReadableNotificationColor(color),
8385
count,
@@ -87,7 +89,7 @@ export default function RoomNotifications({ onBack }: IDevtoolsProps): JSX.Eleme
8789
},
8890
)
8991
: _t(
90-
"Room unread status: <strong>%(status)s</strong>",
92+
"devtools|room_unread_status",
9193
{
9294
status: humanReadableNotificationColor(color),
9395
},
@@ -98,7 +100,7 @@ export default function RoomNotifications({ onBack }: IDevtoolsProps): JSX.Eleme
98100
</li>
99101
<li>
100102
{_t(
101-
"Notification state is <strong>%(notificationState)s</strong>",
103+
"devtools|notification_state",
102104
{
103105
notificationState,
104106
},
@@ -110,8 +112,8 @@ export default function RoomNotifications({ onBack }: IDevtoolsProps): JSX.Eleme
110112
<li>
111113
{_t(
112114
cli.isRoomEncrypted(room.roomId!)
113-
? _td("Room is <strong>encrypted ✅</strong>")
114-
: _td("Room is <strong>not encrypted 🚨</strong>"),
115+
? _td("devtools|room_encrypted")
116+
: _td("devtools|room_not_encrypted"),
115117
{},
116118
{
117119
strong: (sub) => <strong>{sub}</strong>,
@@ -122,33 +124,36 @@ export default function RoomNotifications({ onBack }: IDevtoolsProps): JSX.Eleme
122124
</section>
123125

124126
<section>
125-
<h2>{_t("Main timeline")}</h2>
127+
<h2>{_t("devtools|main_timeline")}</h2>
126128

127129
<ul>
128130
<li>
129-
{_t("Total: ")} {room.getRoomUnreadNotificationCount(NotificationCountType.Total)}
131+
{_t("devtools|room_notifications_total")}{" "}
132+
{room.getRoomUnreadNotificationCount(NotificationCountType.Total)}
130133
</li>
131134
<li>
132-
{_t("Highlight: ")} {room.getRoomUnreadNotificationCount(NotificationCountType.Highlight)}
135+
{_t("devtools|room_notifications_highlight")}{" "}
136+
{room.getRoomUnreadNotificationCount(NotificationCountType.Highlight)}
133137
</li>
134138
<li>
135-
{_t("Dot: ")} {doesRoomOrThreadHaveUnreadMessages(room) + ""}
139+
{_t("devtools|room_notifications_dot")} {doesRoomOrThreadHaveUnreadMessages(room) + ""}
136140
</li>
137141
{roomHasUnread(room) && (
138142
<>
139143
<UserReadUpTo target={room} />
140144
<li>
141-
{_t("Last event:")}
145+
{_t("devtools|room_notifications_last_event")}
142146
<ul>
143147
<li>
144-
{_t("ID: ")} <strong>{room.timeline[room.timeline.length - 1].getId()}</strong>
148+
{_t("devtools|id")}{" "}
149+
<strong>{room.timeline[room.timeline.length - 1].getId()}</strong>
145150
</li>
146151
<li>
147-
{_t("Type: ")}{" "}
152+
{_t("devtools|room_notifications_type")}{" "}
148153
<strong>{room.timeline[room.timeline.length - 1].getType()}</strong>
149154
</li>
150155
<li>
151-
{_t("Sender: ")}{" "}
156+
{_t("devtools|room_notifications_sender")}{" "}
152157
<strong>{room.timeline[room.timeline.length - 1].getSender()}</strong>
153158
</li>
154159
</ul>
@@ -159,17 +164,17 @@ export default function RoomNotifications({ onBack }: IDevtoolsProps): JSX.Eleme
159164
</section>
160165

161166
<section>
162-
<h2>{_t("Threads timeline")}</h2>
167+
<h2>{_t("devtools|threads_timeline")}</h2>
163168
<ul>
164169
{room
165170
.getThreads()
166171
.filter((thread) => threadHasUnread(thread))
167172
.map((thread) => (
168173
<li key={thread.id}>
169-
{_t("Thread Id: ")} {thread.id}
174+
{_t("devtools|room_notifications_thread_id")} {thread.id}
170175
<ul>
171176
<li>
172-
{_t("Total: ")}
177+
{_t("devtools|room_notifications_total")}
173178
<strong>
174179
{room.getThreadUnreadNotificationCount(
175180
thread.id,
@@ -178,7 +183,7 @@ export default function RoomNotifications({ onBack }: IDevtoolsProps): JSX.Eleme
178183
</strong>
179184
</li>
180185
<li>
181-
{_t("Highlight: ")}
186+
{_t("devtools|room_notifications_highlight")}
182187
<strong>
183188
{room.getThreadUnreadNotificationCount(
184189
thread.id,
@@ -187,20 +192,23 @@ export default function RoomNotifications({ onBack }: IDevtoolsProps): JSX.Eleme
187192
</strong>
188193
</li>
189194
<li>
190-
{_t("Dot: ")} <strong>{doesRoomOrThreadHaveUnreadMessages(thread) + ""}</strong>
195+
{_t("devtools|room_notifications_dot")}{" "}
196+
<strong>{doesRoomOrThreadHaveUnreadMessages(thread) + ""}</strong>
191197
</li>
192198
<UserReadUpTo target={thread} />
193199
<li>
194-
{_t("Last event:")}
200+
{_t("devtools|room_notifications_last_event")}
195201
<ul>
196202
<li>
197-
{_t("ID: ")} <strong>{thread.lastReply()?.getId()}</strong>
203+
{_t("devtools|id")} <strong>{thread.lastReply()?.getId()}</strong>
198204
</li>
199205
<li>
200-
{_t("Type: ")} <strong>{thread.lastReply()?.getType()}</strong>
206+
{_t("devtools|room_notifications_type")}{" "}
207+
<strong>{thread.lastReply()?.getType()}</strong>
201208
</li>
202209
<li>
203-
{_t("Sender: ")} <strong>{thread.lastReply()?.getSender()}</strong>
210+
{_t("devtools|room_notifications_sender")}{" "}
211+
<strong>{thread.lastReply()?.getSender()}</strong>
204212
</li>
205213
</ul>
206214
</li>

src/components/views/dialogs/devtools/RoomState.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ const StateEventButton: React.FC<StateEventButtonProps> = ({ label, onClick }) =
9797

9898
let content = label;
9999
if (!trimmed) {
100-
content = label.length > 0 ? _t("<%(count)s spaces>", { count: label.length }) : _t("<empty string>");
100+
content = label.length > 0 ? _t("devtools|spaces", { count: label.length }) : _t("devtools|empty_string");
101101
}
102102

103103
return (
@@ -150,7 +150,7 @@ const RoomStateExplorerEventType: React.FC<IEventTypeProps> = ({ eventType, onBa
150150
const onHistoryClick = (): void => {
151151
setHistory(true);
152152
};
153-
const extraButton = <button onClick={onHistoryClick}>{_t("See history")}</button>;
153+
const extraButton = <button onClick={onHistoryClick}>{_t("devtools|see_history")}</button>;
154154
return <EventViewer mxEvent={event} onBack={_onBack} Editor={StateEventEditor} extraButton={extraButton} />;
155155
}
156156

@@ -180,11 +180,11 @@ export const RoomStateExplorer: React.FC<IDevtoolsProps> = ({ onBack, setTool })
180180
}
181181

182182
const onAction = async (): Promise<void> => {
183-
setTool(_t("Send custom state event"), StateEventEditor);
183+
setTool(_t("devtools|send_custom_state_event"), StateEventEditor);
184184
};
185185

186186
return (
187-
<BaseTool onBack={onBack} actionLabel={_t("Send custom state event")} onAction={onAction}>
187+
<BaseTool onBack={onBack} actionLabel={_t("devtools|send_custom_state_event")} onAction={onAction}>
188188
<FilteredList query={query} onChange={setQuery}>
189189
{Array.from(events.keys()).map((eventType) => (
190190
<StateEventButton key={eventType} label={eventType} onClick={() => setEventType(eventType)} />

src/components/views/dialogs/devtools/ServerInfo.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,25 +73,25 @@ const ServerInfo: React.FC<IDevtoolsProps> = ({ onBack }) => {
7373
} else {
7474
body = (
7575
<>
76-
<h4>{_t("Capabilities")}</h4>
76+
<h4>{_t("common|capabilities")}</h4>
7777
{capabilities !== FAILED_TO_LOAD ? (
7878
<SyntaxHighlight language="json" children={JSON.stringify(capabilities, null, 4)} />
7979
) : (
80-
<div>{_t("Failed to load.")}</div>
80+
<div>{_t("devtools|failed_to_load")}</div>
8181
)}
8282

83-
<h4>{_t("Client Versions")}</h4>
83+
<h4>{_t("devtools|client_versions")}</h4>
8484
{clientVersions !== FAILED_TO_LOAD ? (
8585
<SyntaxHighlight language="json" children={JSON.stringify(clientVersions, null, 4)} />
8686
) : (
87-
<div>{_t("Failed to load.")}</div>
87+
<div>{_t("devtools|failed_to_load")}</div>
8888
)}
8989

90-
<h4>{_t("Server Versions")}</h4>
90+
<h4>{_t("devtools|server_versions")}</h4>
9191
{serverVersions !== FAILED_TO_LOAD ? (
9292
<SyntaxHighlight language="json" children={JSON.stringify(serverVersions, null, 4)} />
9393
) : (
94-
<div>{_t("Failed to load.")}</div>
94+
<div>{_t("devtools|failed_to_load")}</div>
9595
)}
9696
</>
9797
);

src/components/views/dialogs/devtools/ServersInRoom.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ const ServersInRoom: React.FC<IDevtoolsProps> = ({ onBack }) => {
3939
<table>
4040
<thead>
4141
<tr>
42-
<th>{_t("Server")}</th>
43-
<th>{_t("Number of users")}</th>
42+
<th>{_t("common|server")}</th>
43+
<th>{_t("devtools|number_of_users")}</th>
4444
</tr>
4545
</thead>
4646
<tbody>

0 commit comments

Comments
 (0)