Migrate action, common, a11y translation keys

```
move () {
  FROM=$1 TO=$2 find public/locales -type f -exec sh -c 'jq ".$TO = .\"$FROM\" | del(.\"$FROM\") | del(..|nulls) | select(length > 0)" {} | sponge {}' \;
}

move "Avatar" "common.avatar"
move "Camera" "common.camera"
move "Close" "action.close"
move "Copied!" "common.copied"
move "Copy" "action.copy"
move "Copy link" "action.copy_link"
move "Encrypted" "common.encrypted"
move "Go" "action.go"
move "Home" "common.home"
move "Invite" "action.invite"
move "Loading…" "common.loading"
move "Microphone" "common.microphone"
move "No" "action.no"
move "Not encrypted" "common.unencrypted"
move "Password" "common.password"
move "Profile" "common.profile"
move "Username" "common.username"
move "Video" "common.video"
move "Register" "action.register"
move "Remove" "action.remove"
move "Settings" "common.settings"
move "Sign in" "action.sign_in"
move "Sign out" "action.sign_out"
move "Submit" "action.submit"
move "User menu" "a11y.user_menu"
move "Audio" "common.audio"
move "Display name" "common.display_name"
```
This commit is contained in:
Michael Telatynski
2023-11-20 11:05:18 +00:00
parent 85250e6ea3
commit 71664f5f8e
47 changed files with 718 additions and 584 deletions

View File

@@ -137,7 +137,7 @@ export const LoadingView: FC = () => {
return (
<FullScreenView>
<h1>{t("Loading")}</h1>
<h1>{t("common.loading")}</h1>
</FullScreenView>
);
};

View File

