fix: translation key in revert published modal (#1628)

This commit is contained in:
Dan Ribbens
2022-12-09 09:35:40 -05:00
committed by GitHub
parent a44dba5ccc
commit b6c597ab5c
4 changed files with 12 additions and 4 deletions

View File

@@ -6,15 +6,13 @@ import { Props } from './types';
import ReactSelect from '../ReactSelect';
import sortableFieldTypes from '../../../../fields/sortableFieldTypes';
import { useSearchParams } from '../../utilities/SearchParams';
import { fieldAffectsData } from '../../../../fields/config/types';
import { fieldAffectsData, OptionObject } from '../../../../fields/config/types';
import { getTranslation } from '../../../../utilities/getTranslation';
import './index.scss';
const baseClass = 'sort-complex';
const sortOptions = [{ label: 'Ascending', value: '' }, { label: 'Descending', value: '-' }];
const SortComplex: React.FC<Props> = (props) => {
const {
collection,
@@ -25,6 +23,7 @@ const SortComplex: React.FC<Props> = (props) => {
const history = useHistory();
const params = useSearchParams();
const { t, i18n } = useTranslation('general');
const [sortOptions, setSortOptions] = useState<OptionObject[]>();
const [sortFields] = useState(() => collection.fields.reduce((fields, field) => {
if (fieldAffectsData(field) && sortableFieldTypes.indexOf(field.type) > -1) {
@@ -56,6 +55,10 @@ const SortComplex: React.FC<Props> = (props) => {
}
}, [history, params, sortField, sortOrder, modifySearchQuery, handleChange]);
useEffect(() => {
setSortOptions([{ label: t('ascending'), value: '' }, { label: t('descending'), value: '-' }]);
}, [i18n, t]);
return (
<div className={baseClass}>
<React.Fragment>

View File

@@ -174,7 +174,7 @@ const Status: React.FC<Props> = () => {
type="button"
onClick={processing ? undefined : () => toggleModal(revertModalSlug)}
>
{t('general:published')}
{t('general:cancel')}
</Button>
<Button
onClick={processing ? undefined : () => performAction('revert')}

View File

@@ -134,6 +134,7 @@
"addFilter": "Add Filter",
"adminTheme": "Admin Theme",
"and": "And",
"ascending": "Ascending",
"automatic": "Automatic",
"backToDashboard": "Back to Dashboard",
"cancel": "Cancel",

View File

@@ -533,6 +533,9 @@
"and": {
"type": "string"
},
"ascending": {
"type": "string"
},
"automatic": {
"type": "string"
},
@@ -789,6 +792,7 @@
"addFilter",
"adminTheme",
"and",
"ascending",
"automatic",
"backToDashboard",
"cancel",