Skip to content

Commit 45c3b29

Browse files
committed
feat: i18n keys
1 parent e874eec commit 45c3b29

6 files changed

Lines changed: 16 additions & 4 deletions

File tree

packages/app-builder/src/locales/ar/filters.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
"clear_filters": "مسح الفلاتر",
3+
"ds.addNewFilter.label": "إضافة فلتر جديد",
4+
"ds.chooseFilter.label": "اختر فلتر",
5+
"ds.noOptionsAvailable.label": "لا يوجد خيارات متاحة",
36
"filters": "الفلاتر",
47
"new_filter": "فلتر جدبد",
58
"up_to": "حتى {{date}}"

packages/app-builder/src/locales/en/filters.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
"clear_filters": "clear filters",
3+
"ds.addNewFilter.label": "Add new filter",
4+
"ds.chooseFilter.label": "Choose a filter",
5+
"ds.noOptionsAvailable.label": "No options available",
36
"filters": "filters",
47
"new_filter": "new filter",
58
"up_to": "up to {{duration}}"

packages/app-builder/src/locales/fr/filters.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
"clear_filters": "effacer les filtres",
3+
"ds.addNewFilter.label": "Ajouter un nouveau filtre",
4+
"ds.chooseFilter.label": "Choisir un filtre",
5+
"ds.noOptionsAvailable.label": "Aucune option disponible",
36
"filters": "filtres",
47
"new_filter": "nouveau filtre",
58
"up_to": "jusqu'à {{duration}}"

packages/ui-design-system/src/FiltersBar/FiltersBar.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { useMemo, useState } from 'react';
22
import { match } from 'ts-pattern';
33
import { ButtonV2 } from '../Button/Button';
44
import { Checkbox } from '../Checkbox/Checkbox';
5+
import { useI18n } from '../contexts/I18nContext';
56
import { Modal } from '../Modal/Modal';
67
import { cn } from '../utils';
78
import { BooleanValueFilter } from './internals/BooleanValueFilter';
@@ -46,6 +47,7 @@ export function FiltersBar({
4647
active = [],
4748
onChange,
4849
}: FiltersBarProps) {
50+
const { t } = useI18n();
4951
const [isAddModalOpen, setAddModalOpen] = useState(false);
5052

5153
const contextValue = useMemo<FiltersBarContextValue>(() => {
@@ -195,11 +197,11 @@ export function FiltersBar({
195197
{level === 'additional' && (
196198
<>
197199
<ButtonV2 variant="secondary" onClick={() => setAddModalOpen(true)}>
198-
Add new filter
200+
{t('filters:ds.addNewFilter.label')}
199201
</ButtonV2>
200202
<Modal.Root open={isAddModalOpen} onOpenChange={setAddModalOpen}>
201203
<Modal.Content size="small">
202-
<Modal.Title>Choose a filter</Modal.Title>
204+
<Modal.Title>{t('filters:ds.chooseFilter.label')}</Modal.Title>
203205
<div className="p-4 grid grid-cols-1 gap-2">
204206
{dynamicDescriptors
205207
.filter((d) => !active.includes(d.name))

packages/ui-design-system/src/FiltersBar/internals/SelectOptionFilter.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import { useEffect, useState } from 'react';
22
import { Button } from '../../Button/Button';
3+
import { useI18n } from '../../contexts/I18nContext';
34
import { MenuCommand } from '../../MenuCommand/MenuCommand';
45
import { type SelectFilter } from '../types';
56
import { useFiltersBarContext } from './FiltersBarContext';
67

78
export function SelectOptionFilter(props: SelectFilter) {
9+
const { t } = useI18n();
810
const { options, placeholder, selectedValue, name } = props;
911
const { emitSet } = useFiltersBarContext();
1012
const [internalSelectedValue, setInternalSelectedValue] = useState<string>(
@@ -61,7 +63,7 @@ export function SelectOptionFilter(props: SelectFilter) {
6163
);
6264
})
6365
) : (
64-
<MenuCommand.Empty>No options available</MenuCommand.Empty>
66+
<MenuCommand.Empty>{t('filters:ds.noOptionsAvailable.label')}</MenuCommand.Empty>
6567
)}
6668
</MenuCommand.List>
6769
</MenuCommand.Content>

packages/ui-design-system/src/FiltersBar/types.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ export type FilterBarLevel = 'main' | 'additional';
44

55
export type CommittedDynamicValues = Record<string, unknown>;
66

7-
// Legacy internal filter data shape used for rendering
87
export interface BaseFilter<T> {
98
name: string;
109
placeholder: string;

0 commit comments

Comments
 (0)