mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-12-29 16:16:02 +00:00
fix: i18n tsc
This commit is contained in:
@@ -19,7 +19,7 @@ export default function ChangeSpeed({
|
||||
title,
|
||||
longDescription
|
||||
}: ToolComponentProps) {
|
||||
const { t } = useTranslation();
|
||||
const { t } = useTranslation('video');
|
||||
const [input, setInput] = useState<File | null>(null);
|
||||
const [result, setResult] = useState<File | null>(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -130,13 +130,13 @@ export default function ChangeSpeed({
|
||||
updateField
|
||||
}) => [
|
||||
{
|
||||
title: t('video:changeSpeed.newVideoSpeed'),
|
||||
title: t('changeSpeed.newVideoSpeed'),
|
||||
component: (
|
||||
<Box>
|
||||
<TextFieldWithDesc
|
||||
value={values.newSpeed.toString()}
|
||||
onOwnChange={(val) => updateField('newSpeed', Number(val))}
|
||||
description={t('video:changeSpeed.defaultMultiplier')}
|
||||
description={t('changeSpeed.defaultMultiplier')}
|
||||
type="number"
|
||||
/>
|
||||
</Box>
|
||||
@@ -151,19 +151,19 @@ export default function ChangeSpeed({
|
||||
<ToolVideoInput
|
||||
value={input}
|
||||
onChange={setInput}
|
||||
title={t('video:changeSpeed.inputTitle')}
|
||||
title={t('changeSpeed.inputTitle')}
|
||||
/>
|
||||
}
|
||||
resultComponent={
|
||||
loading ? (
|
||||
<ToolFileResult
|
||||
title={t('video:changeSpeed.settingSpeed')}
|
||||
title={t('changeSpeed.settingSpeed')}
|
||||
value={null}
|
||||
loading={true}
|
||||
/>
|
||||
) : (
|
||||
<ToolFileResult
|
||||
title={t('video:changeSpeed.resultTitle')}
|
||||
title={t('changeSpeed.resultTitle')}
|
||||
value={result}
|
||||
extension="mp4"
|
||||
/>
|
||||
@@ -174,7 +174,7 @@ export default function ChangeSpeed({
|
||||
setInput={setInput}
|
||||
compute={compute}
|
||||
toolInfo={{
|
||||
title: t('video:changeSpeed.toolInfo.title', { title }),
|
||||
title: t('changeSpeed.toolInfo.title', { title }),
|
||||
description: longDescription
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -69,7 +69,7 @@ const presetOptions = [
|
||||
];
|
||||
|
||||
export default function CompressVideo({ title }: ToolComponentProps) {
|
||||
const { t } = useTranslation();
|
||||
const { t } = useTranslation('video');
|
||||
const [input, setInput] = useState<File | null>(null);
|
||||
const [result, setResult] = useState<File | null>(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -102,7 +102,7 @@ export default function CompressVideo({ title }: ToolComponentProps) {
|
||||
updateField
|
||||
}) => [
|
||||
{
|
||||
title: t('video:compress.resolution'),
|
||||
title: t('compress.resolution'),
|
||||
component: (
|
||||
<Box>
|
||||
{resolutionOptions.map((option) => (
|
||||
@@ -119,7 +119,7 @@ export default function CompressVideo({ title }: ToolComponentProps) {
|
||||
)
|
||||
},
|
||||
{
|
||||
title: t('video:compress.quality'),
|
||||
title: t('compress.quality'),
|
||||
component: (
|
||||
<Box sx={{ mb: 2 }}>
|
||||
<Slider
|
||||
@@ -131,9 +131,9 @@ export default function CompressVideo({ title }: ToolComponentProps) {
|
||||
updateField('crf', typeof value === 'number' ? value : value[0]);
|
||||
}}
|
||||
marks={{
|
||||
0: t('video:compress.lossless'),
|
||||
23: t('video:compress.default'),
|
||||
51: t('video:compress.worst')
|
||||
0: t('compress.lossless'),
|
||||
23: t('compress.default'),
|
||||
51: t('compress.worst')
|
||||
}}
|
||||
/>
|
||||
</Box>
|
||||
@@ -162,16 +162,16 @@ export default function CompressVideo({ title }: ToolComponentProps) {
|
||||
<ToolVideoInput
|
||||
value={input}
|
||||
onChange={setInput}
|
||||
title={t('video:compress.inputTitle')}
|
||||
title={t('compress.inputTitle')}
|
||||
/>
|
||||
}
|
||||
resultComponent={
|
||||
<ToolFileResult
|
||||
title={t('video:compress.resultTitle')}
|
||||
title={t('compress.resultTitle')}
|
||||
value={result}
|
||||
extension={'mp4'}
|
||||
loading={loading}
|
||||
loadingText={t('video:compress.loadingText')}
|
||||
loadingText={t('compress.loadingText')}
|
||||
/>
|
||||
}
|
||||
initialValues={initialValues}
|
||||
|
||||
@@ -18,7 +18,7 @@ const initialValues: InitialValuesType = {
|
||||
};
|
||||
|
||||
export default function CropVideo({ title }: ToolComponentProps) {
|
||||
const { t } = useTranslation();
|
||||
const { t } = useTranslation('video');
|
||||
const [input, setInput] = useState<File | null>(null);
|
||||
const [result, setResult] = useState<File | null>(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -32,21 +32,21 @@ export default function CropVideo({ title }: ToolComponentProps) {
|
||||
if (!videoDimensions) return '';
|
||||
|
||||
if (values.x < 0 || values.y < 0) {
|
||||
return t('video:cropVideo.errorNonNegativeCoordinates');
|
||||
return t('cropVideo.errorNonNegativeCoordinates');
|
||||
}
|
||||
|
||||
if (values.width <= 0 || values.height <= 0) {
|
||||
return t('video:cropVideo.errorPositiveDimensions');
|
||||
return t('cropVideo.errorPositiveDimensions');
|
||||
}
|
||||
|
||||
if (values.x + values.width > videoDimensions.width) {
|
||||
return t('video:cropVideo.errorBeyondWidth', {
|
||||
return t('cropVideo.errorBeyondWidth', {
|
||||
width: videoDimensions.width
|
||||
});
|
||||
}
|
||||
|
||||
if (values.y + values.height > videoDimensions.height) {
|
||||
return t('video:cropVideo.errorBeyondHeight', {
|
||||
return t('cropVideo.errorBeyondHeight', {
|
||||
height: videoDimensions.height
|
||||
});
|
||||
}
|
||||
@@ -74,7 +74,7 @@ export default function CropVideo({ title }: ToolComponentProps) {
|
||||
setResult(croppedFile);
|
||||
} catch (error) {
|
||||
console.error('Error cropping video:', error);
|
||||
setProcessingError(t('video:cropVideo.errorCroppingVideo'));
|
||||
setProcessingError(t('cropVideo.errorCroppingVideo'));
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -90,26 +90,26 @@ export default function CropVideo({ title }: ToolComponentProps) {
|
||||
updateField
|
||||
}) => [
|
||||
{
|
||||
title: t('video:cropVideo.videoInformation'),
|
||||
title: t('cropVideo.videoInformation'),
|
||||
component: (
|
||||
<Box>
|
||||
{videoDimensions ? (
|
||||
<Typography variant="body2" sx={{ mb: 2 }}>
|
||||
{t('video:cropVideo.videoDimensions', {
|
||||
{t('cropVideo.videoDimensions', {
|
||||
width: videoDimensions.width,
|
||||
height: videoDimensions.height
|
||||
})}
|
||||
</Typography>
|
||||
) : (
|
||||
<Typography variant="body2" sx={{ mb: 2 }}>
|
||||
{t('video:cropVideo.loadVideoForDimensions')}
|
||||
{t('cropVideo.loadVideoForDimensions')}
|
||||
</Typography>
|
||||
)}
|
||||
</Box>
|
||||
)
|
||||
},
|
||||
{
|
||||
title: t('video:cropVideo.cropCoordinates'),
|
||||
title: t('cropVideo.cropCoordinates'),
|
||||
component: (
|
||||
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
|
||||
{processingError && (
|
||||
@@ -119,7 +119,7 @@ export default function CropVideo({ title }: ToolComponentProps) {
|
||||
)}
|
||||
<Box sx={{ display: 'flex', gap: 2 }}>
|
||||
<TextField
|
||||
label={t('video:cropVideo.xCoordinate')}
|
||||
label={t('cropVideo.xCoordinate')}
|
||||
type="number"
|
||||
value={values.x}
|
||||
onChange={(e) => updateField('x', parseInt(e.target.value) || 0)}
|
||||
@@ -127,7 +127,7 @@ export default function CropVideo({ title }: ToolComponentProps) {
|
||||
inputProps={{ min: 0 }}
|
||||
/>
|
||||
<TextField
|
||||
label={t('video:cropVideo.yCoordinate')}
|
||||
label={t('cropVideo.yCoordinate')}
|
||||
type="number"
|
||||
value={values.y}
|
||||
onChange={(e) => updateField('y', parseInt(e.target.value) || 0)}
|
||||
@@ -137,7 +137,7 @@ export default function CropVideo({ title }: ToolComponentProps) {
|
||||
</Box>
|
||||
<Box sx={{ display: 'flex', gap: 2 }}>
|
||||
<TextField
|
||||
label={t('video:cropVideo.width')}
|
||||
label={t('cropVideo.width')}
|
||||
type="number"
|
||||
value={values.width}
|
||||
onChange={(e) =>
|
||||
@@ -147,7 +147,7 @@ export default function CropVideo({ title }: ToolComponentProps) {
|
||||
inputProps={{ min: 1 }}
|
||||
/>
|
||||
<TextField
|
||||
label={t('video:cropVideo.height')}
|
||||
label={t('cropVideo.height')}
|
||||
type="number"
|
||||
value={values.height}
|
||||
onChange={(e) =>
|
||||
@@ -189,9 +189,7 @@ export default function CropVideo({ title }: ToolComponentProps) {
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Error getting video dimensions:', error);
|
||||
setProcessingError(
|
||||
t('video:cropVideo.errorLoadingDimensions')
|
||||
);
|
||||
setProcessingError(t('cropVideo.errorLoadingDimensions'));
|
||||
});
|
||||
} else {
|
||||
setVideoDimensions(null);
|
||||
@@ -199,20 +197,20 @@ export default function CropVideo({ title }: ToolComponentProps) {
|
||||
}
|
||||
setInput(video);
|
||||
}}
|
||||
title={t('video:cropVideo.inputTitle')}
|
||||
title={t('cropVideo.inputTitle')}
|
||||
/>
|
||||
)}
|
||||
resultComponent={
|
||||
loading ? (
|
||||
<ToolFileResult
|
||||
title={t('video:cropVideo.croppingVideo')}
|
||||
title={t('cropVideo.croppingVideo')}
|
||||
value={null}
|
||||
loading={true}
|
||||
extension={''}
|
||||
/>
|
||||
) : (
|
||||
<ToolFileResult
|
||||
title={t('video:cropVideo.resultTitle')}
|
||||
title={t('cropVideo.resultTitle')}
|
||||
value={result}
|
||||
extension={'mp4'}
|
||||
/>
|
||||
|
||||
@@ -31,7 +31,7 @@ const orientationOptions: { value: FlipOrientation; label: string }[] = [
|
||||
];
|
||||
|
||||
export default function FlipVideo({ title }: ToolComponentProps) {
|
||||
const { t } = useTranslation();
|
||||
const { t } = useTranslation('video');
|
||||
const [input, setInput] = useState<File | null>(null);
|
||||
const [result, setResult] = useState<File | null>(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -60,7 +60,7 @@ export default function FlipVideo({ title }: ToolComponentProps) {
|
||||
updateField
|
||||
}) => [
|
||||
{
|
||||
title: t('video:flip.orientation'),
|
||||
title: t('flip.orientation'),
|
||||
component: (
|
||||
<Box>
|
||||
{orientationOptions.map((orientationOption) => (
|
||||
@@ -86,20 +86,20 @@ export default function FlipVideo({ title }: ToolComponentProps) {
|
||||
<ToolVideoInput
|
||||
value={input}
|
||||
onChange={setInput}
|
||||
title={t('video:flip.inputTitle')}
|
||||
title={t('flip.inputTitle')}
|
||||
/>
|
||||
}
|
||||
resultComponent={
|
||||
loading ? (
|
||||
<ToolFileResult
|
||||
title={t('video:flip.flippingVideo')}
|
||||
title={t('flip.flippingVideo')}
|
||||
value={null}
|
||||
loading={true}
|
||||
extension={''}
|
||||
/>
|
||||
) : (
|
||||
<ToolFileResult
|
||||
title={t('video:flip.resultTitle')}
|
||||
title={t('flip.resultTitle')}
|
||||
value={result}
|
||||
extension={'mp4'}
|
||||
/>
|
||||
|
||||
@@ -75,5 +75,12 @@
|
||||
"title": "Crop Video",
|
||||
"description": "This tool allows you to crop video files to remove unwanted areas. You can specify the crop area by setting the X, Y coordinates and width, height dimensions."
|
||||
}
|
||||
},
|
||||
"trim": {
|
||||
"timestamps": "Timestamps",
|
||||
"startTime": "Start Time",
|
||||
"endTime": "End Time",
|
||||
"inputTitle": "Input Video",
|
||||
"resultTitle": "Trimmed Video"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ const validationSchema = Yup.object({
|
||||
});
|
||||
|
||||
export default function Loop({ title, longDescription }: ToolComponentProps) {
|
||||
const { t } = useTranslation();
|
||||
const { t } = useTranslation('video');
|
||||
const [input, setInput] = useState<File | null>(null);
|
||||
const [result, setResult] = useState<File | null>(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -45,7 +45,7 @@ export default function Loop({ title, longDescription }: ToolComponentProps) {
|
||||
updateField
|
||||
}) => [
|
||||
{
|
||||
title: t('video:loop.loops'),
|
||||
title: t('loop.loops'),
|
||||
component: (
|
||||
<Box>
|
||||
<TextFieldWithDesc
|
||||
@@ -53,7 +53,7 @@ export default function Loop({ title, longDescription }: ToolComponentProps) {
|
||||
updateNumberField(value, 'loops', updateField)
|
||||
}
|
||||
value={values.loops}
|
||||
label={t('video:loop.numberOfLoops')}
|
||||
label={t('loop.numberOfLoops')}
|
||||
/>
|
||||
</Box>
|
||||
)
|
||||
@@ -68,14 +68,14 @@ export default function Loop({ title, longDescription }: ToolComponentProps) {
|
||||
loading ? (
|
||||
<ToolFileResult
|
||||
value={null}
|
||||
title={t('video:loop.loopingVideo')}
|
||||
title={t('loop.loopingVideo')}
|
||||
loading={true}
|
||||
extension={''}
|
||||
/>
|
||||
) : (
|
||||
<ToolFileResult
|
||||
value={result}
|
||||
title={t('video:loop.resultTitle')}
|
||||
title={t('loop.resultTitle')}
|
||||
extension={'mp4'}
|
||||
/>
|
||||
)
|
||||
@@ -86,7 +86,7 @@ export default function Loop({ title, longDescription }: ToolComponentProps) {
|
||||
setInput={setInput}
|
||||
compute={compute}
|
||||
toolInfo={{
|
||||
title: t('video:loop.toolInfo.title', { title }),
|
||||
title: t('loop.toolInfo.title', { title }),
|
||||
description: longDescription
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -28,7 +28,7 @@ const angleOptions: { value: RotationAngle; label: string }[] = [
|
||||
{ value: 270, label: '270° (90° Counter-clockwise)' }
|
||||
];
|
||||
export default function RotateVideo({ title }: ToolComponentProps) {
|
||||
const { t } = useTranslation();
|
||||
const { t } = useTranslation('video');
|
||||
const [input, setInput] = useState<File | null>(null);
|
||||
const [result, setResult] = useState<File | null>(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -57,7 +57,7 @@ export default function RotateVideo({ title }: ToolComponentProps) {
|
||||
updateField
|
||||
}) => [
|
||||
{
|
||||
title: t('video:rotate.rotation'),
|
||||
title: t('rotate.rotation'),
|
||||
component: (
|
||||
<Box>
|
||||
{angleOptions.map((angleOption) => (
|
||||
@@ -83,20 +83,20 @@ export default function RotateVideo({ title }: ToolComponentProps) {
|
||||
<ToolVideoInput
|
||||
value={input}
|
||||
onChange={setInput}
|
||||
title={t('video:rotate.inputTitle')}
|
||||
title={t('rotate.inputTitle')}
|
||||
/>
|
||||
}
|
||||
resultComponent={
|
||||
loading ? (
|
||||
<ToolFileResult
|
||||
title={t('video:rotate.rotatingVideo')}
|
||||
title={t('rotate.rotatingVideo')}
|
||||
value={null}
|
||||
loading={true}
|
||||
extension={''}
|
||||
/>
|
||||
) : (
|
||||
<ToolFileResult
|
||||
title={t('video:rotate.resultTitle')}
|
||||
title={t('rotate.resultTitle')}
|
||||
value={result}
|
||||
extension={'mp4'}
|
||||
/>
|
||||
|
||||
@@ -29,7 +29,7 @@ const validationSchema = Yup.object({
|
||||
});
|
||||
|
||||
export default function TrimVideo({ title }: ToolComponentProps) {
|
||||
const { t } = useTranslation();
|
||||
const { t } = useTranslation('video');
|
||||
const [input, setInput] = useState<File | null>(null);
|
||||
const [result, setResult] = useState<File | null>(null);
|
||||
|
||||
@@ -87,7 +87,7 @@ export default function TrimVideo({ title }: ToolComponentProps) {
|
||||
updateField
|
||||
}) => [
|
||||
{
|
||||
title: t('video:trim.timestamps'),
|
||||
title: t('trim.timestamps'),
|
||||
component: (
|
||||
<Box>
|
||||
<TextFieldWithDesc
|
||||
@@ -95,7 +95,7 @@ export default function TrimVideo({ title }: ToolComponentProps) {
|
||||
updateNumberField(value, 'trimStart', updateField)
|
||||
}
|
||||
value={values.trimStart}
|
||||
label={t('video:trim.startTime')}
|
||||
label={t('trim.startTime')}
|
||||
sx={{ mb: 2, backgroundColor: 'background.paper' }}
|
||||
/>
|
||||
<TextFieldWithDesc
|
||||
@@ -103,7 +103,7 @@ export default function TrimVideo({ title }: ToolComponentProps) {
|
||||
updateNumberField(value, 'trimEnd', updateField)
|
||||
}
|
||||
value={values.trimEnd}
|
||||
label={t('video:trim.endTime')}
|
||||
label={t('trim.endTime')}
|
||||
/>
|
||||
</Box>
|
||||
)
|
||||
@@ -118,7 +118,7 @@ export default function TrimVideo({ title }: ToolComponentProps) {
|
||||
<ToolVideoInput
|
||||
value={input}
|
||||
onChange={setInput}
|
||||
title={t('video:trim.inputTitle')}
|
||||
title={t('trim.inputTitle')}
|
||||
showTrimControls={true}
|
||||
onTrimChange={(trimStart, trimEnd) => {
|
||||
setFieldValue('trimStart', trimStart);
|
||||
@@ -131,7 +131,7 @@ export default function TrimVideo({ title }: ToolComponentProps) {
|
||||
}}
|
||||
resultComponent={
|
||||
<ToolFileResult
|
||||
title={t('video:trim.resultTitle')}
|
||||
title={t('trim.resultTitle')}
|
||||
value={result}
|
||||
extension={'mp4'}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user