Skip to content

Commit

Permalink
Implement translations for singular and plural cases
Browse files Browse the repository at this point in the history
  • Loading branch information
kgabryje committed May 21, 2021
1 parent 371419f commit 2ce2e71
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* under the License.
*/
import React, { useState } from 'react';
import { tn } from '@superset-ui/core';
import { ColumnMeta } from '@superset-ui/chart-controls';
import { isEmpty } from 'lodash';
import { LabelProps } from 'src/explore/components/controls/DndColumnSelectControl/types';
Expand Down Expand Up @@ -79,6 +80,7 @@ export const DndColumnSelect = (props: LabelProps) => {
valuesRenderer={valuesRenderer}
accept={DndItemType.Column}
displayGhostButton={multi || optionSelector.values.length === 0}
ghostButtonText={tn('Drop column', 'Drop columns', multi ? 2 : 1)}
{...props}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { ensureIsArray, Metric, t } from '@superset-ui/core';
import { ensureIsArray, Metric, tn } from '@superset-ui/core';
import { ColumnMeta } from '@superset-ui/chart-controls';
import { isEqual } from 'lodash';
import { usePrevious } from 'src/common/hooks/usePrevious';
Expand Down Expand Up @@ -268,7 +268,11 @@ export const DndMetricSelect = (props: any) => {
canDrop={canDrop}
valuesRenderer={valuesRenderer}
accept={[DndItemType.Column, DndItemType.Metric]}
ghostButtonText={t('Drop columns or metrics')}
ghostButtonText={tn(
'Drop column or metric',
'Drop columns or metrics',
multi ? 2 : 1,
)}
displayGhostButton={multi || value.length === 0}
{...props}
/>
Expand Down

0 comments on commit 2ce2e71

Please sign in to comment.