Skip to content

armgit / ente

Public Imported from GitHub
0

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

chore(UploadProgressV2):hardcode-translation-strings

Aswin Asokedb4c5e7ebd6
diff --git a/web/packages/base/locales/en-US/translation.json b/web/packages/base/locales/en-US/translation.json
index ac5b939742..441e9c2c06 100644
--- a/web/packages/base/locales/en-US/translation.json
+++ b/web/packages/base/locales/en-US/translation.json
@@ -60,7 +60,6 @@
"nothing_here": "Nothing here yet",
"upload": "Upload",
"import": "Import",
- "upload_details": "Upload details",
"add_photos": "Add photos",
"add_more_photos": "Add more photos",
"add_photos_count_one": "Add 1 item",
@@ -407,7 +406,6 @@
"failed_uploads": "Failed uploads",
"failed_uploads_hint": "There will be an option to retry these when the upload finishes",
"retry_failed_uploads": "Retry failed uploads",
- "review_failed_items": "Review failed items",
"thumbnail_generation_failed": "Thumbnail generation failed",
"canvas_blocked_upload_failed_title": "Upload failed",
"canvas_blocked_upload_failed_description": "Browser settings are blocking thumbnail generation. Fix this before uploading again.",
@@ -425,34 +423,6 @@
"insufficient_storage_hint": "These files were not uploaded as they exceed the maximum size limit for your storage plan",
"uploads_in_progress": "Uploads in progress",
"successful_uploads": "Successful uploads",
- "uploading": "Uploading",
- "upload_complete": "Upload complete",
- "upload_completion_done_title": "Your upload is done!",
- "upload_completion_upload_subtitle": "Uploaded items are now available on Ente.",
- "view_photos": "View photos",
- "percent_uploaded": "{{percent, number}}% uploaded",
- "upload_items_progress": "{{finished, number}} of {{total, number}} items",
- "in_progress": "In progress",
- "completed": "Completed",
- "skipped": "Skipped",
- "failed": "Failed",
- "no_completed_uploads_yet": "No completed uploads yet",
- "no_skipped_files_yet": "No skipped files yet",
- "no_failed_uploads_yet": "No failed uploads yet",
- "upload_reason_already_uploaded": "Already on Ente",
- "upload_reason_insufficient_storage": "Not enough storage",
- "upload_reason_too_large": "File over 10 GB",
- "upload_reason_unsupported": "File type not supported",
- "upload_reason_zero_size": "Empty file",
- "upload_reason_blocked": "Upload blocked",
- "upload_reason_failed": "Upload failed",
- "upload_reason_hidden_file": "Hidden file",
- "upload_reason_unreadable_zip": "Unreadable zip",
- "upload_hint_static_thumbnail": "The file was uploaded, but we could not generate a thumbnail for it.",
- "upload_hint_blocked": "Your browser or an addon is preventing Ente from using eTags to upload large files.",
- "upload_resume_note": "Close whenever. We'll continue from where we left off, no duplicates.",
- "minimize": "Minimize",
- "expand": "Expand",
"upload_to_album": "Upload to album",
"add_to_album": "Add to album",
"added_to_album": "Added to album",
@@ -604,9 +574,7 @@
"select_all_videos": "Select all videos",
"deselect_all_photos": "Deselect all photos",
"deselect_all_videos": "Deselect all videos",
- "stop_uploads": "Stop uploads",
"stop_uploads_title": "Stop uploads?",
- "stop_uploads_v2_message": "You can upload later, we'll skip already uploaded items.",
"stop_uploads_message": "Are you sure that you want to stop all the uploads in progress?",
"yes_stop_uploads": "Yes, stop uploads",
"stop_downloads_title": "Stop downloads?",
diff --git a/web/packages/gallery/components/UploadCompletionV2.tsx b/web/packages/gallery/components/UploadCompletionV2.tsx
index c25378e02e..df28ffdee0 100644
--- a/web/packages/gallery/components/UploadCompletionV2.tsx
+++ b/web/packages/gallery/components/UploadCompletionV2.tsx
@@ -76,10 +76,10 @@ export function UploadCompletionV2({
component="h2"
sx={completionTitleSx}
>
- {t("upload_completion_done_title")}
+ Your upload is done!
</Typography>
<Typography sx={completionSubtitleSx}>
- {t("upload_completion_upload_subtitle")}
+ Uploaded items are now available on Ente.
</Typography>
</Stack>
</Stack>
@@ -97,7 +97,7 @@ export function UploadCompletionV2({
}}
/>
<Typography sx={completionStatLabelSx}>
- {t(kind)}
+ {completionStatLabels[kind]}
</Typography>
</Stack>
<Typography sx={completionStatValueSx}>
@@ -113,7 +113,7 @@ export function UploadCompletionV2({
onClick={onReviewFailed}
sx={primaryButtonSx}
>
- {t("review_failed_items")}
+ Review failed items
</Button>
) : null}
<Button
@@ -125,7 +125,7 @@ export function UploadCompletionV2({
: primaryButtonSx
}
>
- {t("view_photos")}
+ View photos
</Button>
</Stack>
</Stack>
@@ -133,6 +133,12 @@ export function UploadCompletionV2({
);
}
+const completionStatLabels = {
+ completed: "Completed",
+ skipped: "Skipped",
+ failed: "Failed",
+} as const;
+
const completionDialogPaperSx = (theme: Theme) => ({
width: "min(488px, calc(100svw - 32px))",
borderRadius: "20px",
diff --git a/web/packages/gallery/components/upload-progress-v2/MinimizedUploadProgress.tsx b/web/packages/gallery/components/upload-progress-v2/MinimizedUploadProgress.tsx
index 531f2d0782..46764781b6 100644
--- a/web/packages/gallery/components/upload-progress-v2/MinimizedUploadProgress.tsx
+++ b/web/packages/gallery/components/upload-progress-v2/MinimizedUploadProgress.tsx
@@ -66,9 +66,7 @@ export function MinimizedUploadProgress() {
? t("file_upload")
: context.uploadPhase == "done"
? uploadStatusText(context.uploadPhase)
- : t("percent_uploaded", {
- percent: progress,
- })}
+ : `${progress.toLocaleString()}% uploaded`}
</Typography>
<Typography sx={minimizedSubtitleSx}>
{context.uploadPhase == "cancelling"
@@ -77,7 +75,7 @@ export function MinimizedUploadProgress() {
</Typography>
</Stack>
<IconButton
- aria-label={t("expand")}
+ aria-label="Expand"
onClick={handleExpand}
sx={minimizedIconButtonSx}
>
diff --git a/web/packages/gallery/components/upload-progress-v2/StopUploadConfirmationDialog.tsx b/web/packages/gallery/components/upload-progress-v2/StopUploadConfirmationDialog.tsx
index ebd6360e25..5e4ea5cd5c 100644
--- a/web/packages/gallery/components/upload-progress-v2/StopUploadConfirmationDialog.tsx
+++ b/web/packages/gallery/components/upload-progress-v2/StopUploadConfirmationDialog.tsx
@@ -69,11 +69,13 @@ export function StopUploadConfirmationDialog({
id="stop-upload-confirmation-message"
sx={stopConfirmationSubtitleSx}
>
- {t("stop_uploads_v2_message")}
+ {
+ "You can upload later, we'll skip already uploaded items."
+ }
</Typography>
</Stack>
<Stack direction="row" sx={stopConfirmationCountsSx}>
- {doneStatConfigs.map(({ kind, color, labelKey }) => (
+ {doneStatConfigs.map(({ kind, color, label }) => (
<Stack key={kind} sx={stopConfirmationCountTileSx}>
<Stack
direction="row"
@@ -86,7 +88,7 @@ export function StopUploadConfirmationDialog({
}}
/>
<Typography sx={stopConfirmationCountLabelSx}>
- {t(labelKey)}
+ {label}
</Typography>
</Stack>
<Typography sx={stopConfirmationCountValueSx}>
@@ -100,7 +102,7 @@ export function StopUploadConfirmationDialog({
onClick={onConfirm}
sx={stopConfirmationButtonSx}
>
- {t("stop_uploads")}
+ Stop uploads
</Button>
</Stack>
</Dialog>
diff --git a/web/packages/gallery/components/upload-progress-v2/UploadProgressDetails.tsx b/web/packages/gallery/components/upload-progress-v2/UploadProgressDetails.tsx
index 79816f5524..e1c936852c 100644
--- a/web/packages/gallery/components/upload-progress-v2/UploadProgressDetails.tsx
+++ b/web/packages/gallery/components/upload-progress-v2/UploadProgressDetails.tsx
@@ -12,12 +12,12 @@ import {
import { useUploadProgressContext } from "./context";
import {
doneStatConfigs,
- finishedTypeReasonHintKeys,
- finishedTypeReasonKeys,
+ finishedTypeReasonHints,
+ finishedTypeReasons,
normalizePercent,
- preUploadSkippedFileReasonKeys,
+ preUploadSkippedFileReasons,
statConfigs,
- statEmptyMessageKeys,
+ statEmptyMessages,
} from "./helpers";
import {
EmptyUploadRows,
@@ -66,21 +66,22 @@ export function UploadProgressDetails({ closeOnly }: { closeOnly: boolean }) {
? []
: [
...statFinishedTypes[activeStat].flatMap((type) => {
- const reasonKey = finishedTypeReasonKeys[type];
- const hintKey = finishedTypeReasonHintKeys[type];
+ const reason =
+ type == "uploadedWithStaticThumbnail"
+ ? t("thumbnail_generation_failed")
+ : finishedTypeReasons[type];
+ const reasonHint = finishedTypeReasonHints[type];
return (finishedUploads.get(type) ?? []).map((id) => ({
name: uploadFileNames.get(id) ?? t("file"),
- reason: reasonKey && t(reasonKey),
- reasonHint: hintKey && t(hintKey),
+ reason,
+ reasonHint,
}));
}),
...(activeStat == "skipped"
? preUploadSkippedFiles.map((file) => ({
name: basename(file.name),
title: file.name,
- reason: t(
- preUploadSkippedFileReasonKeys[file.type],
- ),
+ reason: preUploadSkippedFileReasons[file.type],
}))
: []),
];
@@ -120,13 +121,13 @@ export function UploadProgressDetails({ closeOnly }: { closeOnly: boolean }) {
)}
<Box sx={detailsCardSx}>
<Box sx={statsGridSx(isDone)}>
- {visibleStatConfigs.map(({ kind, color, labelKey }) => (
+ {visibleStatConfigs.map(({ kind, color, label }) => (
<UploadStat
key={kind}
active={activeStat == kind}
color={color}
kind={kind}
- label={t(labelKey)}
+ label={label}
value={statCounts[kind]}
onSelect={handleSelectStat}
/>
@@ -179,7 +180,7 @@ export function UploadProgressDetails({ closeOnly }: { closeOnly: boolean }) {
/>
) : (
<EmptyUploadRows
- message={t(statEmptyMessageKeys[activeStat])}
+ message={statEmptyMessages[activeStat]}
/>
)}
</Box>
diff --git a/web/packages/gallery/components/upload-progress-v2/UploadProgressDialog.tsx b/web/packages/gallery/components/upload-progress-v2/UploadProgressDialog.tsx
index 0c7bbd6b50..aac243b85f 100644
--- a/web/packages/gallery/components/upload-progress-v2/UploadProgressDialog.tsx
+++ b/web/packages/gallery/components/upload-progress-v2/UploadProgressDialog.tsx
@@ -54,7 +54,7 @@ export function UploadProgressDialog({ closeOnly }: { closeOnly: boolean }) {
function UploadProgressV2Header() {
const { onClose, setExpanded, uploadPhase } = useUploadProgressContext();
const isDone = uploadPhase == "done";
- const title = isDone ? t("upload_details") : t("file_upload");
+ const title = isDone ? "Upload details" : t("file_upload");
const handleMinimize = () => setExpanded(false);
@@ -65,7 +65,7 @@ function UploadProgressV2Header() {
sx={{ alignItems: "center", gap: 1, minWidth: 0 }}
>
<IconButton
- aria-label={t("minimize")}
+ aria-label="Minimize"
onClick={handleMinimize}
sx={headerIconButtonSx}
>
@@ -100,7 +100,7 @@ function UploadProgressV2Summary() {
<Stack sx={{ gap: 2, minWidth: 0 }}>
<Stack sx={{ minWidth: 0, gap: "4px" }}>
<Typography component="p" sx={titleTextSx}>
- {t("percent_uploaded", { percent: progress })}
+ {progress.toLocaleString()}% uploaded
</Typography>
<Typography sx={mutedBodySx}>
{uploadCountsText(context)}
diff --git a/web/packages/gallery/components/upload-progress-v2/helpers.ts b/web/packages/gallery/components/upload-progress-v2/helpers.ts
index e1dc00ce5d..56d3204cb8 100644
--- a/web/packages/gallery/components/upload-progress-v2/helpers.ts
+++ b/web/packages/gallery/components/upload-progress-v2/helpers.ts
@@ -12,66 +12,73 @@ import {
} from "../uploadProgressStats";
import type { UploadProgressContextT } from "./context";
-export const finishedTypeReasonKeys: Partial<
- Record<FinishedUploadType, string>
-> = {
- uploadedWithStaticThumbnail: "thumbnail_generation_failed",
- alreadyUploaded: "upload_reason_already_uploaded",
- largerThanAvailableStorage: "upload_reason_insufficient_storage",
- tooLarge: "upload_reason_too_large",
- unsupported: "upload_reason_unsupported",
- zeroSize: "upload_reason_zero_size",
- blocked: "upload_reason_blocked",
- failed: "upload_reason_failed",
-};
+export const finishedTypeReasons: Partial<Record<FinishedUploadType, string>> =
+ {
+ alreadyUploaded: "Already on Ente",
+ largerThanAvailableStorage: "Not enough storage",
+ tooLarge: "File over 10 GB",
+ unsupported: "File type not supported",
+ zeroSize: "Empty file",
+ blocked: "Upload blocked",
+ failed: "Upload failed",
+ };
-export const finishedTypeReasonHintKeys: Partial<
+export const finishedTypeReasonHints: Partial<
Record<FinishedUploadType, string>
> = {
- uploadedWithStaticThumbnail: "upload_hint_static_thumbnail",
- blocked: "upload_hint_blocked",
+ uploadedWithStaticThumbnail:
+ "The file was uploaded, but we could not generate a thumbnail for it.",
+ blocked:
+ "Your browser or an addon is preventing Ente from using eTags to upload large files.",
};
-export const preUploadSkippedFileReasonKeys: Record<
+export const preUploadSkippedFileReasons: Record<
PreUploadSkippedFile["type"],
string
-> = {
- hiddenFile: "upload_reason_hidden_file",
- failedZip: "upload_reason_unreadable_zip",
+> = { hiddenFile: "Hidden file", failedZip: "Unreadable zip" };
+
+const finishedStatLabels: Record<FinishedStatKind, string> = {
+ completed: "Completed",
+ skipped: "Skipped",
+ failed: "Failed",
};
export const statConfigs = [
- { kind: "inProgress", color: "#d9d9d9", labelKey: "in_progress" },
+ { kind: "inProgress", color: "#d9d9d9", label: "In progress" },
...finishedStatKinds.map((kind) => ({
kind,
color: uploadStatColors[kind],
- labelKey: kind,
+ label: finishedStatLabels[kind],
})),
-] satisfies { kind: UploadStatKind; color: string; labelKey: string }[];
+] satisfies { kind: UploadStatKind; color: string; label: string }[];
export const doneStatConfigs = statConfigs.slice(1) as {
kind: FinishedStatKind;
color: string;
- labelKey: FinishedStatKind;
+ label: string;
}[];
-export const statEmptyMessageKeys: Record<FinishedStatKind, string> = {
- completed: "no_completed_uploads_yet",
- skipped: "no_skipped_files_yet",
- failed: "no_failed_uploads_yet",
+export const statEmptyMessages: Record<FinishedStatKind, string> = {
+ completed: "No completed uploads yet",
+ skipped: "No skipped files yet",
+ failed: "No failed uploads yet",
};
-const uploadStatusTextKeys: Record<UploadPhase, string> = {
- preparing: "preparing",
- readingMetadata: "upload_reading_metadata_files",
- uploading: "uploading",
- cancelling: "upload_cancelling",
- done: "upload_complete",
+export const uploadStatusText = (uploadPhase: UploadPhase) => {
+ switch (uploadPhase) {
+ case "preparing":
+ return t("preparing");
+ case "readingMetadata":
+ return t("upload_reading_metadata_files");
+ case "uploading":
+ return "Uploading";
+ case "cancelling":
+ return t("upload_cancelling");
+ case "done":
+ return "Upload complete";
+ }
};
-export const uploadStatusText = (uploadPhase: UploadPhase) =>
- t(uploadStatusTextKeys[uploadPhase]);
-
export const uploadCountsText = ({
uploadPhase,
uploadCounter,
@@ -99,10 +106,7 @@ export const uploadCountsText = ({
: t("upload_done", { count });
}
return uploadCounter.total
- ? t("upload_items_progress", {
- finished: uploadCounter.finished,
- total: uploadCounter.total,
- })
+ ? `${uploadCounter.finished.toLocaleString()} of ${uploadCounter.total.toLocaleString()} items`
: uploadStatusText(uploadPhase);
};