Migrate more strings to translation keys (#11606)
This commit is contained in:
parent
3608d52c4a
commit
491b43ef09
59 changed files with 3097 additions and 2950 deletions
|
@ -52,60 +52,60 @@ export interface TranslatedCapabilityText {
|
|||
export class CapabilityText {
|
||||
private static simpleCaps: Record<Capability, Partial<Record<WidgetKind | GENERIC_WIDGET_KIND, TranslationKey>>> = {
|
||||
[MatrixCapabilities.AlwaysOnScreen]: {
|
||||
[WidgetKind.Room]: _td("Remain on your screen when viewing another room, when running"),
|
||||
[GENERIC_WIDGET_KIND]: _td("Remain on your screen while running"),
|
||||
[WidgetKind.Room]: _td("widget|capability|always_on_screen_viewing_another_room"),
|
||||
[GENERIC_WIDGET_KIND]: _td("widget|capability|always_on_screen_generic"),
|
||||
},
|
||||
[MatrixCapabilities.StickerSending]: {
|
||||
[WidgetKind.Room]: _td("Send stickers into this room"),
|
||||
[GENERIC_WIDGET_KIND]: _td("Send stickers into your active room"),
|
||||
[WidgetKind.Room]: _td("widget|capability|send_stickers_this_room"),
|
||||
[GENERIC_WIDGET_KIND]: _td("widget|capability|send_stickers_active_room"),
|
||||
},
|
||||
[ElementWidgetCapabilities.CanChangeViewedRoom]: {
|
||||
[GENERIC_WIDGET_KIND]: _td("Change which room you're viewing"),
|
||||
[GENERIC_WIDGET_KIND]: _td("widget|capability|switch_room"),
|
||||
},
|
||||
[MatrixCapabilities.MSC2931Navigate]: {
|
||||
[GENERIC_WIDGET_KIND]: _td("Change which room, message, or user you're viewing"),
|
||||
[GENERIC_WIDGET_KIND]: _td("widget|capability|switch_room_message_user"),
|
||||
},
|
||||
};
|
||||
|
||||
private static stateSendRecvCaps: SendRecvStaticCapText = {
|
||||
[EventType.RoomTopic]: {
|
||||
[WidgetKind.Room]: {
|
||||
[EventDirection.Send]: _td("Change the topic of this room"),
|
||||
[EventDirection.Receive]: _td("See when the topic changes in this room"),
|
||||
[EventDirection.Send]: _td("widget|capability|change_topic_this_room"),
|
||||
[EventDirection.Receive]: _td("widget|capability|see_topic_change_this_room"),
|
||||
},
|
||||
[GENERIC_WIDGET_KIND]: {
|
||||
[EventDirection.Send]: _td("Change the topic of your active room"),
|
||||
[EventDirection.Receive]: _td("See when the topic changes in your active room"),
|
||||
[EventDirection.Send]: _td("widget|capability|change_topic_active_room"),
|
||||
[EventDirection.Receive]: _td("widget|capability|see_topic_change_active_room"),
|
||||
},
|
||||
},
|
||||
[EventType.RoomName]: {
|
||||
[WidgetKind.Room]: {
|
||||
[EventDirection.Send]: _td("Change the name of this room"),
|
||||
[EventDirection.Receive]: _td("See when the name changes in this room"),
|
||||
[EventDirection.Send]: _td("widget|capability|change_name_this_room"),
|
||||
[EventDirection.Receive]: _td("widget|capability|see_name_change_this_room"),
|
||||
},
|
||||
[GENERIC_WIDGET_KIND]: {
|
||||
[EventDirection.Send]: _td("Change the name of your active room"),
|
||||
[EventDirection.Receive]: _td("See when the name changes in your active room"),
|
||||
[EventDirection.Send]: _td("widget|capability|change_name_active_room"),
|
||||
[EventDirection.Receive]: _td("widget|capability|see_name_change_active_room"),
|
||||
},
|
||||
},
|
||||
[EventType.RoomAvatar]: {
|
||||
[WidgetKind.Room]: {
|
||||
[EventDirection.Send]: _td("Change the avatar of this room"),
|
||||
[EventDirection.Receive]: _td("See when the avatar changes in this room"),
|
||||
[EventDirection.Send]: _td("widget|capability|change_avatar_this_room"),
|
||||
[EventDirection.Receive]: _td("widget|capability|see_avatar_change_this_room"),
|
||||
},
|
||||
[GENERIC_WIDGET_KIND]: {
|
||||
[EventDirection.Send]: _td("Change the avatar of your active room"),
|
||||
[EventDirection.Receive]: _td("See when the avatar changes in your active room"),
|
||||
[EventDirection.Send]: _td("widget|capability|change_avatar_active_room"),
|
||||
[EventDirection.Receive]: _td("widget|capability|see_avatar_change_active_room"),
|
||||
},
|
||||
},
|
||||
[EventType.RoomMember]: {
|
||||
[WidgetKind.Room]: {
|
||||
[EventDirection.Send]: _td("Remove, ban, or invite people to this room, and make you leave"),
|
||||
[EventDirection.Receive]: _td("See when people join, leave, or are invited to this room"),
|
||||
[EventDirection.Send]: _td("widget|capability|remove_ban_invite_leave_this_room"),
|
||||
[EventDirection.Receive]: _td("widget|capability|receive_membership_this_room"),
|
||||
},
|
||||
[GENERIC_WIDGET_KIND]: {
|
||||
[EventDirection.Send]: _td("Remove, ban, or invite people to your active room, and make you leave"),
|
||||
[EventDirection.Receive]: _td("See when people join, leave, or are invited to your active room"),
|
||||
[EventDirection.Send]: _td("widget|capability|remove_ban_invite_leave_active_room"),
|
||||
[EventDirection.Receive]: _td("widget|capability|receive_membership_active_room"),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -113,12 +113,12 @@ export class CapabilityText {
|
|||
private static nonStateSendRecvCaps: SendRecvStaticCapText = {
|
||||
[EventType.Sticker]: {
|
||||
[WidgetKind.Room]: {
|
||||
[EventDirection.Send]: _td("Send stickers to this room as you"),
|
||||
[EventDirection.Receive]: _td("See when a sticker is posted in this room"),
|
||||
[EventDirection.Send]: _td("widget|capability|send_stickers_this_room_as_you"),
|
||||
[EventDirection.Receive]: _td("widget|capability|see_sticker_posted_this_room"),
|
||||
},
|
||||
[GENERIC_WIDGET_KIND]: {
|
||||
[EventDirection.Send]: _td("Send stickers to your active room as you"),
|
||||
[EventDirection.Receive]: _td("See when anyone posts a sticker to your active room"),
|
||||
[EventDirection.Send]: _td("widget|capability|send_stickers_active_room_as_you"),
|
||||
[EventDirection.Receive]: _td("widget|capability|see_sticker_posted_active_room"),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -126,8 +126,8 @@ export class CapabilityText {
|
|||
private static bylineFor(eventCap: WidgetEventCapability): TranslatedString {
|
||||
if (eventCap.kind === EventKind.State) {
|
||||
return !eventCap.keyStr
|
||||
? _t("with an empty state key")
|
||||
: _t("with state key %(stateKey)s", { stateKey: eventCap.keyStr });
|
||||
? _t("widget|capability|byline_empty_state_key")
|
||||
: _t("widget|capability|byline_state_key", { stateKey: eventCap.keyStr });
|
||||
}
|
||||
return null; // room messages are handled specially
|
||||
}
|
||||
|
@ -149,13 +149,13 @@ export class CapabilityText {
|
|||
// the timeline caps to the end for UI purposes.
|
||||
if (isTimelineCapability(capability)) {
|
||||
if (isTimelineCapabilityFor(capability, Symbols.AnyRoom)) {
|
||||
return { primary: _t("The above, but in any room you are joined or invited to as well") };
|
||||
return { primary: _t("widget|capability|any_room") };
|
||||
} else {
|
||||
const roomId = getTimelineRoomIDFromCapability(capability);
|
||||
const room = MatrixClientPeg.safeGet().getRoom(roomId);
|
||||
return {
|
||||
primary: _t(
|
||||
"The above, but in <Room /> as well",
|
||||
"widget|capability|specific_room",
|
||||
{},
|
||||
{
|
||||
Room: () => {
|
||||
|
@ -212,7 +212,7 @@ export class CapabilityText {
|
|||
if (eventCap.direction === EventDirection.Send) {
|
||||
return {
|
||||
primary: _t(
|
||||
"Send <b>%(eventType)s</b> events as you in this room",
|
||||
"widget|capability|send_event_type_this_room",
|
||||
{
|
||||
eventType: eventCap.eventType,
|
||||
},
|
||||
|
@ -225,7 +225,7 @@ export class CapabilityText {
|
|||
} else {
|
||||
return {
|
||||
primary: _t(
|
||||
"See <b>%(eventType)s</b> events posted to this room",
|
||||
"widget|capability|see_event_type_sent_this_room",
|
||||
{
|
||||
eventType: eventCap.eventType,
|
||||
},
|
||||
|
@ -241,7 +241,7 @@ export class CapabilityText {
|
|||
if (eventCap.direction === EventDirection.Send) {
|
||||
return {
|
||||
primary: _t(
|
||||
"Send <b>%(eventType)s</b> events as you in your active room",
|
||||
"widget|capability|send_event_type_active_room",
|
||||
{
|
||||
eventType: eventCap.eventType,
|
||||
},
|
||||
|
@ -254,7 +254,7 @@ export class CapabilityText {
|
|||
} else {
|
||||
return {
|
||||
primary: _t(
|
||||
"See <b>%(eventType)s</b> events posted to your active room",
|
||||
"widget|capability|see_event_type_sent_active_room",
|
||||
{
|
||||
eventType: eventCap.eventType,
|
||||
},
|
||||
|
@ -271,7 +271,7 @@ export class CapabilityText {
|
|||
// We don't have enough context to render this capability specially, so we'll present it as-is
|
||||
return {
|
||||
primary: _t(
|
||||
"The <b>%(capability)s</b> capability",
|
||||
"widget|capability|capability",
|
||||
{ capability },
|
||||
{
|
||||
b: (sub) => <b>{sub}</b>,
|
||||
|
@ -287,15 +287,15 @@ export class CapabilityText {
|
|||
return {
|
||||
primary:
|
||||
kind === WidgetKind.Room
|
||||
? _t("Send messages as you in this room")
|
||||
: _t("Send messages as you in your active room"),
|
||||
? _t("widget|capability|send_messages_this_room")
|
||||
: _t("widget|capability|send_messages_active_room"),
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
primary:
|
||||
kind === WidgetKind.Room
|
||||
? _t("See messages posted to this room")
|
||||
: _t("See messages posted to your active room"),
|
||||
? _t("widget|capability|see_messages_sent_this_room")
|
||||
: _t("widget|capability|see_messages_sent_active_room"),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -308,15 +308,15 @@ export class CapabilityText {
|
|||
return {
|
||||
primary:
|
||||
kind === WidgetKind.Room
|
||||
? _t("Send text messages as you in this room")
|
||||
: _t("Send text messages as you in your active room"),
|
||||
? _t("widget|capability|send_text_messages_this_room")
|
||||
: _t("widget|capability|send_text_messages_active_room"),
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
primary:
|
||||
kind === WidgetKind.Room
|
||||
? _t("See text messages posted to this room")
|
||||
: _t("See text messages posted to your active room"),
|
||||
? _t("widget|capability|see_text_messages_sent_this_room")
|
||||
: _t("widget|capability|see_text_messages_sent_active_room"),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -325,15 +325,15 @@ export class CapabilityText {
|
|||
return {
|
||||
primary:
|
||||
kind === WidgetKind.Room
|
||||
? _t("Send emotes as you in this room")
|
||||
: _t("Send emotes as you in your active room"),
|
||||
? _t("widget|capability|send_emotes_this_room")
|
||||
: _t("widget|capability|send_emotes_active_room"),
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
primary:
|
||||
kind === WidgetKind.Room
|
||||
? _t("See emotes posted to this room")
|
||||
: _t("See emotes posted to your active room"),
|
||||
? _t("widget|capability|see_sent_emotes_this_room")
|
||||
: _t("widget|capability|see_sent_emotes_active_room"),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -342,15 +342,15 @@ export class CapabilityText {
|
|||
return {
|
||||
primary:
|
||||
kind === WidgetKind.Room
|
||||
? _t("Send images as you in this room")
|
||||
: _t("Send images as you in your active room"),
|
||||
? _t("widget|capability|send_images_this_room")
|
||||
: _t("widget|capability|send_images_active_room"),
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
primary:
|
||||
kind === WidgetKind.Room
|
||||
? _t("See images posted to this room")
|
||||
: _t("See images posted to your active room"),
|
||||
? _t("widget|capability|see_images_sent_this_room")
|
||||
: _t("widget|capability|see_images_sent_active_room"),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -359,15 +359,15 @@ export class CapabilityText {
|
|||
return {
|
||||
primary:
|
||||
kind === WidgetKind.Room
|
||||
? _t("Send videos as you in this room")
|
||||
: _t("Send videos as you in your active room"),
|
||||
? _t("widget|capability|send_videos_this_room")
|
||||
: _t("widget|capability|send_videos_active_room"),
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
primary:
|
||||
kind === WidgetKind.Room
|
||||
? _t("See videos posted to this room")
|
||||
: _t("See videos posted to your active room"),
|
||||
? _t("widget|capability|see_videos_sent_this_room")
|
||||
: _t("widget|capability|see_videos_sent_active_room"),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -376,15 +376,15 @@ export class CapabilityText {
|
|||
return {
|
||||
primary:
|
||||
kind === WidgetKind.Room
|
||||
? _t("Send general files as you in this room")
|
||||
: _t("Send general files as you in your active room"),
|
||||
? _t("widget|capability|send_files_this_room")
|
||||
: _t("widget|capability|send_files_active_room"),
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
primary:
|
||||
kind === WidgetKind.Room
|
||||
? _t("See general files posted to this room")
|
||||
: _t("See general files posted to your active room"),
|
||||
? _t("widget|capability|see_sent_files_this_room")
|
||||
: _t("widget|capability|see_sent_files_active_room"),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -393,7 +393,7 @@ export class CapabilityText {
|
|||
if (eventCap.direction === EventDirection.Send) {
|
||||
if (kind === WidgetKind.Room) {
|
||||
primary = _t(
|
||||
"Send <b>%(msgtype)s</b> messages as you in this room",
|
||||
"widget|capability|send_msgtype_this_room",
|
||||
{
|
||||
msgtype: eventCap.keyStr,
|
||||
},
|
||||
|
@ -403,7 +403,7 @@ export class CapabilityText {
|
|||
);
|
||||
} else {
|
||||
primary = _t(
|
||||
"Send <b>%(msgtype)s</b> messages as you in your active room",
|
||||
"widget|capability|send_msgtype_active_room",
|
||||
{
|
||||
msgtype: eventCap.keyStr,
|
||||
},
|
||||
|
@ -415,7 +415,7 @@ export class CapabilityText {
|
|||
} else {
|
||||
if (kind === WidgetKind.Room) {
|
||||
primary = _t(
|
||||
"See <b>%(msgtype)s</b> messages posted to this room",
|
||||
"widget|capability|see_msgtype_sent_this_room",
|
||||
{
|
||||
msgtype: eventCap.keyStr,
|
||||
},
|
||||
|
@ -425,7 +425,7 @@ export class CapabilityText {
|
|||
);
|
||||
} else {
|
||||
primary = _t(
|
||||
"See <b>%(msgtype)s</b> messages posted to your active room",
|
||||
"widget|capability|see_msgtype_sent_active_room",
|
||||
{
|
||||
msgtype: eventCap.keyStr,
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue