Migrate more strings to translation keys (#11613)

This commit is contained in:
Michael Telatynski 2023-09-19 17:16:38 +01:00 committed by GitHub
parent d46d4b3d04
commit 5cb8cbd893
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
111 changed files with 8214 additions and 6766 deletions

View file

@ -270,7 +270,7 @@ const SpaceLanding: React.FC<{ space: Room }> = ({ space }) => {
<RoomName room={space}>
{(name) => {
const tags = { name: () => <h1>{name}</h1> };
return _t("Welcome to <name/>", {}, tags) as JSX.Element;
return _t("space|landing_welcome", {}, tags) as JSX.Element;
}}
</RoomName>
</div>
@ -351,7 +351,7 @@ const SpaceSetupFirstRooms: React.FC<{
onFinished(roomIds[0] ?? undefined);
} catch (e) {
logger.error("Failed to create initial space rooms", e);
setError(_t("Failed to create initial space rooms"));
setError(_t("create_space|failed_create_initial_rooms"));
}
setBusy(false);
};
@ -360,10 +360,10 @@ const SpaceSetupFirstRooms: React.FC<{
ev.preventDefault();
onFinished();
};
let buttonLabel = _t("Skip for now");
let buttonLabel = _t("create_space|skip_action");
if (roomNames.some((name) => name.trim())) {
onClick = onNextClick;
buttonLabel = busy ? _t("Creating rooms…") : _t("action|continue");
buttonLabel = busy ? _t("create_space|creating_rooms") : _t("action|continue");
}
return (
@ -397,18 +397,14 @@ const SpaceAddExistingRooms: React.FC<{
}> = ({ space, onFinished }) => {
return (
<div>
<h1>{_t("What do you want to organise?")}</h1>
<div className="mx_SpaceRoomView_description">
{_t(
"Pick rooms or conversations to add. This is just a space for you, no one will be informed. You can add more later.",
)}
</div>
<h1>{_t("create_space|add_existing_rooms_heading")}</h1>
<div className="mx_SpaceRoomView_description">{_t("create_space|add_existing_rooms_description")}</div>
<AddExistingToSpace
space={space}
emptySelectionButton={
<AccessibleButton kind="primary" onClick={onFinished}>
{_t("Skip for now")}
{_t("create_space|skip_action")}
</AccessibleButton>
}
filterPlaceholder={_t("Search for rooms")}
@ -433,19 +429,17 @@ const SpaceSetupPublicShare: React.FC<ISpaceSetupPublicShareProps> = ({
return (
<div className="mx_SpaceRoomView_publicShare">
<h1>
{_t("Share %(name)s", {
{_t("create_space|share_heading", {
name: justCreatedOpts?.createOpts?.name || space.name,
})}
</h1>
<div className="mx_SpaceRoomView_description">
{_t("It's just you at the moment, it will be even better with others.")}
</div>
<div className="mx_SpaceRoomView_description">{_t("create_space|share_description")}</div>
<SpacePublicShare space={space} />
<div className="mx_SpaceRoomView_buttons">
<AccessibleButton kind="primary" onClick={onFinished}>
{firstRoomId ? _t("Go to my first room") : _t("Go to my space")}
{firstRoomId ? _t("create_space|done_action_first_room") : _t("create_space|done_action")}
</AccessibleButton>
</div>
</div>
@ -459,9 +453,9 @@ const SpaceSetupPrivateScope: React.FC<{
}> = ({ space, justCreatedOpts, onFinished }) => {
return (
<div className="mx_SpaceRoomView_privateScope">
<h1>{_t("Who are you working with?")}</h1>
<h1>{_t("create_space|private_personal_heading")}</h1>
<div className="mx_SpaceRoomView_description">
{_t("Make sure the right people have access to %(name)s", {
{_t("create_space|private_personal_description", {
name: justCreatedOpts?.createOpts?.name || space.name,
})}
</div>
@ -472,8 +466,8 @@ const SpaceSetupPrivateScope: React.FC<{
onFinished(false);
}}
>
{_t("Just me")}
<div>{_t("A private space to organise your rooms")}</div>
{_t("create_space|personal_space")}
<div>{_t("create_space|personal_space_description")}</div>
</AccessibleButton>
<AccessibleButton
className="mx_SpaceRoomView_privateScope_meAndMyTeammatesButton"
@ -481,8 +475,8 @@ const SpaceSetupPrivateScope: React.FC<{
onFinished(true);
}}
>
{_t("Me and my teammates")}
<div>{_t("A private space for you and your teammates")}</div>
{_t("create_space|private_space")}
<div>{_t("create_space|private_space_description")}</div>
</AccessibleButton>
</div>
);
@ -550,7 +544,7 @@ const SpaceSetupPrivateInvite: React.FC<{
if (failedUsers.length > 0) {
logger.log("Failed to invite users to space: ", result);
setError(
_t("Failed to invite the following users to your space: %(csvUsers)s", {
_t("create_space|failed_invite_users", {
csvUsers: failedUsers.join(", "),
}),
);
@ -568,18 +562,16 @@ const SpaceSetupPrivateInvite: React.FC<{
ev.preventDefault();
onFinished();
};
let buttonLabel = _t("Skip for now");
let buttonLabel = _t("create_space|skip_action");
if (emailAddresses.some((name) => name.trim())) {
onClick = onNextClick;
buttonLabel = busy ? _t("Inviting…") : _t("action|continue");
buttonLabel = busy ? _t("create_space|inviting_users") : _t("action|continue");
}
return (
<div className="mx_SpaceRoomView_inviteTeammates">
<h1>{_t("Invite your teammates")}</h1>
<div className="mx_SpaceRoomView_description">
{_t("Make sure the right people have access. You can invite more later.")}
</div>
<h1>{_t("create_space|invite_teammates_heading")}</h1>
<div className="mx_SpaceRoomView_description">{_t("create_space|invite_teammates_description")}</div>
{error && <div className="mx_SpaceRoomView_errorText">{error}</div>}
<form onSubmit={onClick} id="mx_SpaceSetupPrivateInvite">
@ -591,7 +583,7 @@ const SpaceSetupPrivateInvite: React.FC<{
className="mx_SpaceRoomView_inviteTeammates_inviteDialogButton"
onClick={() => showRoomInviteDialog(space.roomId)}
>
{_t("Invite by username")}
{_t("create_space|invite_teammates_by_username")}
</AccessibleButton>
</div>
@ -701,14 +693,14 @@ export default class SpaceRoomView extends React.PureComponent<IProps, IState> {
return (
<SpaceSetupFirstRooms
space={this.props.space}
title={_t("What are some things you want to discuss in %(spaceName)s?", {
title={_t("create_space|setup_rooms_community_heading", {
spaceName: this.props.justCreatedOpts?.createOpts?.name || this.props.space.name,
})}
description={
<>
{_t("Let's create a room for each of them.")}
{_t("create_space|setup_rooms_community_description")}
<br />
{_t("You can add more later too, including already existing ones.")}
{_t("create_space|setup_rooms_description")}
</>
}
onFinished={(firstRoomId: string) => this.setState({ phase: Phase.PublicShare, firstRoomId })}
@ -745,12 +737,12 @@ export default class SpaceRoomView extends React.PureComponent<IProps, IState> {
return (
<SpaceSetupFirstRooms
space={this.props.space}
title={_t("What projects are your team working on?")}
title={_t("create_space|setup_rooms_private_heading")}
description={
<>
{_t("We'll create rooms for each of them.")}
{_t("create_space|setup_rooms_private_description")}
<br />
{_t("You can add more later too, including already existing ones.")}
{_t("create_space|setup_rooms_description")}
</>
}
onFinished={(firstRoomId: string) => this.setState({ phase: Phase.PrivateInvite, firstRoomId })}

View file

@ -74,13 +74,13 @@ export const ThreadPanelHeader: React.FC<{
const [menuDisplayed, button, openMenu, closeMenu] = useContextMenu<HTMLElement>();
const options: readonly ThreadPanelHeaderOption[] = [
{
label: _t("All threads"),
description: _t("Shows all threads from current room"),
label: _t("threads|all_threads"),
description: _t("threads|all_threads_description"),
key: ThreadFilterType.All,
},
{
label: _t("My threads"),
description: _t("Shows all threads you've participated in"),
label: _t("threads|my_threads"),
description: _t("threads|my_threads_description"),
key: ThreadFilterType.My,
},
];
@ -125,7 +125,7 @@ export const ThreadPanelHeader: React.FC<{
PosthogTrackers.trackInteraction("WebRightPanelThreadPanelFilterDropdown", ev);
}}
>
{`${_t("Show:")} ${value?.label}`}
{`${_t("threads|show_thread_filter")} ${value?.label}`}
</ContextMenuButton>
{contextMenu}
</>
@ -146,17 +146,14 @@ const EmptyThread: React.FC<EmptyThreadIProps> = ({ hasThreads, filterOption, sh
body = (
<>
<p>
{_t(
"Reply to an ongoing thread or use “%(replyInThread)s” when hovering over a message to start a new one.",
{
replyInThread: _t("Reply in thread"),
},
)}
{_t("threads|empty_has_threads_tip", {
replyInThread: _t("Reply in thread"),
})}
</p>
<p>
{/* Always display that paragraph to prevent layout shift when hiding the button */}
{filterOption === ThreadFilterType.My ? (
<button onClick={showAllThreadsCallback}>{_t("Show all threads")}</button>
<button onClick={showAllThreadsCallback}>{_t("threads|show_all_threads")}</button>
) : (
<>&nbsp;</>
)}
@ -166,10 +163,10 @@ const EmptyThread: React.FC<EmptyThreadIProps> = ({ hasThreads, filterOption, sh
} else {
body = (
<>
<p>{_t("Threads help keep your conversations on-topic and easy to track.")}</p>
<p>{_t("threads|empty_explainer")}</p>
<p className="mx_ThreadPanel_empty_tip">
{_t(
"<b>Tip:</b> Use “%(replyInThread)s” when hovering over a message.",
"threads|empty_tip",
{
replyInThread: _t("Reply in thread"),
},
@ -185,7 +182,7 @@ const EmptyThread: React.FC<EmptyThreadIProps> = ({ hasThreads, filterOption, sh
return (
<aside className="mx_ThreadPanel_empty">
<div className="mx_ThreadPanel_largeIcon" />
<h2>{_t("Keep discussions organised with threads")}</h2>
<h2>{_t("threads|empty_heading")}</h2>
{body}
</aside>
);