Skip to content

Commit

Permalink
fix: missing translation for min/max duration labels
Browse files Browse the repository at this point in the history
  • Loading branch information
blushi committed Nov 28, 2024
1 parent 621fa76 commit c5e5a6e
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ DurationStory.args = {
title="20 year project duration"
minimumValue={20}
maximumValue={30}
minimumLabel="minimum"
durationUnitLabel="years"
minDurationLabel="20 years minimum"
maxDurationLabel="30 years"
duration={20}
tooltip="Duration Tooltip"
/>
Expand All @@ -38,22 +38,29 @@ const durationValues = [
duration: 20,
title: '20 year project duration',
maximumValue: 30,
minDurationLabel: '20 years minimum',
maxDurationLabel: '30 years',
},
{
duration: 25,
title: '25 year project duration',
maximumValue: 30,
minDurationLabel: '20 years minimum',
maxDurationLabel: '30 years',
},
{
duration: 50,
title: '50 year project duration',
maximumValue: 30,
minDurationLabel: '20 years minimum',
maxDurationLabel: '30 years',
},
{
duration: 50,
title: '50 year project duration',
maximumValue: 50,
maximumPrefix: '>',
minDurationLabel: '20 years minimum',
maxDurationLabel: '>50 years',
},
];

Expand All @@ -68,10 +75,7 @@ DurationStory.decorators = [
children={
<Duration
{...(DurationStory.args?.children?.props as any)}
title={values.title}
duration={values.duration}
maximumValue={values.maximumValue}
maximumPrefix={values.maximumPrefix}
{...values}
/>
}
/>
Expand Down
24 changes: 7 additions & 17 deletions web-components/src/components/cards/TebuCard/TebuCard.Duration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,19 @@ interface TebuCardDurationProps {
title: string;
minimumValue: number;
maximumValue: number;
minimumLabel: string;
durationUnitLabel: string;
tooltip?: string;
maximumPrefix?: string;
minDurationLabel: string;
maxDurationLabel: string;
}



const TebuCardDuration: React.FC<TebuCardDurationProps> = ({
title,
duration,
minimumValue,
maximumValue,
minimumLabel,
durationUnitLabel,
tooltip,
maximumPrefix,
minDurationLabel,
maxDurationLabel,
}) => {
return (
<div className="mb-[10px]">
Expand Down Expand Up @@ -56,21 +52,15 @@ const TebuCardDuration: React.FC<TebuCardDurationProps> = ({
</div>
<div className="relative w-full h-[2em] top-0">
<div
className="absolute text-[12px] text-right"
className="absolute text-[12px] text-right max-w-[90px]"
style={{
right: `${(1 - minimumValue / maximumValue) * 100}%`,
}}
>
<div>
{minimumValue} {durationUnitLabel}
</div>
<div>{minimumLabel}</div>
{minDurationLabel}
</div>
<div className="absolute text-[12px] text-right right-0">
<div>
{maximumPrefix}
{maximumValue} {durationUnitLabel}
</div>
<div>{maxDurationLabel}</div>
<div>
{tooltip && (
<InfoTooltip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export function getDurationCard(
const { factor } =
durationFactors.find(({ duration }) => years >= duration) ||
durationFactors[durationFactors.length - 1];
const maxDurationPrefix = maximumDuration === 50 ? '>' : '';

return (
<TebuCard
Expand All @@ -112,10 +113,16 @@ export function getDurationCard(
one: `${years} year project duration`,
other: `${years} year project duration`,
})}
minDurationLabel={plural(minimumDuration, {
one: `${minimumDuration} year minimum`,
other: `${minimumDuration} years minimum`,
})}
maxDurationLabel={plural(minimumDuration, {
one: `${maxDurationPrefix}${maximumDuration} year`,
other: `${maxDurationPrefix}${maximumDuration} years`,
})}
minimumValue={minimumDuration}
maximumValue={maximumDuration}
minimumLabel="minimum"
durationUnitLabel="years"
duration={years}
/>
</TebuCard>
Expand Down
48 changes: 28 additions & 20 deletions web-marketplace/src/lib/i18n/locales/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ msgstr ""
msgid "{from}–{displayedTo} of more than {to}"
msgstr ""

#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:120
msgid "{minimumDuration, plural, one {{maxDurationPrefix}{maximumDuration} year} other {{maxDurationPrefix}{maximumDuration} years}}"
msgstr ""

#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:116
msgid "{minimumDuration, plural, one {{minimumDuration} year minimum} other {{minimumDuration} years minimum}}"
msgstr ""

#: src/components/organisms/MediaForm/MediaFormPhotos.tsx:329
msgid "{remainingCaptionCharacters, plural, one {{remainingCaptionCharacters} character remaining} other {{remainingCaptionCharacters} characters remaining}}"
msgstr ""
Expand All @@ -101,7 +109,7 @@ msgstr ""
msgid "{remainingTitleCharacters, plural, one {{remainingTitleCharacters} character remaining} other {{remainingTitleCharacters} characters remaining}}"
msgstr ""

#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:111
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:112
msgid "{years, plural, one {{years} year project duration} other {{years} year project duration}}"
msgstr ""

Expand Down Expand Up @@ -581,7 +589,7 @@ msgstr ""
msgid "Are you sure you want to discard your changes?"
msgstr ""

#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:144
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:151
msgid "Area Actions"
msgstr ""

Expand Down Expand Up @@ -711,7 +719,7 @@ msgstr ""

#: src/components/molecules/ProjectPageMetadata/ProjectPageMetadata.tsx:159
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.ComplianceInfo.tsx:74
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.ComplianceInfo.tsx:98
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.ComplianceInfo.tsx:96
msgid "biome"
msgstr ""

Expand Down Expand Up @@ -1542,7 +1550,7 @@ msgstr ""

#: src/components/molecules/ProjectPageMetadata/ProjectPageMetadata.tsx:152
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.ComplianceInfo.tsx:55
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.ComplianceInfo.tsx:79
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.ComplianceInfo.tsx:77
msgid "department"
msgstr ""

Expand Down Expand Up @@ -1819,7 +1827,7 @@ msgstr ""

#: src/components/molecules/ProjectPageMetadata/ProjectPageMetadata.tsx:154
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.ComplianceInfo.tsx:60
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.ComplianceInfo.tsx:84
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.ComplianceInfo.tsx:82
msgid "environmental authority"
msgstr ""

Expand Down Expand Up @@ -1876,8 +1884,8 @@ msgstr ""

#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:39
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:71
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:105
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:185
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:106
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:192
msgid "Factor:"
msgstr ""

Expand Down Expand Up @@ -2943,11 +2951,11 @@ msgstr ""
msgid "Premontane humid forest"
msgstr ""

#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:162
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:169
msgid "Preservation"
msgstr ""

#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:154
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:161
msgid "Preservation Factor:"
msgstr ""

Expand Down Expand Up @@ -3138,7 +3146,7 @@ msgstr ""
msgid "Project documentation"
msgstr ""

#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:101
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:102
msgid "Project Duration"
msgstr ""

Expand Down Expand Up @@ -3246,11 +3254,11 @@ msgstr ""
msgid "Projects"
msgstr ""

#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:146
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:153
msgid "Projects must have a duration of at least 20 years to ensure demonstrable and quantifiable results in biodiversity. Tebu promotes projects that last longer, ensuring long term ecological processes."
msgstr ""

#: src/pages/Projects/Projects.tsx:222
#: src/pages/Projects/Projects.tsx:224
msgid "projects tabs"
msgstr ""

Expand Down Expand Up @@ -3362,7 +3370,7 @@ msgstr ""

#: src/components/molecules/ProjectPageMetadata/ProjectPageMetadata.tsx:151
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.ComplianceInfo.tsx:53
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.ComplianceInfo.tsx:77
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.ComplianceInfo.tsx:75
msgid "region"
msgstr ""

Expand Down Expand Up @@ -3436,11 +3444,11 @@ msgstr ""
msgid "Resources for Getting Started"
msgstr ""

#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:163
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:170
msgid "Restoration"
msgstr ""

#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:150
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:157
msgid "Restoration Factor:"
msgstr ""

Expand Down Expand Up @@ -3788,7 +3796,7 @@ msgstr ""
msgid "Social Accounts"
msgstr ""

#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:179
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:186
msgid "Social and Cultural Index"
msgstr ""

Expand Down Expand Up @@ -3819,7 +3827,7 @@ msgstr ""
msgid "Sorry, your transaction was not successful."
msgstr ""

#: src/pages/Projects/AllProjects/AllProjects.tsx:282
#: src/pages/Projects/AllProjects/AllProjects.tsx:288
msgid "Sort by:"
msgstr ""

Expand Down Expand Up @@ -3899,7 +3907,7 @@ msgstr ""

#: src/components/molecules/ProjectPageMetadata/ProjectPageMetadata.tsx:158
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.ComplianceInfo.tsx:70
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.ComplianceInfo.tsx:94
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.ComplianceInfo.tsx:92
msgid "sub-watershed"
msgstr ""

Expand Down Expand Up @@ -4046,7 +4054,7 @@ msgstr ""
msgid "The individual or organization that is in charge of managing the project and will appear on the project page."
msgstr ""

#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:181
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:188
msgid "The integration of local communities' knowledge, social structures, and equitable participation to ensure both ecosystem conservation and community benefits."
msgstr ""

Expand Down Expand Up @@ -4625,7 +4633,7 @@ msgstr ""

#: src/components/molecules/ProjectPageMetadata/ProjectPageMetadata.tsx:157
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.ComplianceInfo.tsx:65
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.ComplianceInfo.tsx:89
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.ComplianceInfo.tsx:87
msgid "watershed"
msgstr ""

Expand Down
Loading

0 comments on commit c5e5a6e

Please sign in to comment.