fix: translation related behaviors

This commit is contained in:
Ibrahima G. Coulibaly
2025-07-14 18:04:30 +01:00
parent a6a2c1f3a1
commit 3b5f852287
112 changed files with 401 additions and 648 deletions

View File

@@ -37,15 +37,18 @@ export default function ToolsByCategory() {
const { categoryName } = useParams();
const [searchTerm, setSearchTerm] = React.useState<string>('');
const rawTitle = getToolCategoryTitle(categoryName as string);
const categoryTools = filterTools(
getToolsByCategory().find(({ type }) => type === categoryName)?.tools ?? [],
searchTerm
);
const { t } = useTranslation(
categoryTools.length
? getI18nNamespaceFromToolCategory(categoryTools[0].type)
: 'translation'
);
// First get tools by category without filtering
const toolsByCategory =
getToolsByCategory().find(({ type }) => type === categoryName)?.tools ?? [];
const namespace =
toolsByCategory.length > 0
? getI18nNamespaceFromToolCategory(toolsByCategory[0].type)
: 'translation';
const { t } = useTranslation(namespace);
const categoryTools = filterTools(toolsByCategory, searchTerm, t);
useEffect(() => {
if (mainContentRef.current) {
mainContentRef.current.scrollIntoView({ behavior: 'smooth' });