chore: translate userTypes

This commit is contained in:
Ibrahima G. Coulibaly
2025-07-22 19:47:09 +01:00
parent 6fddf8ec42
commit 56e0f1696c
66 changed files with 81 additions and 75 deletions

View File

@@ -246,5 +246,9 @@
"copyFailed": "Failed to copy: {{error}}",
"loading": "Loading... This may take a moment.",
"result": "Result"
},
"userTypes": {
"generalUsers": "General users",
"developers": "Developers"
}
}

View File

@@ -1,6 +1,7 @@
import React, { useState, useEffect } from 'react';
import { Box, Chip, Typography } from '@mui/material';
import React from 'react';
import { Box, Chip } from '@mui/material';
import { UserType } from '@tools/defineTool';
import { useTranslation } from 'react-i18next';
interface UserTypeFilterProps {
selectedUserTypes: UserType[];
@@ -11,8 +12,9 @@ interface UserTypeFilterProps {
export default function UserTypeFilter({
selectedUserTypes,
onUserTypesChange,
userTypes = ['General Users', 'Developers', 'CyberSec']
userTypes = ['generalUsers', 'developers']
}: UserTypeFilterProps) {
const { t } = useTranslation('translation');
if (userTypes.length <= 1) return null;
return (
<Box
@@ -28,7 +30,7 @@ export default function UserTypeFilter({
{userTypes.map((userType) => (
<Chip
key={userType}
label={userType}
label={t(`userTypes.${userType}`)}
color={selectedUserTypes.includes(userType) ? 'primary' : 'default'}
onClick={() => {
const isSelected = selectedUserTypes.includes(userType);

View File

@@ -21,6 +21,6 @@ export const tool = defineTool('audio', {
name: 'audio:changeSpeed.title',
description: 'audio:changeSpeed.description',
shortDescription: 'audio:changeSpeed.shortDescription',
userTypes: ['General Users', 'Developers']
userTypes: ['generalUsers', 'developers']
}
});

View File

@@ -22,6 +22,6 @@ export const tool = defineTool('audio', {
name: 'audio:extractAudio.title',
description: 'audio:extractAudio.description',
shortDescription: 'audio:extractAudio.shortDescription',
userTypes: ['General Users', 'Developers']
userTypes: ['generalUsers', 'developers']
}
});

View File

@@ -7,7 +7,7 @@ export const tool = defineTool('audio', {
description: 'audio:mergeAudio.description',
shortDescription: 'audio:mergeAudio.shortDescription',
longDescription: 'audio:mergeAudio.longDescription',
userTypes: ['General Users', 'Developers']
userTypes: ['generalUsers', 'developers']
},
path: 'merge-audio',

View File

@@ -7,7 +7,7 @@ export const tool = defineTool('audio', {
description: 'audio:trim.description',
shortDescription: 'audio:trim.shortDescription',
longDescription: 'audio:trim.longDescription',
userTypes: ['General Users', 'Developers']
userTypes: ['generalUsers', 'developers']
},
path: 'trim',

View File

@@ -6,7 +6,7 @@ export const tool = defineTool('image-generic', {
name: 'image:compress.title',
description: 'image:compress.description',
shortDescription: 'image:compress.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
},
path: 'compress',

View File

@@ -6,7 +6,7 @@ export const tool = defineTool('image-generic', {
name: 'image:resize.title',
description: 'image:resize.description',
shortDescription: 'image:resize.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
},
path: 'resize',

View File

@@ -12,6 +12,6 @@ export const tool = defineTool('list', {
name: 'list:duplicate.title',
description: 'list:duplicate.description',
shortDescription: 'list:duplicate.shortDescription',
userTypes: ['General Users', 'Developers']
userTypes: ['generalUsers', 'developers']
}
});

View File

@@ -12,6 +12,6 @@ export const tool = defineTool('list', {
name: 'list:findMostPopular.title',
description: 'list:findMostPopular.description',
shortDescription: 'list:findMostPopular.shortDescription',
userTypes: ['General Users', 'Developers']
userTypes: ['generalUsers', 'developers']
}
});

View File

@@ -11,6 +11,6 @@ export const tool = defineTool('list', {
name: 'list:findUnique.title',
description: 'list:findUnique.description',
shortDescription: 'list:findUnique.shortDescription',
userTypes: ['General Users', 'Developers']
userTypes: ['generalUsers', 'developers']
}
});

View File

@@ -11,6 +11,6 @@ export const tool = defineTool('list', {
name: 'list:group.title',
description: 'list:group.description',
shortDescription: 'list:group.shortDescription',
userTypes: ['General Users', 'Developers']
userTypes: ['generalUsers', 'developers']
}
});

View File

@@ -10,7 +10,7 @@ export const tool = defineTool('list', {
name: 'list:reverse.title',
description: 'list:reverse.description',
shortDescription: 'list:reverse.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
},
component: lazy(() => import('./index'))
});

View File

@@ -12,6 +12,6 @@ export const tool = defineTool('list', {
name: 'list:rotate.title',
description: 'list:rotate.description',
shortDescription: 'list:rotate.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
}
});

View File

@@ -12,6 +12,6 @@ export const tool = defineTool('list', {
name: 'list:shuffle.title',
description: 'list:shuffle.description',
shortDescription: 'list:shuffle.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
}
});

View File

@@ -12,6 +12,6 @@ export const tool = defineTool('list', {
name: 'list:sort.title',
description: 'list:sort.description',
shortDescription: 'list:sort.shortDescription',
userTypes: ['General Users', 'Developers']
userTypes: ['generalUsers', 'developers']
}
});

View File

@@ -11,6 +11,6 @@ export const tool = defineTool('list', {
name: 'list:truncate.title',
description: 'list:truncate.description',
shortDescription: 'list:truncate.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
}
});

View File

@@ -12,6 +12,6 @@ export const tool = defineTool('list', {
name: 'list:unwrap.title',
description: 'list:unwrap.description',
shortDescription: 'list:unwrap.shortDescription',
userTypes: ['General Users', 'Developers']
userTypes: ['generalUsers', 'developers']
}
});

View File

@@ -12,6 +12,6 @@ export const tool = defineTool('list', {
name: 'list:wrap.title',
description: 'list:wrap.description',
shortDescription: 'list:wrap.shortDescription',
userTypes: ['General Users', 'Developers']
userTypes: ['generalUsers', 'developers']
}
});

View File

@@ -11,6 +11,6 @@ export const tool = defineTool('number', {
name: 'number:arithmeticSequence.title',
description: 'number:arithmeticSequence.description',
shortDescription: 'number:arithmeticSequence.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
}
});

View File

@@ -12,6 +12,6 @@ export const tool = defineTool('number', {
name: 'number:sum.title',
description: 'number:sum.description',
shortDescription: 'number:sum.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
}
});

