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 Dec 3, 2024
1 parent 8fe3c9c commit e84d134
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 57 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
32 changes: 20 additions & 12 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 @@ -1884,8 +1892,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 @@ -2952,11 +2960,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 @@ -3147,7 +3155,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 @@ -3255,7 +3263,7 @@ 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 ""

Expand Down Expand Up @@ -3445,11 +3453,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 @@ -3797,7 +3805,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 @@ -4055,7 +4063,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
38 changes: 19 additions & 19 deletions web-marketplace/src/lib/i18n/locales/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,13 @@ msgstr "{from}–{displayedTo} de {count}"
msgid "{from}–{displayedTo} of more than {to}"
msgstr "{from}–{displayedTo} de más de {to}"

#: src/components/organisms/BuyCreditsModal/BuyCreditsModal.utils.tsx:85
#~ msgid "{price} {displayDenom}/credit:"
#~ msgstr "{precio} {displayDenom}/crédito:"
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:120
msgid "{minimumDuration, plural, one {{maxDurationPrefix}{maximumDuration} year} other {{maxDurationPrefix}{maximumDuration} years}}"
msgstr "{minimumDuration, plural, one {{maxDurationPrefix}{maximumDuration} año} other {{maxDurationPrefix}{maximumDuration} años}}"

#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:116
msgid "{minimumDuration, plural, one {{minimumDuration} year minimum} other {{minimumDuration} years minimum}}"
msgstr "{minimumDuration, plural, one {{minimumDuration} año mínimo} other {{minimumDuration} años mínimo}}"

#: src/components/organisms/MediaForm/MediaFormPhotos.tsx:329
msgid "{remainingCaptionCharacters, plural, one {{remainingCaptionCharacters} character remaining} other {{remainingCaptionCharacters} characters remaining}}"
Expand Down Expand Up @@ -111,11 +115,7 @@ msgstr "{remainingSummaryCharacters, plural, one {{remainingSummaryCharacters} c
msgid "{remainingTitleCharacters, plural, one {{remainingTitleCharacters} character remaining} other {{remainingTitleCharacters} characters remaining}}"
msgstr "{remainingTitleCharacters, plural, one {{remainingTitleCharacters} carácter restante} other {{remainingTitleCharacters} caracteres restantes}}"

#: src/components/organisms/BuyCreditsModal/BuyCreditsModal.utils.tsx:90
#~ msgid "{truncatedQuantity} credit(s) available"
#~ msgstr "{truncatedQuantity} crédito(s) disponible(s)"

#: 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 "{years, plural, one {Duración del proyecto: {years} año} other {Duración del proyecto: {years} años}}"

Expand Down Expand Up @@ -587,7 +587,7 @@ msgstr "¿Estás seguro de que deseas eliminar esta publicación?"
msgid "Are you sure you want to discard your changes?"
msgstr "¿Está seguro de que desea descartar los cambios?"

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

Expand Down Expand Up @@ -1910,8 +1910,8 @@ msgstr "factor"

#: 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 "Factor:"

Expand Down Expand Up @@ -2990,11 +2990,11 @@ msgstr "prefinanciar este proyecto"
msgid "Premontane humid forest"
msgstr "Bosque húmedo premontano"

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

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

Expand Down Expand Up @@ -3185,7 +3185,7 @@ msgstr "Desarrollador de proyectos"
msgid "Project documentation"
msgstr "Documentación del proyecto"

#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:101
#: src/components/templates/ProjectDetails/TerrasosCreditsInfo/TerrasosCreditsInfo.utils.tsx:102
msgid "Project Duration"
msgstr "Duración del proyecto"

Expand Down Expand Up @@ -3293,7 +3293,7 @@ msgstr "PROYECTADO:"
msgid "Projects"
msgstr "Proyectos"

#: 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 "Los proyectos deben tener una duración de al menos 20 años para garantizar resultados demostrables y cuantificables en biodiversidad. Tebu promueve proyectos que duren más tiempo, asegurando procesos ecológicos a largo plazo."

Expand Down Expand Up @@ -3487,11 +3487,11 @@ msgstr "Recursos"
msgid "Resources for Getting Started"
msgstr "Recursos para empezar"

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

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

Expand Down Expand Up @@ -3843,7 +3843,7 @@ msgstr "Pequeña o mediana empresa"
msgid "Social Accounts"
msgstr "Cuentas sociales"

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

Expand Down Expand Up @@ -4104,7 +4104,7 @@ msgstr "La dirección de correo electrónico que está utilizando para iniciar s
msgid "The individual or organization that is in charge of managing the project and will appear on the project page."
msgstr "La persona u organización que está a cargo de administrar el proyecto y aparecerá en la página del proyecto."

#: 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 "La integración del conocimiento de las comunidades locales, las estructuras sociales y la participación equitativa para garantizar tanto la conservación del ecosistema como los beneficios comunitarios."

Expand Down

0 comments on commit e84d134

Please sign in to comment.