Skip to content

Commit

Permalink
add translations
Browse files Browse the repository at this point in the history
  • Loading branch information
prachigarg19 committed Feb 12, 2024
1 parent d5b011e commit ec7cf49
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 12 deletions.
11 changes: 10 additions & 1 deletion public/static/locales/en/projectDetails.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
{
"satelliteAnalysis": "Satellite Analysis"
"satelliteAnalysis": "Satellite Analysis",
"biomassChange": "Biomass Change",
"potentialBiomass": "Potential Biomass",
"treeCover": "Tree Cover",
"fireRisk": "Fire Risk",
"floodingRisk": "Flooding Risk",
"speciesDensity": "Species Density",
"projectBegin": "Since project begin",
"avg": "Average",
"tons": "tons"
}
8 changes: 6 additions & 2 deletions src/temp/VegetationChangeDatabox/Databox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,24 @@ import Dropdown from './Dropdown';
import BiomassChangeIcon from '../icons/BiomassChangeIcon';
import VegetationSlider from './VegetationSlider';
import NewInfoIcon from '../icons/NewInfoIcon';
import { useTranslation } from 'next-i18next';

interface Props {
startYear: number;
}
const Databox = ({ startYear }: Props) => {
const { t } = useTranslation('projectDetails');
return (
<div className={styles.databoxContainer}>
<div className={styles.dropdownInfoContainer}>
<Dropdown
labelIcon={<BiomassChangeIcon />}
labelTitle={'Biomass Change'}
labelTitle={t('biomassChange')}
isOpen={false}
/>
<p className={styles.startYearText}>Since project begin {startYear}</p>
<p className={styles.startYearText}>
{t('projectBegin')} {startYear}
</p>
</div>
<div className={styles.divider}></div>
<div className={styles.sliderInfoContainer}>
Expand Down
14 changes: 8 additions & 6 deletions src/temp/VegetationChangeDatabox/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import styles from './VegetationChangeDatabox.module.scss';
import SpeciesDensityIcon from '../icons/SpeciesDensityIcon';
import FloodingRiskIcon from '../icons/FloodingRiskIcon';
import DropdownArrow from '../icons/DropdownArrow';
import { useTranslation } from 'next-i18next';

interface Props {
labelIcon: React.JSX.Element;
Expand All @@ -15,30 +16,31 @@ interface Props {
}

const Dropdown = ({ labelIcon, labelTitle, isOpen }: Props) => {
const { t } = useTranslation('projectDetails');
const optionsList = [
{
icon: <BiomassChangeIcon />,
title: 'Biomass Change',
title: t('biomassChange'),
},
{
icon: <PotentialBiomassIcon />,
title: 'Potential Biomass',
title: t('potentialBiomass'),
},
{
icon: <TreeCoverIcon />,
title: 'Tree Cover',
title: t('treeCover'),
},
{
icon: <FireIcon />,
title: 'Fire Risk',
title: t('fireRisk'),
},
{
icon: <FloodingRiskIcon />,
title: 'Flooding Risk',
title: t('floodingRisk'),
},
{
icon: <SpeciesDensityIcon />,
title: 'Species Density',
title: t('speciesDensity'),
},
];
const [selectedOption, setSelectedOption] = useState({
Expand Down
8 changes: 5 additions & 3 deletions src/temp/VegetationChangeDatabox/VegetationSlider.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Box, Typography, styled } from '@mui/material';
import Slider from '@mui/material/Slider';
import React from 'react';
import { useTranslation } from 'next-i18next';

interface Props {
position: number;
Expand Down Expand Up @@ -56,10 +57,11 @@ const StyledSlider = styled(Slider)(() => {
});

const VegetationSlider = ({ position }: Props) => {
const { t } = useTranslation('projectDetails');
function getLabelText(value: number) {
return (
<div className="labelText">
<span>Average</span> +{value} tons
<span>{t('avg')}</span> +{value} {t('tons')}
</div>
);
}
Expand All @@ -83,8 +85,8 @@ const VegetationSlider = ({ position }: Props) => {
fontWeight: 600,
}}
>
<Typography>-20 tons</Typography>
<Typography>20 tons</Typography>
<Typography>-20 {t('tons')}</Typography>
<Typography>20 {t('tons')}</Typography>
</Box>
</div>
);
Expand Down

0 comments on commit ec7cf49

Please sign in to comment.