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

@@ -2,12 +2,9 @@ import { defineTool } from '@tools/defineTool';
import { lazy } from 'react';
export const tool = defineTool('number', {
name: 'Arithmetic Sequence',
path: 'arithmetic-sequence',
icon: 'material-symbols:functions',
description:
'Generate arithmetic sequences with specified start value, common difference, and number of terms. Create mathematical progressions for calculations or analysis.',
shortDescription: 'Generate arithmetic sequences',
keywords: ['arithmetic', 'sequence', 'math', 'progression'],
component: lazy(() => import('./index')),
i18n: {

View File

@@ -3,12 +3,9 @@ import { lazy } from 'react';
// import image from '@assets/text.png';
export const tool = defineTool('number', {
name: 'Generate',
path: 'generate',
icon: 'material-symbols:add-circle',
description:
'Generate random numbers within specified ranges. Create sequences of numbers for testing, simulations, or random data generation.',
shortDescription: 'Generate random numbers in specified ranges',
keywords: ['generate', 'random', 'numbers'],
component: lazy(() => import('./index')),
i18n: {

View File

@@ -13,13 +13,7 @@ const ohmsLawCalc: GenericCalcType = {
'power',
'V=IR'
],
shortDescription:
"Calculate voltage, current, or resistance in electrical circuits using Ohm's Law",
name: "Ohm's Law",
path: 'ohms-law',
description: 'Calculates voltage, current and resistance',
longDescription:
"This calculator applies Ohm's Law (V = I × R) to determine any of the three electrical parameters when the other two are known. Ohm's Law is a fundamental principle in electrical engineering that describes the relationship between voltage (V), current (I), and resistance (R). This tool is essential for electronics hobbyists, electrical engineers, and students working with circuits to quickly solve for unknown values in their electrical designs.",
formula: 'V = I * R',
i18n: {
name: 'number:ohmsLaw.title',

View File

@@ -11,12 +11,7 @@ const slackline: GenericCalcType = {
'tension',
'clothesline'
],
shortDescription:
'Calculate the approximate tension of a slackline or clothesline. Do not rely on this for safety.',
name: 'Slackline Tension',
path: 'slackline-tension',
description: 'Calculates tension in a slackline',
longDescription: 'This calculator assumes a load in the center of the rope',
formula: 'T = (W * sqrt((S**2) + ((L/2)**2)) )/ (2S)',
presets: [],
i18n: {

View File

@@ -13,13 +13,7 @@ const areaSphere: GenericCalcType = {
'3D',
'shape'
],
shortDescription:
'Calculate the surface area of a sphere based on its radius',
name: 'Area of a Sphere',
path: 'area-sphere',
description: 'Area of a Sphere',
longDescription:
'This calculator determines the surface area of a sphere using the formula A = 4πr². You can either input the radius to find the surface area or enter the surface area to calculate the required radius. This tool is useful for students studying geometry, engineers working with spherical objects, and anyone needing to perform calculations involving spherical surfaces.',
formula: 'A = 4 * pi * r**2',
presets: [],
i18n: {

View File

@@ -14,8 +14,6 @@ const volumeSphere: GenericCalcType = {
'shape',
'capacity'
],
shortDescription: 'Calculate the volume of a sphere using radius or diameter',
name: 'Volume of a Sphere',
i18n: {
name: 'number:sphereVolume.title',
description: 'number:sphereVolume.description',
@@ -23,9 +21,6 @@ const volumeSphere: GenericCalcType = {
longDescription: 'number:sphereVolume.longDescription'
},
path: 'volume-sphere',
description: 'Volume of a Sphere',
longDescription:
'This calculator computes the volume of a sphere using the formula V = (4/3)πr³. You can input either the radius or diameter to find the volume, or enter the volume to determine the required radius. The tool is valuable for students, engineers, and professionals working with spherical objects in fields such as physics, engineering, and manufacturing.',
formula: 'v = (4/3) * pi * r**3',
presets: [],
variables: [

View File

@@ -16,9 +16,6 @@ const voltageDropInWire: GenericCalcType = {
'AWG',
'gauge'
],
shortDescription:
'Calculate voltage drop and power loss in electrical cables based on length, material, and current',
name: 'Round trip voltage drop in cable',
path: 'cable-voltage-drop',
formula: 'x = (((p * L) / (A/10**6) ) *2) * I',
i18n: {
@@ -27,10 +24,6 @@ const voltageDropInWire: GenericCalcType = {
shortDescription: 'number:voltageDropInWire.shortDescription',
longDescription: 'number:voltageDropInWire.longDescription'
},
description:
'Calculates round trip voltage and power loss in a 2 conductor cable',
longDescription:
'This calculator helps determine the voltage drop and power loss in a two-conductor electrical cable. It takes into account the cable length, wire gauge (cross-sectional area), material resistivity, and current flow. The tool calculates the round-trip voltage drop, total resistance of the cable, and the power dissipated as heat. This is particularly useful for electrical engineers, electricians, and hobbyists when designing electrical systems to ensure voltage levels remain within acceptable limits at the load.',
presets: [
{
title: 'Material',

View File

@@ -26,6 +26,7 @@ import { CustomSnackBarContext } from 'contexts/CustomSnackBarContext';
import Typography from '@mui/material/Typography';
import Grid from '@mui/material/Grid';
import useMediaQuery from '@mui/material/useMediaQuery';
import { useTranslation } from 'react-i18next';
function numericSolveEquationFor(
equation: string,
@@ -61,6 +62,7 @@ export default async function makeTool(
return function GenericCalc({ title }: ToolComponentProps) {
const { showSnackBar } = useContext(CustomSnackBarContext);
const { t } = useTranslation();
const theme = useTheme();
const lessThanSmall = useMediaQuery(theme.breakpoints.down('sm'));
@@ -236,8 +238,8 @@ export default async function makeTool(
inputComponent={null}
initialValues={initialValues}
toolInfo={{
title: calcData.name,
description: calcData.longDescription
title: t(calcData.i18n.name),
description: t(calcData.i18n.longDescription)
}}
verticalGroups
// @ts-ignore

View File

@@ -3,12 +3,9 @@ import { lazy } from 'react';
// import image from '@assets/text.png';
export const tool = defineTool('number', {
name: 'Sum',
path: 'sum',
icon: 'material-symbols:add',
description:
'Calculate the sum of a list of numbers. Enter numbers separated by commas or newlines to get their total sum.',
shortDescription: 'Calculate sum of numbers',
keywords: ['sum', 'add', 'calculate', 'total'],
component: lazy(() => import('./index')),
i18n: {