Skip to content

Commit bd5d94a

Browse files
fix: localize remaining hardcoded strings in PayPal setup (calcom#27908)
* chore: add en locale key-value for paypal setup * fix: add translation function for paypal setup * chore: avoid merge conflicts
1 parent 3cfe295 commit bd5d94a

2 files changed

Lines changed: 65 additions & 42 deletions

File tree

apps/web/components/apps/paypal/Setup.tsx

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,17 @@ export default function PayPalSetup() {
1515
const [newSecretKey, setNewSecretKey] = useState("");
1616
const router = useRouter();
1717
const { t } = useLocale();
18-
const integrations = trpc.viewer.apps.integrations.useQuery({ variant: "payment", appId: "paypal" });
18+
19+
const integrations = trpc.viewer.apps.integrations.useQuery({
20+
variant: "payment",
21+
appId: "paypal",
22+
});
23+
1924
const [paypalPaymentAppCredentials] = integrations.data?.items || [];
2025
const [credentialId] = paypalPaymentAppCredentials?.userCredentialIds || [-1];
26+
2127
const showContent = !!integrations.data && integrations.isSuccess && !!credentialId;
28+
2229
const saveKeysMutation = trpc.viewer.apps.updateAppCredentials.useMutation({
2330
onSuccess: () => {
2431
showToast(t("keys_have_been_saved"), "success");
@@ -39,12 +46,13 @@ export default function PayPalSetup() {
3946
<div className="bg-default border-subtle m-auto max-w-[43em] overflow-auto rounded border pb-10 md:p-10">
4047
<div className="ml-2 ltr:mr-2 rtl:ml-2 md:ml-5">
4148
<div className="invisible md:visible">
42-
<img className="h-11" src="/api/app-store/paypal/icon.svg" alt="Paypal Payment Logo" />
43-
<p className="text-default mt-5 text-lg">Paypal</p>
49+
<img className="h-11" src="/api/app-store/paypal/icon.svg" alt={t("paypal_payment_logo")} />
50+
<p className="text-default mt-5 text-lg">{t("paypal")}</p>
4451
</div>
52+
4553
<form autoComplete="off" className="mt-5">
4654
<TextField
47-
label="Client Id"
55+
label={t("client_id")}
4856
type="text"
4957
name="client_id"
5058
id="client_id"
@@ -55,7 +63,7 @@ export default function PayPalSetup() {
5563
/>
5664

5765
<TextField
58-
label="Secret Key"
66+
label={t("secret_key")}
5967
type="password"
6068
name="access_token"
6169
id="access_token"
@@ -65,7 +73,6 @@ export default function PayPalSetup() {
6573
onChange={(e) => setNewSecretKey(e.target.value)}
6674
/>
6775

68-
{/* Button to submit */}
6976
<div className="mt-5 flex flex-row justify-end">
7077
<Button
7178
color="primary"
@@ -82,43 +89,39 @@ export default function PayPalSetup() {
8289
</Button>
8390
</div>
8491
</form>
92+
8593
<div>
86-
<p className="text-lgf text-default mt-5 font-bold">Getting started with Paypal APP</p>
87-
<p className="text-default font-semi mt-2">
88-
Here in Cal.com we offer Paypal as one of our payment gateway. You can use your own Paypal
89-
Business account to receive payments from your customers enabling and setting up price and
90-
currency for each of your event types.
91-
</p>
94+
<p className="text-lgf text-default mt-5 font-bold">{t("paypal_getting_started")}</p>
95+
96+
<p className="text-default font-semi mt-2">{t("paypal_description")}</p>
9297

9398
<p className="text-lgf text-default mt-5 inline-flex font-bold">
94-
<CircleAlertIcon className="mr-2 mt-1 h-4 w-4" /> Important requirements:
99+
<CircleAlertIcon className="mr-2 mt-1 h-4 w-4" />
100+
{t("important_requirements")}
95101
</p>
102+
96103
<ul className="text-default ml-1 mt-2 list-disc pl-2">
97-
<li>Paypal Business account</li>
98-
<li>Paypal Developer account</li>
104+
<li>{t("paypal_business_account")}</li>
105+
<li>{t("paypal_developer_account")}</li>
99106
</ul>
100107

101-
<p className="text-default mb-2 mt-5 font-bold">Resources:</p>
108+
<p className="text-default mb-2 mt-5 font-bold">{t("resources")}</p>
109+
102110
<a
103111
className="text-orange-600 underline"
104112
target="_blank"
105113
href="https://developer.paypal.com/api/rest/#link-getclientidandclientsecret"
106114
rel="noreferrer">
107-
Link to Paypal developer API REST Setup Guide:
108-
https://developer.paypal.com/api/rest/#link-getclientidandclientsecret
115+
{t("paypal_rest_setup_guide")}
109116
</a>
110117

111-
<p className="text-lgf text-default mt-5 font-bold">Setup instructions</p>
112-
<p className="text-default font-semi mt-2">
113-
Remember to only proceed with the following steps if your account has already been upgraded to
114-
a business account. Also keep in mind that some of the following steps might be different
115-
since Paypal offers different experiences based on your country.
116-
</p>
118+
<p className="text-lgf text-default mt-5 font-bold">{t("paypal_setup_instructions")}</p>
119+
120+
<p className="text-default font-semi mt-2">{t("paypal_setup_note")}</p>
117121

118122
<ol className="text-default ml-1 mt-5 list-decimal pl-2">
119-
{/* @TODO: translate */}
120123
<li>
121-
Log into your Paypal Developer account and create a new app{" "}
124+
{t("paypal_step_1")}{" "}
122125
<a
123126
target="_blank"
124127
href="https://developer.paypal.com/dashboard/applications/live"
@@ -128,39 +131,38 @@ export default function PayPalSetup() {
128131
</a>
129132
.
130133
</li>
131-
<li>Choose a name for your application.</li>
132-
<li>Click on the Create App button</li>
134+
135+
<li>{t("paypal_step_2")}</li>
136+
<li>{t("paypal_step_3")}</li>
133137

134138
<li>
135-
Go back to{" "}
139+
{t("paypal_step_4_part_1")}{" "}
136140
<a
137141
className="text-orange-600 underline"
138142
href="https://developer.paypal.com/dashboard/applications/live">
139-
dashboard
143+
{t("dashboard")}
140144
</a>
141-
, click on new app created.
145+
, {t("paypal_step_4_part_2")}
142146
</li>
143-
<li>Copy the Client ID and Secret Key using copy buttons one by one.</li>
144-
<li>Paste them on the required field and save them.</li>
145-
<li>You should be all setup after this.</li>
147+
148+
<li>{t("paypal_step_5")}</li>
149+
<li>{t("paypal_step_6")}</li>
150+
<li>{t("paypal_step_7")}</li>
146151
</ol>
152+
147153
<p className="text-default mt-5 inline-flex font-bold">
148154
<CircleAlertIcon className="mr-2 mt-1 h-4 w-4" />
149-
Reminder:
150-
</p>
151-
<p className="text-default mt-2">
152-
Our integration creates a specific webhook on your Paypal account that we use to report back
153-
transactions to our system. If you delete this webhook, we will not be able to report back and
154-
you should Uninstall and Install the app again for this to work again. Uninstalling the app
155-
won&apos;t delete your current event type price/currency configuration but you would not be
156-
able to receive bookings.
155+
{t("reminder")}:
157156
</p>
157+
158+
<p className="text-default mt-2">{t("paypal_webhook_reminder")}</p>
158159
</div>
159160
</div>
160161
</div>
161162
) : (
162163
<AppNotInstalledMessage appName="paypal" />
163164
)}
165+
164166
<Toaster position="bottom-right" />
165167
</div>
166168
);

apps/web/public/static/locales/en/common.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4632,5 +4632,26 @@
46324632
"last_6_months": "Last 6 months",
46334633
"last_12_months": "Last 12 months",
46344634
"calendar_events_disabled_video_limitation": "When calendar events are disabled, meeting links cannot be generated for apps whose link generation is tied to calendar event creation, for example, Google Meet and Microsoft Teams. Other video apps like Cal Video will continue to work.",
4635+
"paypal": "PayPal",
4636+
"paypal_getting_started": "Getting started with Paypal APP",
4637+
"important_requirements": "Important requirements:",
4638+
"paypal_description": "Here in Cal.com we offer Paypal as one of our payment gateway. You can use your own Paypal Business account to receive payments from your customers enabling and setting up price and currency for each of your event types.",
4639+
"paypal_payment_logo": "PayPal payment logo",
4640+
"secret_key": "Secret key",
4641+
"paypal_business_account": "PayPal Business account",
4642+
"paypal_developer_account": "PayPal Developer account",
4643+
"paypal_rest_setup_guide": "Link to PayPal Developer REST API setup guide",
4644+
"paypal_setup_instructions": "Setup instructions",
4645+
"paypal_setup_note": "Remember to only proceed with the following steps if your account has already been upgraded to a business account. Also keep in mind that some of the following steps might be different since PayPal offers different experiences based on your country.",
4646+
"paypal_step_1": "Log into your PayPal Developer account and create a new app",
4647+
"paypal_step_2": "Choose a name for your application.",
4648+
"paypal_step_3": "Click on the Create App button.",
4649+
"paypal_step_4_part_1": "Go back to the",
4650+
"paypal_step_4_part_2": "and click on the newly created app.",
4651+
"paypal_step_5": "Copy the Client ID and Secret key using the copy buttons one by one.",
4652+
"paypal_step_6": "Paste them in the required fields and save them.",
4653+
"paypal_step_7": "You should be all set up after this.",
4654+
"dashboard": "dashboard",
4655+
"paypal_webhook_reminder": "Our integration creates a specific webhook on your PayPal account that we use to report back transactions to our system. If you delete this webhook, we will not be able to report back and you should uninstall and install the app again for this to work properly. Uninstalling the app won't delete your current event type price/currency configuration but you will not be able to receive bookings.",
46354656
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Add your new strings above here ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
46364657
}

0 commit comments

Comments
 (0)