1
0
Fork 0

fix(shared): Add translations to missing measurements string

This commit is contained in:
Benjamin Fan 2024-02-13 16:14:13 -08:00
parent cea7f520d4
commit 7ad6ef575d
2 changed files with 9 additions and 3 deletions

View file

@ -258,6 +258,8 @@ thankYouVeryMuch: Thank you very much
csetSuggestedMsg: Your submission has been registered and will be processed by one of our curators.
itIsAvailableAt: It is available at
csetNameMsg: Each curated set has a name. You can suggest your own name or a pseudonym.
missing: Missing
andMore: and more
patternNew: Generate a new pattern
patternNewInfo: Pick a design, add your measurements set, and we'll generate a bespoke sewing pattern for you.

View file

@ -124,6 +124,7 @@ export const MsetCard = ({
sm: 36,
}
const s = sizes[size]
const { t } = useTranslation(ns)
const wrapperProps = {
className: `bg-base-300 aspect-square h-${s} w-${s} mb-2
@ -155,10 +156,13 @@ export const MsetCard = ({
<NoIcon className={`${iconClasses} bg-error text-error-content`} stroke={3} />
)
if (missing.length > 0) {
let missingString = 'Missing: ' + missing.toString().replaceAll(',', ', ')
const translated = missing.map((m) => {
return t(m)
})
let missingString = t('missing') + ': ' + translated.join(', ')
if (missingString.length > maxLength) {
const lastSpace = missingString.lastIndexOf(' ', maxLength)
missingString = missingString.substring(0, lastSpace) + ' and more...'
const lastSpace = missingString.lastIndexOf(', ', maxLength)
missingString = missingString.substring(0, lastSpace) + ', ' + t('andMore') + '...'
}
const measieClasses = 'font-normal text-xs'
missingMeasies = <span className={`${measieClasses}`}>{missingString}</span>