Skip to content

Commit 402bcca

Browse files
committed
Add missing translations
1 parent bb4da72 commit 402bcca

File tree

7 files changed

+41
-4
lines changed

7 files changed

+41
-4
lines changed

cspell.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@
5555
"todo",
5656
"Usa",
5757
"tus",
58-
"menos"
58+
"menos",
59+
"desde",
60+
"hasta",
61+
"Agregar",
62+
"carrito",
63+
"para"
5964
]
6065
}

src/components/Filters/FilterRangeSlider.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import React, { useEffect, useState, useRef } from 'react';
22
import classNames from 'classnames';
33
import { PlpRangeFacet } from '../../types';
4+
import { translate } from '../../utils/helpers';
5+
import { useCioPlpContext } from '../../hooks/useCioPlpContext';
46

57
export interface FilterRangeSliderProps {
68
rangedFacet: PlpRangeFacet;
@@ -46,6 +48,7 @@ const COLLAPSED_TRACK_STYLE = { left: '0%', width: '100%' };
4648

4749
export default function FilterRangeSlider(props: FilterRangeSliderProps) {
4850
const { rangedFacet: facet, modifyRequestRangeFilter, isCollapsed, sliderStep = 0.1 } = props;
51+
const { translations } = useCioPlpContext();
4952
const visibleTrack = useRef<HTMLDivElement>(null);
5053
const [selectedTrackStyles, setSelectedTrackStyles] = useState({});
5154

@@ -193,7 +196,7 @@ export default function FilterRangeSlider(props: FilterRangeSliderProps) {
193196
<div className='cio-filter-ranged-slider'>
194197
<div className='cio-slider-inputs'>
195198
<span className='cio-slider-input cio-slider-input-min'>
196-
<span className='cio-slider-input-prefix'>from </span>
199+
<span className='cio-slider-input-prefix'>{translate('from', translations)} </span>
197200
<input
198201
required
199202
type='number'
@@ -208,7 +211,7 @@ export default function FilterRangeSlider(props: FilterRangeSliderProps) {
208211
/>
209212
</span>
210213
<div className='cio-slider-input cio-slider-input-max'>
211-
<span className='cio-slider-input-prefix'>to </span>
214+
<span className='cio-slider-input-prefix'>{translate('to', translations)} </span>
212215
<input
213216
required
214217
type='number'

src/components/ProductCard/ProductCard.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
getProductCardCnstrcDataAttributes,
99
getConversionButtonCnstrcDataAttributes,
1010
} from '../../utils';
11+
import { translate } from '../../utils/helpers';
1112
import RenderPropsWrapper from '../RenderPropsWrapper/RenderPropsWrapper';
1213
import { ProductCardProps } from '../../types';
1314
import { EMITTED_EVENTS } from '../../constants';
@@ -44,6 +45,7 @@ export default function ProductCard(props: ProductCardProps) {
4445
const onAddToCart = useOnAddToCart(client, state.callbacks.onAddToCart);
4546
const { formatPrice } = state.formatters;
4647
const onClick = useOnProductCardClick(client, state.callbacks.onProductCardClick);
48+
const { translations } = state;
4749

4850
const cnstrcDataAttrs = getProductCardCnstrcDataAttributes(productInfo, {
4951
labels: item.labels,
@@ -142,7 +144,7 @@ export default function ProductCard(props: ProductCardProps) {
142144
onClick={(e) =>
143145
onAddToCart(e, item, itemPrice, productSwatch?.selectedVariation?.variationId)
144146
}>
145-
Add to Cart
147+
{translate('Add to Cart', translations)}
146148
</button>
147149
</a>
148150
</RenderPropsWrapper>

src/constants.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,18 @@ All translation keys are optional - any non-provided translation will fallback t
2323
"By": "...",
2424
"Sort": "...",
2525
26+
// Range Filter
27+
"from": "...",
28+
"to": "...",
29+
2630
// Groups/Categories
2731
"Categories": "...",
2832
"Show All": "...",
2933
"Show Less": "...",
3034
35+
// Product Card
36+
"Add to Cart": "...",
37+
3138
// Zero Results
3239
"Sorry, we didn't find:": "...",
3340
"Sorry, we were unable to find what you were looking for.": "...",

src/stories/components/CioPlp/Translations Code Examples.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,18 @@ All keys are optional. Here are the translatable strings:
3434
"By": "By",
3535
"Sort": "Sort",
3636

37+
// Range Filter
38+
"from": "from",
39+
"to": "to",
40+
3741
// Groups/Categories
3842
"Categories": "Categories",
3943
"Show All": "Show All",
4044
"Show Less": "Show Less",
4145

46+
// Product Card
47+
"Add to Cart": "Add to Cart",
48+
4249
// Zero Results
4350
"Sorry, we didn't find:": "Sorry, we didn't find:",
4451
"Sorry, we were unable to find what you were looking for.": "Sorry, we were unable to find what you were looking for.",
@@ -71,9 +78,12 @@ export default function MyComponent() {
7178
'Sort by:': 'Ordenar por:',
7279
By: 'Por',
7380
Sort: 'Ordenar',
81+
from: 'desde',
82+
to: 'hasta',
7483
Categories: 'Categorias',
7584
'Show All': 'Mostrar todo',
7685
'Show Less': 'Mostrar menos',
86+
'Add to Cart': 'Agregar al carrito',
7787
"Sorry, we didn't find:": 'Lo sentimos, no encontramos:',
7888
'Sorry, we were unable to find what you were looking for.':
7989
'Lo sentimos, no pudimos encontrar lo que buscabas.',

src/stories/components/CioPlp/Translations.stories.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,12 @@ function TranslationsStory({ defaultUrl }: any) {
5151
'Sort by:': 'Ordenar por:',
5252
By: 'Por',
5353
Sort: 'Ordenar',
54+
from: 'desde',
55+
to: 'hasta',
5456
Categories: 'Categorias',
5557
'Show All': 'Mostrar todo',
5658
'Show Less': 'Mostrar menos',
59+
'Add to Cart': 'Agregar al carrito',
5760
"Sorry, we didn't find:": 'Lo sentimos, no encontramos:',
5861
'Sorry, we were unable to find what you were looking for.':
5962
'Lo sentimos, no pudimos encontrar lo que buscabas.',

src/types.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ export type Translations = {
8080
'Show All'?: string;
8181
'Show Less'?: string;
8282

83+
// Range Filter
84+
from?: string;
85+
to?: string;
86+
87+
// Product Card
88+
'Add to Cart'?: string;
89+
8390
// Zero Results
8491
"Sorry, we didn't find:"?: string;
8592
'Sorry, we were unable to find what you were looking for.'?: string;

0 commit comments

Comments
 (0)