View File

@@ -24,6 +24,6 @@ export const tool = defineTool('pdf', {
name: 'pdf:compressPdf.title',
description: 'pdf:compressPdf.description',
shortDescription: 'pdf:compressPdf.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
}
});

View File

@@ -6,7 +6,7 @@ export const tool = defineTool('pdf', {
name: 'pdf:editor.title',
description: 'pdf:editor.description',
shortDescription: 'pdf:editor.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
},
path: 'editor',

View File

@@ -10,6 +10,6 @@ export const meta = defineTool('pdf', {
name: 'pdf:mergePdf.title',
description: 'pdf:mergePdf.description',
shortDescription: 'pdf:mergePdf.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
}
});

View File

@@ -10,6 +10,6 @@ export const meta = defineTool('pdf', {
name: 'pdf:pdfToEpub.title',
description: 'pdf:pdfToEpub.description',
shortDescription: 'pdf:pdfToEpub.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
}
});

View File

@@ -7,7 +7,7 @@ export const tool = defineTool('pdf', {
description: 'pdf:pdfToPng.description',
shortDescription: 'pdf:pdfToPng.shortDescription',
longDescription: 'pdf:pdfToPng.longDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
},
path: 'pdf-to-png',

View File

@@ -23,6 +23,6 @@ export const tool = defineTool('pdf', {
name: 'pdf:protectPdf.title',
description: 'pdf:protectPdf.description',
shortDescription: 'pdf:protectPdf.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
}
});

