mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-09-22 19:46:39 +00:00
Add missing translations, improve strings, and fix tooltips
This commit is contained in:
parent
fa0d2b32d9
commit
448c0db0c5
@ -1912,7 +1912,36 @@
|
|||||||
"tags": "trim,shrink,edit,shape",
|
"tags": "trim,shrink,edit,shape",
|
||||||
"title": "Crop",
|
"title": "Crop",
|
||||||
"header": "Crop PDF",
|
"header": "Crop PDF",
|
||||||
"submit": "Submit"
|
"submit": "Apply Crop",
|
||||||
|
"noFileSelected": "Select a PDF file to begin cropping",
|
||||||
|
"preview": {
|
||||||
|
"title": "Crop Area Selection"
|
||||||
|
},
|
||||||
|
"reset": "Reset to full PDF",
|
||||||
|
"coordinates": {
|
||||||
|
"title": "Position and Size",
|
||||||
|
"x": "X Position",
|
||||||
|
"y": "Y Position",
|
||||||
|
"width": "Width",
|
||||||
|
"height": "Height"
|
||||||
|
},
|
||||||
|
"error": {
|
||||||
|
"invalidArea": "Crop area extends beyond PDF boundaries",
|
||||||
|
"failed": "Failed to crop PDF"
|
||||||
|
},
|
||||||
|
"steps": {
|
||||||
|
"selectArea": "Select Crop Area"
|
||||||
|
},
|
||||||
|
"tooltip": {
|
||||||
|
"title": "How to Crop PDFs",
|
||||||
|
"description": "Select the area to crop from your PDF by dragging and resizing the blue overlay on the thumbnail.",
|
||||||
|
"drag": "Drag the overlay to move the crop area",
|
||||||
|
"resize": "Drag the corner and edge handles to resize",
|
||||||
|
"precision": "Use coordinate inputs for precise positioning"
|
||||||
|
},
|
||||||
|
"results": {
|
||||||
|
"title": "Crop Results"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"autoSplitPDF": {
|
"autoSplitPDF": {
|
||||||
"tags": "QR-based,separate,scan-segment,organize",
|
"tags": "QR-based,separate,scan-segment,organize",
|
||||||
|
@ -195,12 +195,12 @@ const CropSettings = ({ parameters, disabled = false }: CropSettingsProps) => {
|
|||||||
{/* Manual Coordinate Input */}
|
{/* Manual Coordinate Input */}
|
||||||
<Stack gap="xs">
|
<Stack gap="xs">
|
||||||
<Text size="sm" fw={500}>
|
<Text size="sm" fw={500}>
|
||||||
{t("crop.coordinates.title", "Precise Coordinates (PDF Points)")}
|
{t("crop.coordinates.title", "Position and Size")}
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
<Group grow>
|
<Group grow>
|
||||||
<NumberInput
|
<NumberInput
|
||||||
label={t("crop.coordinates.x", "X (Left)")}
|
label={t("crop.coordinates.x", "X Position")}
|
||||||
value={Math.round(cropArea.x * 10) / 10}
|
value={Math.round(cropArea.x * 10) / 10}
|
||||||
onChange={(value) => handleCoordinateChange('x', value)}
|
onChange={(value) => handleCoordinateChange('x', value)}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
@ -211,7 +211,7 @@ const CropSettings = ({ parameters, disabled = false }: CropSettingsProps) => {
|
|||||||
size="xs"
|
size="xs"
|
||||||
/>
|
/>
|
||||||
<NumberInput
|
<NumberInput
|
||||||
label={t("crop.coordinates.y", "Y (Bottom)")}
|
label={t("crop.coordinates.y", "Y Position")}
|
||||||
value={Math.round(cropArea.y * 10) / 10}
|
value={Math.round(cropArea.y * 10) / 10}
|
||||||
onChange={(value) => handleCoordinateChange('y', value)}
|
onChange={(value) => handleCoordinateChange('y', value)}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
|
21
frontend/src/components/tooltips/useCropTooltips.ts
Normal file
21
frontend/src/components/tooltips/useCropTooltips.ts
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
|
export function useCropTooltips() {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
return {
|
||||||
|
header: {
|
||||||
|
title: t("crop.tooltip.title", "How to Crop PDFs")
|
||||||
|
},
|
||||||
|
tips: [
|
||||||
|
{
|
||||||
|
description: t("crop.tooltip.description", "Select the area to crop from your PDF by dragging and resizing the blue overlay on the thumbnail."),
|
||||||
|
bullets: [
|
||||||
|
t("crop.tooltip.drag", "Drag the overlay to move the crop area"),
|
||||||
|
t("crop.tooltip.resize", "Drag the corner and edge handles to resize"),
|
||||||
|
t("crop.tooltip.precision", "Use coordinate inputs for precise positioning"),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
}
|
@ -4,6 +4,7 @@ import CropSettings from "../components/tools/crop/CropSettings";
|
|||||||
import { useCropParameters } from "../hooks/tools/crop/useCropParameters";
|
import { useCropParameters } from "../hooks/tools/crop/useCropParameters";
|
||||||
import { useCropOperation } from "../hooks/tools/crop/useCropOperation";
|
import { useCropOperation } from "../hooks/tools/crop/useCropOperation";
|
||||||
import { useBaseTool } from "../hooks/tools/shared/useBaseTool";
|
import { useBaseTool } from "../hooks/tools/shared/useBaseTool";
|
||||||
|
import { useCropTooltips } from "../components/tooltips/useCropTooltips";
|
||||||
import { BaseToolProps, ToolComponent } from "../types/tool";
|
import { BaseToolProps, ToolComponent } from "../types/tool";
|
||||||
|
|
||||||
const Crop = (props: BaseToolProps) => {
|
const Crop = (props: BaseToolProps) => {
|
||||||
@ -16,6 +17,8 @@ const Crop = (props: BaseToolProps) => {
|
|||||||
props
|
props
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const tooltips = useCropTooltips();
|
||||||
|
|
||||||
return createToolFlow({
|
return createToolFlow({
|
||||||
files: {
|
files: {
|
||||||
selectedFiles: base.selectedFiles,
|
selectedFiles: base.selectedFiles,
|
||||||
@ -27,22 +30,7 @@ const Crop = (props: BaseToolProps) => {
|
|||||||
title: t("crop.steps.selectArea", "Select Crop Area"),
|
title: t("crop.steps.selectArea", "Select Crop Area"),
|
||||||
isCollapsed: !base.hasFiles, // Collapsed until files selected
|
isCollapsed: !base.hasFiles, // Collapsed until files selected
|
||||||
onCollapsedClick: base.hasResults ? base.handleSettingsReset : undefined,
|
onCollapsedClick: base.hasResults ? base.handleSettingsReset : undefined,
|
||||||
tooltip: {
|
tooltip: tooltips,
|
||||||
content: (
|
|
||||||
<div>
|
|
||||||
<p>{t("crop.tooltip.description", "Select the area to crop from your PDF by dragging and resizing the red overlay on the thumbnail.")}</p>
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
tips: [
|
|
||||||
t("crop.tooltip.drag", "Drag the overlay to move the crop area"),
|
|
||||||
t("crop.tooltip.resize", "Drag the corner and edge handles to resize"),
|
|
||||||
t("crop.tooltip.precision", "Use coordinate inputs for precise positioning"),
|
|
||||||
t("crop.tooltip.constraints", "Crop area is automatically constrained to PDF bounds")
|
|
||||||
],
|
|
||||||
header: {
|
|
||||||
title: t("crop.tooltip.title", "How to Crop PDFs"),
|
|
||||||
}
|
|
||||||
},
|
|
||||||
content: (
|
content: (
|
||||||
<CropSettings
|
<CropSettings
|
||||||
parameters={base.params}
|
parameters={base.params}
|
||||||
@ -52,7 +40,7 @@ const Crop = (props: BaseToolProps) => {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
executeButton: {
|
executeButton: {
|
||||||
text: t("crop.submit", "Crop PDF"),
|
text: t("crop.submit", "Apply Crop"),
|
||||||
loadingText: t("loading"),
|
loadingText: t("loading"),
|
||||||
onClick: base.handleExecute,
|
onClick: base.handleExecute,
|
||||||
isVisible: !base.hasResults,
|
isVisible: !base.hasResults,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user