@@ -136,7 +136,7 @@ export const Modal: FC<Props> = ({
<DialogClose
className={styles.close}
data-testid="modal_close"
aria-label={t("Close")}
aria-label={t("action.close")}
>
<CloseIcon width={20} height={20} />
</DialogClose>

View File

@@ -66,13 +66,13 @@ export const UserMenu: FC<Props> = ({
arr.push({
key: "settings",
icon: SettingsIcon,
label: t("Settings"),
label: "common.settings",
});
if (isPasswordlessUser && !preventNavigation) {
arr.push({
key: "login",
label: t("Sign in"),
label: "action.sign_in",
icon: LoginIcon,
dataTestid: "usermenu_login",
});
@@ -81,7 +81,7 @@ export const UserMenu: FC<Props> = ({
if (!isPasswordlessUser && !preventNavigation) {
arr.push({
key: "logout",
label: t("Sign out"),
label: "action.sign_out",
icon: LogoutIcon,
dataTestid: "usermenu_logout",
});
@@ -91,7 +91,7 @@ export const UserMenu: FC<Props> = ({
return arr;
}, [isAuthenticated, isPasswordlessUser, displayName, preventNavigation, t]);
const tooltip = useCallback(() => t("Profile"), [t]);
const tooltip = useCallback(() => t("common.profile"), [t]);
if (!isAuthenticated) {
return (
@@ -124,7 +124,7 @@ export const UserMenu: FC<Props> = ({
{
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(props: any): ReactNode => (
<Menu {...props} label={t("User menu")} onAction={onAction}>
<Menu {...props} label={t("a11y.user_menu")} onAction={onAction}>
{items.map(({ key, icon: Icon, label, dataTestid }) => (
<Item key={key} textValue={label}>
<Icon

View File

@@ -97,8 +97,8 @@ export const LoginPage: FC = () => {
<InputField
type="text"
ref={usernameRef}
placeholder={t("Username")}
label={t("Username")}
placeholder={t("common.username")}
label={t("common.username")}
autoCorrect="off"
autoCapitalize="none"
prefix="@"
@@ -110,8 +110,8 @@ export const LoginPage: FC = () => {
<InputField
type="password"
ref={passwordRef}
placeholder={t("Password")}
label={t("Password")}
placeholder={t("common.password")}
label={t("common.password")}
data-testid="login_password"
/>
</FieldRow>

View File

@@ -44,7 +44,7 @@ import { Config } from "../config/Config";
export const RegisterPage: FC = () => {
const { t } = useTranslation();
usePageTitle(t("Register"));
usePageTitle(("action.register"));
const { loading, authenticated, passwordlessUser, client, setClient } =
useClientLegacy();
@@ -170,8 +170,8 @@ export const RegisterPage: FC = () => {
<InputField
type="text"
name="userName"
placeholder={t("Username")}
label={t("Username")}
placeholder={t("common.username")}
label={t("common.username")}
autoCorrect="off"
autoCapitalize="none"
prefix="@"
@@ -188,8 +188,8 @@ export const RegisterPage: FC = () => {
setPassword(e.target.value)
}
value={password}
placeholder={t("Password")}
label={t("Password")}
placeholder={t("common.password")}
label={t("common.password")}
data-testid="register_password"
/>
</FieldRow>
@@ -237,7 +237,7 @@ export const RegisterPage: FC = () => {
disabled={registering}
data-testid="register_register"
>
{registering ? t("Registering…") : t("Register")}
{registering ? t("Registering…") : ("action.register")}
</Button>
</FieldRow>
<div id={recaptchaId} />

View File

@@ -217,9 +217,9 @@ export const SettingsButton: FC<{
const { t } = useTranslation();
return (
<Tooltip label={t("Settings")}>
<Tooltip label={t("common.settings")}>
<Button variant="toolbar" {...rest}>
<SettingsSolidIcon aria-label={t("Settings")} />
<SettingsSolidIcon aria-label={t("common.settings")} />
</Button>
</Tooltip>
);

View File

@@ -49,11 +49,13 @@ export const CopyButton: FC<Props> = ({
className={className}
onPress={setCopied}
iconStyle={isCopied ? "stroke" : "fill"}
aria-label={t("Copy")}
aria-label={t("action.copy")}
>
{isCopied ? (
<>
{variant !== "icon" && <span>{copiedMessage || t("Copied!")}</span>}
{variant !== "icon" && (
<span>{copiedMessage || t("common.copied")}</span>
)}
<CheckIcon />
</>
) : (

View File

@@ -25,7 +25,7 @@ export const InviteButton: FC<
const { t } = useTranslation();
return (
<Button kind="secondary" size="sm" Icon={UserAddIcon} {...props}>
{t("Invite")}
{t("action.invite")}
</Button>
);
};

View File

@@ -25,7 +25,7 @@ import { usePageTitle } from "../usePageTitle";
export const HomePage: FC = () => {
const { t } = useTranslation();
usePageTitle(t("Home"));
usePageTitle(t("common.home"));
const clientState = useClientState();

View File

@@ -40,7 +40,7 @@ export const JoinExistingCallModal: FC<Props> = ({
<Modal title={t("Join existing call?")} open={open} onDismiss={onDismiss}>
<p>{t("This call already exists, would you like to join?")}</p>
<FieldRow rightAlign className={styles.buttons}>
<Button onPress={onDismiss}>{t("No")}</Button>
<Button onPress={onDismiss}>{t("action.no")}</Button>
<Button onPress={onJoin} data-testid="home_joinExistingRoom">
{t("Yes, join call")}
</Button>

View File

@@ -147,7 +147,7 @@ export const RegisteredView: FC<Props> = ({ client }) => {
disabled={loading}
data-testid="home_go"
>
{loading ? t("Loading") : t("Go")}
{loading ? t("common.loading") : t("action.go")}
</Button>
</FieldRow>
{optInAnalytics === null && (

View File

@@ -177,8 +177,8 @@ export const UnauthenticatedView: FC = () => {
<InputField
id="displayName"
name="displayName"
label={t("Display name")}
placeholder={t("Display name")}
label={t("common.display_name")}
placeholder={t("common.display_name")}
type="text"
required
data-testid="home_displayName"
@@ -209,7 +209,7 @@ export const UnauthenticatedView: FC = () => {
disabled={loading}
data-testid="home_go"
>
{loading ? t("Loading") : t("Go")}
{loading ? t("common.loading") : t("action.go")}
</Button>
<div id={recaptchaId} />
</Form>

View File

@@ -115,7 +115,7 @@ export const AvatarInputField = forwardRef<HTMLInputElement, Props>(
variant="icon"
onPress={onPressRemoveAvatar}
>
{t("Remove")}
{t("action.remove")}
</Button>
)}
</div>

View File

@@ -140,7 +140,7 @@ export const CallEndedView: FC<Props> = ({
variant="default"
data-testid="home_go"
>
{submitting ? t("Submitting…") : t("Submit")}
{submitting ? t("Submitting…") : ("action.submit")}
</Button>
)}
</FieldRow>

View File

@@ -32,7 +32,7 @@ export const EncryptionLock: FC<Props> = ({ encrypted }) => {
return (
<Tooltip
label={encrypted ? t("Encrypted") : t("Not encrypted")}
label={encrypted ? t("common.encrypted") : t("common.unencrypted")}
side="right"
>
<Icon

View File

@@ -54,7 +54,7 @@ export function GroupCallLoader({
case "loading":
return (
<FullScreenView>
<h1>{t("Loading")}</h1>
<h1>{t("common.loading")}</h1>
</FullScreenView>
);
case "loaded":
@@ -72,7 +72,7 @@ export function GroupCallLoader({
{/* XXX: A 'create it for me' button would be the obvious UX here. Two screens already have
dupes of this flow, let's make a common component and put it here. */}
<Link href="/" onClick={onHomeClick}>
{t("Home")}
{t("common.home")}
</Link>
</FullScreenView>
);

View File

@@ -309,7 +309,7 @@ export const GroupCallView: FC<Props> = ({
)}
</Text>
<Link href="/" onClick={onHomeClick}>
{t("Home")}
{t("common.home")}
</Link>
</FullScreenView>
);

View File

@@ -68,7 +68,7 @@ export const InviteModal: FC<Props> = ({ room, open, onDismiss }) => {
onClick={onButtonClick}
data-testid="modal_inviteLink"
>
{t("Copy link")}
{t("action.copy_link")}
</Button>
</Modal>
<Toast

View File

@@ -76,8 +76,8 @@ export const RoomAuthView: FC = () => {
<InputField
id="displayName"
name="displayName"
label={t("Display name")}
placeholder={t("Display name")}
label={t("common.display_name")}
placeholder={t("common.display_name")}
data-testid="joincall_displayName"
type="text"
required
@@ -103,7 +103,7 @@ export const RoomAuthView: FC = () => {
disabled={loading}
data-testid="joincall_joincall"
>
{loading ? t("Loading") : t("Join call now")}
{loading ? t("common.loading") : t("Join call now")}
</Button>
<div id={recaptchaId} />
</Form>

View File

@@ -97,7 +97,7 @@ export const FeedbackSettingsTab: FC<Props> = ({ roomId }) => {
</FieldRow>
)}
<Button type="submit" disabled={sending}>
{sending ? t("Submitting…") : t("Submit")}
{sending ? t("Submitting…") : ("action.submit")}
</Button>
</FieldRow>
)}

View File

@@ -82,7 +82,7 @@ export const ProfileSettingsTab: FC<Props> = ({ client }) => {
<AvatarInputField
id="avatar"
name="avatar"
label={t("Avatar")}
label={t("common.avatar")}
avatarUrl={avatarUrl}
userId={userId}
displayName={displayName}
@@ -94,7 +94,7 @@ export const ProfileSettingsTab: FC<Props> = ({ client }) => {
<InputField
id="userId"
name="userId"
label={t("Username")}
label={t("common.username")}
type="text"
disabled
value={client.getUserId()!}
@@ -104,11 +104,11 @@ export const ProfileSettingsTab: FC<Props> = ({ client }) => {
<InputField
id="displayName"
name="displayName"
label={t("Display name")}
label={t("common.display_name")}
type="text"
required
autoComplete="off"
placeholder={t("Display name")}
placeholder={t("common.display_name")}
defaultValue={displayName}
data-testid="profile_displayname"
/>

View File

@@ -121,11 +121,11 @@ export const SettingsModal: FC<Props> = (props) => {
title={
<>
<AudioIcon width={16} height={16} />
<span className={styles.tabLabel}>{t("Audio")}</span>
<span className={styles.tabLabel}>{t("common.audio")}</span>
</>
}
>
{generateDeviceSelection(devices.audioInput, t("Microphone"))}
{generateDeviceSelection(devices.audioInput, t("common.microphone"))}
{!isFirefox() &&
generateDeviceSelection(devices.audioOutput, t("Speaker"))}
</TabItem>
@@ -137,11 +137,11 @@ export const SettingsModal: FC<Props> = (props) => {
title={
<>
<VideoIcon width={16} height={16} />
<span>{t("Video")}</span>
<span>{t("common.video")}</span>
</>
}
>
{generateDeviceSelection(devices.videoInput, t("Camera"))}
{generateDeviceSelection(devices.videoInput, t("common.camera"))}
</TabItem>
);
@@ -151,7 +151,7 @@ export const SettingsModal: FC<Props> = (props) => {
title={
<>
<UserIcon width={15} height={15} />
<span>{t("Profile")}</span>
<span>{t("common.profile")}</span>
</>
}
>
@@ -251,7 +251,7 @@ export const SettingsModal: FC<Props> = (props) => {
return (
<Modal
title={t("Settings")}
title={t("common.settings")}
className={styles.settingsModal}
open={props.open}
onDismiss={props.onDismiss}