View File

@@ -7,7 +7,7 @@ export const tool = defineTool('pdf', {
description: 'pdf:rotatePdf.description',
shortDescription: 'pdf:rotatePdf.shortDescription',
longDescription: 'pdf:rotatePdf.longDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
},
path: 'rotate-pdf',

View File

@@ -10,6 +10,6 @@ export const meta = defineTool('pdf', {
name: 'pdf:splitPdf.title',
description: 'pdf:splitPdf.description',
shortDescription: 'pdf:splitPdf.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
}
});

View File

@@ -11,6 +11,6 @@ export const tool = defineTool('string', {
name: 'string:base64.title',
description: 'string:base64.description',
shortDescription: 'string:base64.shortDescription',
userTypes: ['General Users', 'Developers']
userTypes: ['generalUsers', 'developers']
}
});

View File

@@ -12,6 +12,6 @@ export const tool = defineTool('string', {
name: 'string:censor.title',
description: 'string:censor.description',
shortDescription: 'string:censor.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
}
});

View File

@@ -12,6 +12,6 @@ export const tool = defineTool('string', {
name: 'string:createPalindrome.title',
description: 'string:createPalindrome.description',
shortDescription: 'string:createPalindrome.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
}
});

View File

@@ -12,6 +12,6 @@ export const tool = defineTool('string', {
name: 'string:extractSubstring.title',
description: 'string:extractSubstring.description',
shortDescription: 'string:extractSubstring.shortDescription',
userTypes: ['General Users', 'Developers']
userTypes: ['generalUsers', 'developers']
}
});

View File

@@ -12,6 +12,6 @@ export const tool = defineTool('string', {
name: 'string:join.title',
description: 'string:join.description',
shortDescription: 'string:join.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
}
});

View File

@@ -12,6 +12,6 @@ export const tool = defineTool('string', {
name: 'string:palindrome.title',
description: 'string:palindrome.description',
shortDescription: 'string:palindrome.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
}
});

View File

@@ -12,6 +12,6 @@ export const tool = defineTool('string', {
name: 'string:quote.title',
description: 'string:quote.description',
shortDescription: 'string:quote.shortDescription',
userTypes: ['General Users', 'Developers']
userTypes: ['generalUsers', 'developers']
}
});

View File

@@ -12,6 +12,6 @@ export const tool = defineTool('string', {
name: 'string:randomizeCase.title',
description: 'string:randomizeCase.description',
shortDescription: 'string:randomizeCase.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
}
});

View File

@@ -11,6 +11,6 @@ export const tool = defineTool('string', {
name: 'string:removeDuplicateLines.title',
description: 'string:removeDuplicateLines.description',
shortDescription: 'string:removeDuplicateLines.shortDescription',
userTypes: ['General Users', 'Developers']
userTypes: ['generalUsers', 'developers']
}
});

View File

@@ -12,6 +12,6 @@ export const tool = defineTool('string', {
name: 'string:repeat.title',
description: 'string:repeat.description',
shortDescription: 'string:repeat.shortDescription',
userTypes: ['General Users', 'Developers']
userTypes: ['generalUsers', 'developers']
}
});

View File

