Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1921823: Internationalize CheckBoxControls #7970

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
56 changes: 29 additions & 27 deletions frontend/public/components/row-filter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as React from 'react';
import { connect } from 'react-redux';
import * as classNames from 'classnames';
import { Button } from '@patternfly/react-core';
import { useTranslation } from 'react-i18next';

import { filterList } from '../actions/k8s';
import { getQueryArgument, setQueryArgument } from './utils';
Expand All @@ -27,36 +28,37 @@ export const CheckBoxControls = ({
selectedCount,
onSelectAll,
children,
}) => (
<div className="row">
<div className="col-xs-12">
<div className="row-filter">
{children}
<div className="co-m-row-filter__controls">
<Button
className="co-m-row-filter__selector"
disabled={allSelected}
type="button"
onClick={onSelectAll}
variant="link"
>
Select all filters
</Button>
<span className="co-m-row-filter__items">
{itemCount === selectedCount ? (
itemCount
) : (
<>
{selectedCount} of {itemCount}
</>
)}{' '}
Item{itemCount !== 1 && 's'}
</span>
}) => {
const { t } = useTranslation();
return (
<div className="row">
<div className="col-xs-12">
<div className="row-filter">
{children}
<div className="co-m-row-filter__controls">
<Button
className="co-m-row-filter__selector"
disabled={allSelected}
type="button"
onClick={onSelectAll}
variant="link"
>
{t('public~Select all filters')}
</Button>
<span className="co-m-row-filter__items">
{itemCount === selectedCount ? (
itemCount
) : (
<>{t('public~{{selectedCount}} of {{itemCount}}', { selectedCount, itemCount })}</>
)}{' '}
{t('public~Item', { count: itemCount })}
</span>
</div>
</div>
</div>
</div>
</div>
);
);
};

export const storagePrefix = 'rowFilter-';

Expand Down
4 changes: 4 additions & 0 deletions frontend/public/locales/en/public.json
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,10 @@
"ReplicationController details": "ReplicationController details",
"Phase": "Phase",
"{{statusReplicas}} of {{specReplicas}} pods": "{{statusReplicas}} of {{specReplicas}} pods",
"Select all filters": "Select all filters",
"{{selectedCount}} of {{itemCount}}": "{{selectedCount}} of {{itemCount}}",
"Item": "Item",
"Item_plural": "Items",
"Add Secret to workload": "Add Secret to workload",
"Edit Secret": "Edit Secret",
"Secret details": "Secret details",
Expand Down