fix: replace hard-coded strings with translation keys for internationalization (#20672)

* fix: replace hard-coded strings with translation keys for internationalization

Co-Authored-By: [email protected] <[email protected]>

* fix: replace loading text with translation key

Co-Authored-By: [email protected] <[email protected]>

* fix: add translation keys for platform plans view

Co-Authored-By: [email protected] <[email protected]>

* fix: add translation keys for oauth view

Co-Authored-By: [email protected] <[email protected]>

* fix: add translation keys for users table

Co-Authored-By: [email protected] <[email protected]>

* fix: add translation keys for oauth view toast messages

Co-Authored-By: [email protected] <[email protected]>

* fix: add translation keys for verify view

Co-Authored-By: [email protected] <[email protected]>

* fix: update sendVerificationLogin to use t function

Co-Authored-By: [email protected] <[email protected]>

* fix: remove duplicate translation keys in common.json

Co-Authored-By: [email protected] <[email protected]>

* fix: add missing verification_email_sent translation key

Co-Authored-By: [email protected] <[email protected]>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: [email protected] <[email protected]>
This commit is contained in:
devin-ai-integration[bot]and[email protected] authored and GitHub committed 2025-04-12 01:50:04 -04:00
1 parent 027cad2cfd
commit 4383d23d4c
13 files changed
+93 -57

No files matched your search

@@ -1,5 +1,6 @@
import { getPlaceholderAvatar } from "@calcom/lib/defaultAvatarImage";
import { getUserAvatarUrl } from "@calcom/lib/getAvatarUrl";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { SMSLockState } from "@calcom/prisma/client";
import { trpc } from "@calcom/trpc/react";
import { Avatar } from "@calcom/ui/components/avatar";
@@ -51,6 +52,7 @@ const LockStatusTable = ({
teams?: Team[];
setSMSLockState: (param: { userId?: number; teamId?: number; lock: boolean }) => void;
}) => {
const { t } = useLocale();
function getActions({ user, team }: { user?: User; team?: Team }) {
const smsLockState = user?.smsLockState ?? team?.smsLockState;
if (!smsLockState) return [];
@@ -89,10 +91,10 @@ const LockStatusTable = ({
<>
<Table>
<Header>
<ColumnTitle widthClassNames="w-auto">User/Team</ColumnTitle>
<ColumnTitle>Status</ColumnTitle>
<ColumnTitle widthClassNames="w-auto">{t("user_team")}</ColumnTitle>
<ColumnTitle>{t("status")}</ColumnTitle>
<ColumnTitle widthClassNames="w-auto">
<span className="sr-only">Edit</span>
<span className="sr-only">{t("edit")}</span>
</ColumnTitle>
</Header>
@@ -5,12 +5,12 @@ import { useForm } from "react-hook-form";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { trpc } from "@calcom/trpc";
import { ImageUploader } from "@calcom/ui/components/image-uploader";
import { Avatar } from "@calcom/ui/components/avatar";
import { Button } from "@calcom/ui/components/button";
import { Form } from "@calcom/ui/components/form";
import { TextField } from "@calcom/ui/components/form";
import { Icon } from "@calcom/ui/components/icon";
import { ImageUploader } from "@calcom/ui/components/image-uploader";
import { showToast } from "@calcom/ui/components/toast";
import { Tooltip } from "@calcom/ui/components/tooltip";
@@ -95,7 +95,7 @@ export default function OAuthView() {
) : (
<div>
<div className="text-emphasis mb-5 text-xl font-semibold">{oAuthForm.getValues("name")}</div>
<div className="mb-2 font-medium">Client Id</div>
<div className="mb-2 font-medium">{t("client_id")}</div>
<div className="flex">
<code className="bg-subtle text-default w-full truncate rounded-md rounded-r-none py-[6px] pl-2 pr-2 align-middle font-mono">
{" "}
@@ -105,7 +105,7 @@ export default function OAuthView() {
<Button
onClick={() => {
navigator.clipboard.writeText(clientId);
showToast("Client ID copied!", "success");
showToast(t("client_id_copied"), "success");
}}
type="button"
className="rounded-l-none text-base"
@@ -116,7 +116,7 @@ export default function OAuthView() {
</div>
{clientSecret ? (
<>
<div className="mb-2 mt-4 font-medium">Client Secret</div>
<div className="mb-2 mt-4 font-medium">{t("client_secret")}</div>
<div className="flex">
<code className="bg-subtle text-default w-full truncate rounded-md rounded-r-none py-[6px] pl-2 pr-2 align-middle font-mono">
{" "}
@@ -127,7 +127,7 @@ export default function OAuthView() {
onClick={() => {
navigator.clipboard.writeText(clientSecret);
setClientSecret("");
showToast("Client secret copied!", "success");
showToast(t("client_secret_copied"), "success");
}}
type="button"
className="rounded-l-none text-base"
@@ -38,7 +38,7 @@ export default function PlatformBillingUpgrade() {
useGetUserAttributes();
if (isUserLoading || (isUserBillingDataLoading && !userBillingData)) {
return <div className="m-5">Loading...</div>;
return <div className="m-5">{t("loading")}</div>;
}
if (isPlatformUser && !isPaidUser)
@@ -47,7 +47,7 @@ export default function PlatformBillingUpgrade() {
teamId={userOrgId}
heading={
<div className="mb-5 text-center text-2xl font-semibold">
<h1>Subscribe to Platform</h1>
<h1>{t("subscribe_to_platform")}</h1>
</div>
}
/>
@@ -28,7 +28,7 @@ export default function EditOAuthClient() {
const { data, isFetched, isFetching, isError, refetch } = useOAuthClient(clientId);
const { mutateAsync: update, isPending: isUpdating } = useUpdateOAuthClient({
onSuccess: () => {
showToast("OAuth client updated successfully", "success");
showToast(t("oauth_client_updated_successfully"), "success");
refetch();
router.push("/settings/platform/");
},
@@ -63,7 +63,7 @@ export default function EditOAuthClient() {
});
};
if (isUserLoading) return <div className="m-5">Loading...</div>;
if (isUserLoading) return <div className="m-5">{t("loading")}</div>;
if (isPlatformUser && isPaidUser) {
return (
@@ -80,7 +80,7 @@ export default function EditOAuthClient() {
</p>
</div>
</div>
{(!Boolean(clientId) || (isFetched && !data)) && <p>OAuth Client not found.</p>}
{(!Boolean(clientId) || (isFetched && !data)) && <p>{t("oauth_client_not_found")}</p>}
{isFetched && !!data && (
<EditOAuthClientForm
defaultValues={{
@@ -106,8 +106,8 @@ export default function EditOAuthClient() {
isPending={isUpdating}
/>
)}
{isFetching && <p>Loading...</p>}
{isError && <p>Something went wrong.</p>}
{isFetching && <p>{t("loading")}</p>}
{isError && <p>{t("something_went_wrong")}</p>}
</div>
</Shell>
</div>
@@ -37,7 +37,7 @@ export default function EditOAuthClientWebhooks() {
const { mutateAsync: createWebhook } = useCreateOAuthClientWebhook(clientId);
const { mutateAsync: updateWebhook } = useUpdateOAuthClientWebhook(clientId);
if (isUserLoading) return <div className="m-5">Loading...</div>;
if (isUserLoading) return <div className="m-5">{t("loading")}</div>;
if (isPlatformUser && isPaidUser) {
return (
@@ -55,7 +55,7 @@ export default function EditOAuthClientWebhooks() {
</div>
</div>
{webhooksStatus !== "success" && <p>Error while trying to access webhooks.</p>}
{webhooksStatus !== "success" && <p>{t("error_accessing_webhooks")}</p>}
{isWebhooksFetched && webhooksStatus === "success" && (
<WebhookForm
@@ -96,7 +96,7 @@ export default function EditOAuthClientWebhooks() {
await refetchWebhooks();
router.push("/settings/platform/");
} catch (err) {
showToast(`Failed to ${webhookId ? "update" : "create"} webhook.`, "error");
showToast(t(webhookId ? "webhook_update_failed" : "webhook_create_failed"), "error");
}
}}
onCancel={() => {
@@ -59,7 +59,7 @@ export default function CreateOAuthClient() {
});
};
if (isUserLoading) return <div className="m-5">Loading...</div>;
if (isUserLoading) return <div className="m-5">{t("loading")}</div>;
if (isPlatformUser && isPaidUser) {
return (
@@ -1,17 +1,19 @@
"use client";
import Shell from "@calcom/features/shell/Shell";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import NoPlatformPlan from "@components/settings/platform/dashboard/NoPlatformPlan";
import { useGetUserAttributes } from "@components/settings/platform/hooks/useGetUserAttributes";
import { PlatformPricing } from "@components/settings/platform/pricing/platform-pricing";
export default function PlatformPlans() {
const { t } = useLocale();
const { isUserLoading, isUserBillingDataLoading, isPlatformUser, isPaidUser, userBillingData, userOrgId } =
useGetUserAttributes();
if (isUserLoading || (isUserBillingDataLoading && !userBillingData)) {
return <div className="m-5">Loading...</div>;
return <div className="m-5">{t("loading")}</div>;
}
if (!isPlatformUser) return <NoPlatformPlan />;
@@ -23,8 +25,10 @@ export default function PlatformPlans() {
isPlatformUser={true}
heading={
<h1 className="mx-2 mt-4 text-center text-xl md:text-2xl">
You are currently subscribed to {userBillingData?.plan[0]}
{userBillingData?.plan.slice(1).toLocaleLowerCase()} plan
{t("currently_subscribed_to_plan", {
planFirstLetter: userBillingData?.plan[0],
planRest: userBillingData?.plan.slice(1).toLocaleLowerCase(),
})}
</h1>
}
withoutMain={false}
@@ -44,10 +44,10 @@ export default function Platform() {
setInitialClientName(data[0]?.name);
}, [data]);
if (isUserLoading || isOAuthClientLoading) return <div className="m-5">Loading...</div>;
if (isUserLoading || isOAuthClientLoading) return <div className="m-5">{t("loading")}</div>;
if (isUserBillingDataLoading && !userBillingData) {
return <div className="m-5">Loading...</div>;
return <div className="m-5">{t("loading")}</div>;
}
if (isPlatformUser && !isPaidUser)
@@ -56,7 +56,7 @@ export default function Platform() {
teamId={userOrgId}
heading={
<div className="mb-5 text-center text-2xl font-semibold">
<h1>Subscribe to Platform</h1>
<h1>{t("subscribe_to_platform")}</h1>
</div>
}
/>