@@ -11,6 +11,6 @@ export const tool = defineTool('string', {
name: 'string:reverse.title',
description: 'string:reverse.description',
shortDescription: 'string:reverse.shortDescription',
userTypes: ['General Users', 'Developers']
userTypes: ['generalUsers', 'developers']
}
});

View File

@@ -7,7 +7,7 @@ export const tool = defineTool('string', {
name: 'string:rot13.title',
description: 'string:rot13.description',
shortDescription: 'string:rot13.shortDescription',
userTypes: ['General Users', 'Developers']
userTypes: ['generalUsers', 'developers']
},
path: 'rot13',

View File

@@ -7,7 +7,7 @@ export const tool = defineTool('string', {
name: 'string:rotate.title',
description: 'string:rotate.description',
shortDescription: 'string:rotate.shortDescription',
userTypes: ['General Users', 'Developers']
userTypes: ['generalUsers', 'developers']
},
path: 'rotate',

View File

@@ -12,6 +12,6 @@ export const tool = defineTool('string', {
name: 'string:split.title',
description: 'string:split.description',
shortDescription: 'string:split.shortDescription',
userTypes: ['General Users', 'Developers']
userTypes: ['generalUsers', 'developers']
}
});

View File

@@ -12,6 +12,6 @@ export const tool = defineTool('string', {
name: 'string:statistic.title',
description: 'string:statistic.description',
shortDescription: 'string:statistic.shortDescription',
userTypes: ['General Users', 'Developers']
userTypes: ['generalUsers', 'developers']
}
});

View File

@@ -6,7 +6,7 @@ export const tool = defineTool('string', {
name: 'string:textReplacer.title',
description: 'string:textReplacer.description',
shortDescription: 'string:textReplacer.shortDescription',
userTypes: ['General Users', 'Developers']
userTypes: ['generalUsers', 'developers']
},
path: 'replacer',

View File

@@ -11,6 +11,6 @@ export const tool = defineTool('string', {
name: 'string:toMorse.title',
description: 'string:toMorse.description',
shortDescription: 'string:toMorse.shortDescription',
userTypes: ['General Users', 'Developers']
userTypes: ['generalUsers', 'developers']
}
});

View File

@@ -11,6 +11,6 @@ export const tool = defineTool('string', {
name: 'string:truncate.title',
description: 'string:truncate.description',
shortDescription: 'string:truncate.shortDescription',
userTypes: ['General Users', 'Developers']
userTypes: ['generalUsers', 'developers']
}
});

View File

@@ -11,6 +11,6 @@ export const tool = defineTool('string', {
name: 'string:uppercase.title',
description: 'string:uppercase.description',
shortDescription: 'string:uppercase.shortDescription',
userTypes: ['General Users', 'Developers']
userTypes: ['generalUsers', 'developers']
}
});

View File

@@ -11,6 +11,6 @@ export const tool = defineTool('time', {
name: 'time:checkLeapYears.title',
description: 'time:checkLeapYears.description',
shortDescription: 'time:checkLeapYears.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
}
});

View File

@@ -11,6 +11,6 @@ export const tool = defineTool('time', {
name: 'time:convertDaysToHours.title',
description: 'time:convertDaysToHours.description',
shortDescription: 'time:convertDaysToHours.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
}
});

View File

@@ -11,6 +11,6 @@ export const tool = defineTool('time', {
name: 'time:convertHoursToDays.title',
description: 'time:convertHoursToDays.description',
shortDescription: 'time:convertHoursToDays.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
}
});

View File

@@ -11,6 +11,6 @@ export const tool = defineTool('time', {
name: 'time:convertSecondsToTime.title',
description: 'time:convertSecondsToTime.description',
shortDescription: 'time:convertSecondsToTime.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
}
});

View File

@@ -11,6 +11,6 @@ export const tool = defineTool('time', {
name: 'time:convertTimeToSeconds.title',
description: 'time:convertTimeToSeconds.description',
shortDescription: 'time:convertTimeToSeconds.shortDescription',
userTypes: ['General Users', 'Developers']
userTypes: ['generalUsers', 'developers']
}
});

