Skip to content

Commit 91a93ed

Browse files
fix(core): TRAC-277 translate Show more/less labels on product compare page
1 parent 37e0a7c commit 91a93ed

4 files changed

Lines changed: 16 additions & 2 deletions

File tree

core/app/[locale]/(default)/compare/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ export default async function Compare(props: Props) {
126126
previousLabel={t('previous')}
127127
products={streamableProducts}
128128
ratingLabel={t('rating')}
129+
showLessLabel={t('showLess')}
130+
showMoreLabel={t('showMore')}
129131
title={t('title')}
130132
viewOptionsLabel={t('viewOptions')}
131133
/>

core/messages/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,8 @@
444444
"otherDetails": "Other details",
445445
"noOtherDetails": "There are no other details.",
446446
"viewOptions": "View options",
447+
"showMore": "Show more",
448+
"showLess": "Show less",
447449
"successMessage": "{cartItems, plural, =1 {1 item} other {# items}} added to <cartLink> your cart</cartLink>",
448450
"missingCart": "Cart not found. Please try again later.",
449451
"unknownError": "Unknown error. Please try again later."

core/vibes/soul/primitives/compare-card/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ export interface CompareCardProps {
3333
noOtherDetailsLabel?: string;
3434
viewOptionsLabel?: string;
3535
preorderLabel?: string;
36+
showMoreLabel?: string;
37+
showLessLabel?: string;
3638
addToCartAction?: CompareAddToCartAction;
3739
imageSizes?: string;
3840
}
@@ -66,6 +68,8 @@ export function CompareCard({
6668
noOtherDetailsLabel = 'There are no other details.',
6769
viewOptionsLabel = 'View options',
6870
preorderLabel = 'Preorder',
71+
showMoreLabel = 'Show more',
72+
showLessLabel = 'Show less',
6973
imageSizes,
7074
}: CompareCardProps) {
7175
return (
@@ -110,7 +114,7 @@ export function CompareCard({
110114
{descriptionLabel}
111115
</div>
112116
{product.description != null && product.description !== '' ? (
113-
<Reveal>
117+
<Reveal hideLabel={showLessLabel} showLabel={showMoreLabel}>
114118
<div className="prose prose-sm [&>div>*:first-child]:mt-0">{product.description}</div>
115119
</Reveal>
116120
) : (
@@ -124,7 +128,7 @@ export function CompareCard({
124128
<div className="font-[family-name:var(--compare-card-font-family-secondary,var(--font-family-mono))] text-xs font-normal uppercase text-[var(--compare-card-label,hsl(var(--foreground)))]">
125129
{otherDetailsLabel}
126130
</div>
127-
<Reveal>
131+
<Reveal hideLabel={showLessLabel} showLabel={showMoreLabel}>
128132
<dl className="grid grid-cols-2 gap-1 text-xs font-normal text-[var(--compare-card-field,hsl(var(--foreground)))]">
129133
{product.customFields.map((field, index) => (
130134
<Fragment key={index}>

core/vibes/soul/sections/compare-section/index.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ interface CompareSectionProps {
3333
noOtherDetailsLabel?: string;
3434
viewOptionsLabel?: string;
3535
preorderLabel?: string;
36+
showMoreLabel?: string;
37+
showLessLabel?: string;
3638
placeholderCount?: number;
3739
addToCartAction?: CompareAddToCartAction;
3840
}
@@ -72,6 +74,8 @@ export function CompareSection({
7274
noOtherDetailsLabel,
7375
viewOptionsLabel,
7476
preorderLabel,
77+
showMoreLabel,
78+
showLessLabel,
7579
placeholderCount,
7680
}: CompareSectionProps) {
7781
return (
@@ -129,6 +133,8 @@ export function CompareSection({
129133
preorderLabel={preorderLabel}
130134
product={product}
131135
ratingLabel={ratingLabel}
136+
showLessLabel={showLessLabel}
137+
showMoreLabel={showMoreLabel}
132138
viewOptionsLabel={viewOptionsLabel}
133139
/>
134140
</CarouselItem>

0 commit comments

Comments
 (0)