Skip to content

Commit

Permalink
Fixed #133: Supported i18n for filter.
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineYANG committed Sep 22, 2022
1 parent 2100e28 commit de04deb
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
11 changes: 11 additions & 0 deletions packages/rath-client/public/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,17 @@
},
"extend": {
"title": "Extend Information"
},
"filter": {
"title": "Filter Config",
"active": "Filter",
"enable": "Enabled",
"disabled": "Disabled",
"key": "Filter by",
"range": "range",
"set": "set",
"submit": "Submit",
"cancel": "Cancel"
}
},
"meta": {
Expand Down
11 changes: 11 additions & 0 deletions packages/rath-client/public/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,17 @@
},
"extend": {
"title": "扩展信息"
},
"filter": {
"title": "筛选规则",
"active": "启用筛选",
"enable": "开启",
"disabled": "关闭",
"key": "筛选方式",
"range": "区间",
"set": "集合",
"submit": "应用",
"cancel": "取消"
}
},
"meta": {
Expand Down
18 changes: 9 additions & 9 deletions packages/rath-client/src/components/fieldFilter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ const FieldFilter: React.FC<FieldFilterProps> = props => {
>
<div style={{ padding: '1em', minWidth: '400px'}}>

<h2>Filter Config</h2>
<h2>{intl.get('dataSource.filter.title')}</h2>
<Toggle
onText='Apply'
offText='Disable'
label="Filter"
onText={intl.get('dataSource.filter.enabled')}
offText={intl.get('dataSource.filter.disabled')}
label={intl.get('dataSource.filter.active')}
checked={!filter.disable}
onChange={(e, checked) => {
setFilter(f => ({
Expand All @@ -110,10 +110,10 @@ const FieldFilter: React.FC<FieldFilterProps> = props => {
/>
<div>
<ChoiceGroup
label="Filter by"
label={intl.get('dataSource.filter.key')}
options={[
{ key: 'range', text: 'range' },
{ key: 'set', text: 'set'}
{ key: 'range', text: intl.get('dataSource.filter.range') },
{ key: 'set', text: intl.get('dataSource.filter.set')}
]}
selectedKey={filter.type}
onChange={(ev, op) => {
Expand Down Expand Up @@ -149,12 +149,12 @@ const FieldFilter: React.FC<FieldFilterProps> = props => {
}
<Stack horizontal>
<PrimaryButton
text="Submit"
text={intl.get('dataSource.filter.submit')}
onClick={submitFilter}
/>
<DefaultButton
style={{ marginLeft: '1em' }}
text="Cancel"
text={intl.get('dataSource.filter.cancel')}
onClick={toggleShowFilter}
/>
</Stack>
Expand Down

0 comments on commit de04deb

Please sign in to comment.