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

Commit 8c35abb

Browse files
authored
Migrate more strings to translation keys (#11601)
1 parent 564d4ed commit 8c35abb

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

+3784
-3553
lines changed

src/SlashCommands.tsx

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ export const Commands = [
624624
!isCurrentLocalRoom(cli),
625625
runFn: function (cli, roomId, threadId, widgetUrl) {
626626
if (!widgetUrl) {
627-
return reject(new UserFriendlyError("Please supply a widget URL or embed code"));
627+
return reject(new UserFriendlyError("slash_command|addwidget_missing_url"));
628628
}
629629

630630
// Try and parse out a widget URL from iframes
@@ -635,15 +635,15 @@ export const Commands = [
635635
if (iframe?.tagName.toLowerCase() === "iframe") {
636636
logger.log("Pulling URL out of iframe (embed code)");
637637
if (!iframe.hasAttribute("src")) {
638-
return reject(new UserFriendlyError("iframe has no src attribute"));
638+
return reject(new UserFriendlyError("slash_command|addwidget_iframe_missing_src"));
639639
}
640640
widgetUrl = iframe.getAttribute("src")!;
641641
}
642642
}
643643
}
644644

645645
if (!widgetUrl.startsWith("https://") && !widgetUrl.startsWith("http://")) {
646-
return reject(new UserFriendlyError("Please supply a https:// or http:// widget URL"));
646+
return reject(new UserFriendlyError("slash_command|addwidget_invalid_protocol"));
647647
}
648648
if (WidgetUtils.canUserModifyWidgets(cli, roomId)) {
649649
const userId = cli.getUserId();
@@ -665,7 +665,7 @@ export const Commands = [
665665

666666
return success(WidgetUtils.setRoomWidget(cli, roomId, widgetId, type, widgetUrl, name, data));
667667
} else {
668-
return reject(new UserFriendlyError("You cannot modify widgets in this room."));
668+
return reject(new UserFriendlyError("slash_command|addwidget_no_permissions"));
669669
}
670670
},
671671
category: CommandCategories.admin,
@@ -749,7 +749,7 @@ export const Commands = [
749749
}),
750750
new Command({
751751
command: "discardsession",
752-
description: _td("Forces the current outbound group session in an encrypted room to be discarded"),
752+
description: _td("slash_command|discardsession"),
753753
isEnabled: (cli) => !isCurrentLocalRoom(cli),
754754
runFn: function (cli, roomId) {
755755
try {
@@ -764,7 +764,7 @@ export const Commands = [
764764
}),
765765
new Command({
766766
command: "remakeolm",
767-
description: _td("Developer command: Discards the current outbound group session and sets up new Olm sessions"),
767+
description: _td("slash_command|remakeolm"),
768768
isEnabled: (cli) => {
769769
return SettingsStore.getValue("developerMode") && !isCurrentLocalRoom(cli);
770770
},
@@ -856,7 +856,7 @@ export const Commands = [
856856
}),
857857
new Command({
858858
command: "tovirtual",
859-
description: _td("Switches to this room's virtual room, if it has one"),
859+
description: _td("slash_command|tovirtual"),
860860
category: CommandCategories.advanced,
861861
isEnabled(cli): boolean {
862862
return !!LegacyCallHandler.instance.getSupportsVirtualRooms() && !isCurrentLocalRoom(cli);
@@ -865,7 +865,7 @@ export const Commands = [
865865
return success(
866866
(async (): Promise<void> => {
867867
const room = await VoipUserMapper.sharedInstance().getVirtualRoomForRoom(roomId);
868-
if (!room) throw new UserFriendlyError("No virtual room for this room");
868+
if (!room) throw new UserFriendlyError("slash_command|tovirtual_not_found");
869869
dis.dispatch<ViewRoomPayload>({
870870
action: Action.ViewRoom,
871871
room_id: room.roomId,
@@ -878,7 +878,7 @@ export const Commands = [
878878
}),
879879
new Command({
880880
command: "query",
881-
description: _td("Opens chat with the given user"),
881+
description: _td("slash_command|query"),
882882
args: "<user-id>",
883883
runFn: function (cli, roomId, threadId, userId) {
884884
// easter-egg for now: look up phone numbers through the thirdparty API
@@ -893,7 +893,7 @@ export const Commands = [
893893
if (isPhoneNumber) {
894894
const results = await LegacyCallHandler.instance.pstnLookup(userId);
895895
if (!results || results.length === 0 || !results[0].userid) {
896-
throw new UserFriendlyError("Unable to find Matrix ID for phone number");
896+
throw new UserFriendlyError("slash_command|query_not_found_phone_number");
897897
}
898898
userId = results[0].userid;
899899
}
@@ -949,13 +949,13 @@ export const Commands = [
949949
}),
950950
new Command({
951951
command: "holdcall",
952-
description: _td("Places the call in the current room on hold"),
952+
description: _td("slash_command|holdcall"),
953953
category: CommandCategories.other,
954954
isEnabled: (cli) => !isCurrentLocalRoom(cli),
955955
runFn: function (cli, roomId, threadId, args) {
956956
const call = LegacyCallHandler.instance.getCallForRoom(roomId);
957957
if (!call) {
958-
return reject(new UserFriendlyError("No active call in this room"));
958+
return reject(new UserFriendlyError("slash_command|no_active_call"));
959959
}
960960
call.setRemoteOnHold(true);
961961
return success();
@@ -964,13 +964,13 @@ export const Commands = [
964964
}),
965965
new Command({
966966
command: "unholdcall",
967-
description: _td("Takes the call in the current room off hold"),
967+
description: _td("slash_command|unholdcall"),
968968
category: CommandCategories.other,
969969
isEnabled: (cli) => !isCurrentLocalRoom(cli),
970970
runFn: function (cli, roomId, threadId, args) {
971971
const call = LegacyCallHandler.instance.getCallForRoom(roomId);
972972
if (!call) {
973-
return reject(new UserFriendlyError("No active call in this room"));
973+
return reject(new UserFriendlyError("slash_command|no_active_call"));
974974
}
975975
call.setRemoteOnHold(false);
976976
return success();
@@ -979,24 +979,24 @@ export const Commands = [
979979
}),
980980
new Command({
981981
command: "converttodm",
982-
description: _td("Converts the room to a DM"),
982+
description: _td("slash_command|converttodm"),
983983
category: CommandCategories.other,
984984
isEnabled: (cli) => !isCurrentLocalRoom(cli),
985985
runFn: function (cli, roomId, threadId, args) {
986986
const room = cli.getRoom(roomId);
987-
if (!room) return reject(new UserFriendlyError("Could not find room"));
987+
if (!room) return reject(new UserFriendlyError("slash_command|could_not_find_room"));
988988
return success(guessAndSetDMRoom(room, true));
989989
},
990990
renderingTypes: [TimelineRenderingType.Room],
991991
}),
992992
new Command({
993993
command: "converttoroom",
994-
description: _td("Converts the DM to a room"),
994+
description: _td("slash_command|converttoroom"),
995995
category: CommandCategories.other,
996996
isEnabled: (cli) => !isCurrentLocalRoom(cli),
997997
runFn: function (cli, roomId, threadId, args) {
998998
const room = cli.getRoom(roomId);
999-
if (!room) return reject(new UserFriendlyError("Could not find room"));
999+
if (!room) return reject(new UserFriendlyError("slash_command|could_not_find_room"));
10001000
return success(guessAndSetDMRoom(room, false));
10011001
},
10021002
renderingTypes: [TimelineRenderingType.Room],
@@ -1007,7 +1007,7 @@ export const Commands = [
10071007
new Command({
10081008
command: "me",
10091009
args: "<message>",
1010-
description: _td("Displays action"),
1010+
description: _td("slash_command|me"),
10111011
category: CommandCategories.messages,
10121012
hideCompletionAfterSpace: true,
10131013
}),

src/accessibility/KeyboardShortcutUtils.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const getUIOnlyShortcuts = (): IKeyboardShortcuts => {
5050
key: Key.ENTER,
5151
shiftKey: !ctrlEnterToSend,
5252
},
53-
displayName: _td("New line"),
53+
displayName: _td("keyboard|composer_new_line"),
5454
},
5555
[KeyBindingAction.CompleteAutocomplete]: {
5656
default: {
@@ -62,14 +62,14 @@ const getUIOnlyShortcuts = (): IKeyboardShortcuts => {
6262
default: {
6363
key: Key.TAB,
6464
},
65-
displayName: _td("Force complete"),
65+
displayName: _td("keyboard|autocomplete_force"),
6666
},
6767
[KeyBindingAction.SearchInRoom]: {
6868
default: {
6969
ctrlOrCmdKey: true,
7070
key: Key.F,
7171
},
72-
displayName: _td("Search (must be enabled)"),
72+
displayName: _td("keyboard|search"),
7373
},
7474
};
7575

@@ -82,7 +82,7 @@ const getUIOnlyShortcuts = (): IKeyboardShortcuts => {
8282
ctrlOrCmdKey: true,
8383
key: DIGITS,
8484
},
85-
displayName: _td("Switch to space by number"),
85+
displayName: _td("keyboard|switch_to_space"),
8686
};
8787
}
8888

0 commit comments

Comments
 (0)