View File

@@ -19,6 +19,6 @@ export const tool = defineTool('time', {
name: 'time:crontabGuru.title',
description: 'time:crontabGuru.description',
shortDescription: 'time:crontabGuru.shortDescription',
userTypes: ['Developers']
userTypes: ['developers']
}
});

View File

@@ -11,6 +11,6 @@ export const tool = defineTool('time', {
name: 'time:timeBetweenDates.title',
description: 'time:timeBetweenDates.description',
shortDescription: 'time:timeBetweenDates.shortDescription',
userTypes: ['General Users', 'Developers']
userTypes: ['generalUsers', 'developers']
}
});

View File

@@ -11,6 +11,6 @@ export const tool = defineTool('time', {
name: 'time:truncateClockTime.title',
description: 'time:truncateClockTime.description',
shortDescription: 'time:truncateClockTime.shortDescription',
userTypes: ['General Users', 'Developers']
userTypes: ['generalUsers', 'developers']
}
});

View File

@@ -11,6 +11,6 @@ export const tool = defineTool('video', {
name: 'video:changeSpeed.title',
description: 'video:changeSpeed.description',
shortDescription: 'video:changeSpeed.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
}
});

View File

@@ -22,6 +22,6 @@ export const tool = defineTool('video', {
name: 'video:compress.title',
description: 'video:compress.description',
shortDescription: 'video:compress.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
}
});

View File

@@ -19,7 +19,7 @@ export const tool = defineTool('video', {
name: 'video:cropVideo.title',
description: 'video:cropVideo.description',
shortDescription: 'video:cropVideo.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
},
component: lazy(() => import('./index'))
});

View File

@@ -11,6 +11,6 @@ export const tool = defineTool('video', {
name: 'video:flip.title',
description: 'video:flip.description',
shortDescription: 'video:flip.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
}
});

View File

@@ -11,6 +11,6 @@ export const tool = defineTool('video', {
name: 'video:loop.title',
description: 'video:loop.description',
shortDescription: 'video:loop.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
}
});

View File

@@ -11,6 +11,6 @@ export const tool = defineTool('video', {
name: 'video:rotate.title',
description: 'video:rotate.description',
shortDescription: 'video:rotate.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
}
});

View File

@@ -10,6 +10,6 @@ export const tool = defineTool('video', {
name: 'video:trim.title',
description: 'video:trim.description',
shortDescription: 'video:trim.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
}
});

View File

@@ -10,6 +10,6 @@ export const tool = defineTool('video', {
name: 'video:videoToGif.title',
description: 'video:videoToGif.description',
shortDescription: 'video:videoToGif.shortDescription',
userTypes: ['General Users']
userTypes: ['generalUsers']
}
});

View File

@@ -4,7 +4,7 @@ import { IconifyIcon } from '@iconify/react';
import { FullI18nKey, validNamespaces } from '../i18n';
import { useTranslation } from 'react-i18next';
export type UserType = 'General Users' | 'Developers' | 'CyberSec';
export type UserType = 'generalUsers' | 'developers';
export interface ToolMeta {
path: string;

View File

@@ -138,14 +138,14 @@ const categoriesConfig: {
];
const CATEGORIES_USER_TYPES_MAPPINGS: Partial<Record<ToolCategory, UserType>> =
{
xml: 'Developers',
csv: 'Developers',
json: 'Developers',
gif: 'General Users',
png: 'General Users',
'image-generic': 'General Users',
video: 'General Users',
audio: 'General Users'
xml: 'developers',
csv: 'developers',
json: 'developers',
gif: 'generalUsers',
png: 'generalUsers',
'image-generic': 'generalUsers',
video: 'generalUsers',
audio: 'generalUsers'
};
// Filter tools by user types
export const filterToolsByUserTypes = (