Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Remove l11n unsafe direct string manipulation

Manav Rathi7c0ab6dd8acd
diff --git a/web/apps/photos/src/components/pages/gallery/PlanSelector/card/index.tsx b/web/apps/photos/src/components/pages/gallery/PlanSelector/card/index.tsx
index 7bafa04037..41e577675d 100644
--- a/web/apps/photos/src/components/pages/gallery/PlanSelector/card/index.tsx
+++ b/web/apps/photos/src/components/pages/gallery/PlanSelector/card/index.tsx
@@ -24,7 +24,6 @@ import {
planForSubscription,
updateSubscription,
} from "utils/billing";
-import { reverseString } from "utils/common";
import { getLocalUserDetails } from "utils/user";
import { getTotalFamilyUsage, isPartOfFamily } from "utils/user/family";
import FreeSubscriptionPlanSelectorCard from "./free";
@@ -130,9 +129,7 @@ function PlanSelectorCard(props: Props) {
}
} else if (hasStripeSubscription(subscription)) {
appContext.setDialogMessage({
- title: `${t("CONFIRM")} ${reverseString(
- t("UPDATE_SUBSCRIPTION"),
- )}`,
+ title: t("update_subscription_title"),
content: t("UPDATE_SUBSCRIPTION_MESSAGE"),
proceed: {
text: t("UPDATE_SUBSCRIPTION"),
diff --git a/web/apps/photos/src/utils/common/index.ts b/web/apps/photos/src/utils/common/index.ts
index df4676a905..4fa21a3528 100644
--- a/web/apps/photos/src/utils/common/index.ts
+++ b/web/apps/photos/src/utils/common/index.ts
@@ -13,12 +13,6 @@ export function downloadApp() {
openLink(APP_DOWNLOAD_URL, true);
}
-export function reverseString(title: string) {
- return title
- ?.split(" ")
- .reduce((reversedString, currWord) => `${currWord} ${reversedString}`);
-}
-
export function initiateEmail(email: string) {
const a = document.createElement("a");
a.href = "mailto:" + email;
@@ -33,6 +27,7 @@ export const preloadImage = (imgBasePath: string) => {
}
new Image().srcset = srcSet.join(",");
};
+
export function openLink(href: string, newTab?: boolean) {
const a = document.createElement("a");
a.href = href;
diff --git a/web/packages/next/locales/en-US/translation.json b/web/packages/next/locales/en-US/translation.json
index 29469cd0f9..72960fa72f 100644
--- a/web/packages/next/locales/en-US/translation.json
+++ b/web/packages/next/locales/en-US/translation.json
@@ -168,6 +168,7 @@
"UPDATE_PAYMENT_METHOD": "Update payment method",
"MONTHLY": "Monthly",
"YEARLY": "Yearly",
+ "update_subscription_title": "Confirm plan change",
"UPDATE_SUBSCRIPTION_MESSAGE": "Are you sure you want to change your plan?",
"UPDATE_SUBSCRIPTION": "Change plan",
"CANCEL_SUBSCRIPTION": "Cancel subscription",