mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[i18n] Index Management translate missing labels (#28816)
* Translate missing translations in index management * Resolve review comments * Refactor translations * Resolve review comments
This commit is contained in:
parent
6c47f10a3c
commit
aef9562807
1 changed files with 62 additions and 88 deletions
|
@ -62,16 +62,14 @@ class IndexActionsContextMenuUi extends Component {
|
|||
const allOpen = all(indexNames, indexName => {
|
||||
return indexStatusByName[indexName] === INDEX_OPEN;
|
||||
});
|
||||
const oneIndexSelected = this.oneIndexSelected();
|
||||
const entity = this.getEntity(oneIndexSelected);
|
||||
const entityUpper = `${entity[0].toUpperCase()}${entity.slice(1)}`;
|
||||
const selectedIndexCount = indexNames.length;
|
||||
const items = [];
|
||||
if (!detailPanel && oneIndexSelected) {
|
||||
if (!detailPanel && selectedIndexCount === 1) {
|
||||
items.push({
|
||||
name: intl.formatMessage({
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.showEntitySettingsLabel',
|
||||
defaultMessage: 'Show {entity} settings',
|
||||
}, { entity }),
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.showIndexSettingsLabel',
|
||||
defaultMessage: 'Show {selectedIndexCount, plural, one {index} other {indices} } settings',
|
||||
}, { selectedIndexCount }),
|
||||
icon: <EuiIcon type="indexSettings" />,
|
||||
onClick: () => {
|
||||
this.closePopoverAndExecute(showSettings);
|
||||
|
@ -79,9 +77,9 @@ class IndexActionsContextMenuUi extends Component {
|
|||
});
|
||||
items.push({
|
||||
name: intl.formatMessage({
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.showEntityMappingLabel',
|
||||
defaultMessage: 'Show {entity} mapping',
|
||||
}, { entity }),
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.showIndexMappingLabel',
|
||||
defaultMessage: 'Show {selectedIndexCount, plural, one {index} other {indices} } mapping',
|
||||
}, { selectedIndexCount }),
|
||||
icon: <EuiIcon type="indexMapping" />,
|
||||
onClick: () => {
|
||||
this.closePopoverAndExecute(showMapping);
|
||||
|
@ -90,9 +88,9 @@ class IndexActionsContextMenuUi extends Component {
|
|||
if (allOpen) {
|
||||
items.push({
|
||||
name: intl.formatMessage({
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.showEntityStatsLabel',
|
||||
defaultMessage: 'Show {entity} stats',
|
||||
}, { entity }),
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.showIndexStatsLabel',
|
||||
defaultMessage: 'Show {selectedIndexCount, plural, one {index} other {indices} } stats',
|
||||
}, { selectedIndexCount }),
|
||||
icon: <EuiIcon type="stats" />,
|
||||
onClick: () => {
|
||||
this.closePopoverAndExecute(showStats);
|
||||
|
@ -101,9 +99,9 @@ class IndexActionsContextMenuUi extends Component {
|
|||
}
|
||||
items.push({
|
||||
name: intl.formatMessage({
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.editEntitySettingsLabel',
|
||||
defaultMessage: 'Edit {entity} settings',
|
||||
}, { entity }),
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.editIndexSettingsLabel',
|
||||
defaultMessage: 'Edit {selectedIndexCount, plural, one {index} other {indices} } settings',
|
||||
}, { selectedIndexCount }),
|
||||
icon: <EuiIcon type="indexEdit" />,
|
||||
onClick: () => {
|
||||
this.closePopoverAndExecute(editIndex);
|
||||
|
@ -113,9 +111,9 @@ class IndexActionsContextMenuUi extends Component {
|
|||
if (allOpen) {
|
||||
items.push({
|
||||
name: intl.formatMessage({
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.closeEntityLabel',
|
||||
defaultMessage: 'Close {entity}',
|
||||
}, { entity }),
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.closeIndexLabel',
|
||||
defaultMessage: 'Close {selectedIndexCount, plural, one {index} other {indices} }',
|
||||
}, { selectedIndexCount }),
|
||||
icon: <EuiIcon type="indexClose" />,
|
||||
onClick: () => {
|
||||
this.closePopoverAndExecute(closeIndices);
|
||||
|
@ -123,9 +121,9 @@ class IndexActionsContextMenuUi extends Component {
|
|||
});
|
||||
items.push({
|
||||
name: intl.formatMessage({
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.forceMergeEntityLabel',
|
||||
defaultMessage: 'Force merge {entity}',
|
||||
}, { entity }),
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.forceMergeIndexLabel',
|
||||
defaultMessage: 'Force merge {selectedIndexCount, plural, one {index} other {indices} }',
|
||||
}, { selectedIndexCount }),
|
||||
icon: <EuiIcon type="merge" />,
|
||||
onClick: () => {
|
||||
this.closePopover();
|
||||
|
@ -134,9 +132,9 @@ class IndexActionsContextMenuUi extends Component {
|
|||
});
|
||||
items.push({
|
||||
name: intl.formatMessage({
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.refreshEntityLabel',
|
||||
defaultMessage: 'Refresh {entity}',
|
||||
}, { entity }),
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.refreshIndexLabel',
|
||||
defaultMessage: 'Refresh {selectedIndexCount, plural, one {index} other {indices} }',
|
||||
}, { selectedIndexCount }),
|
||||
icon: <EuiIcon type="refresh" />,
|
||||
onClick: () => {
|
||||
this.closePopoverAndExecute(refreshIndices);
|
||||
|
@ -144,9 +142,9 @@ class IndexActionsContextMenuUi extends Component {
|
|||
});
|
||||
items.push({
|
||||
name: intl.formatMessage({
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.clearEntityCacheLabel',
|
||||
defaultMessage: 'Clear {entity} cache',
|
||||
}, { entity }),
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.clearIndexCacheLabel',
|
||||
defaultMessage: 'Clear {selectedIndexCount, plural, one {index} other {indices} } cache',
|
||||
}, { selectedIndexCount }),
|
||||
icon: <EuiIcon type="broom" />,
|
||||
onClick: () => {
|
||||
this.closePopoverAndExecute(clearCacheIndices);
|
||||
|
@ -154,9 +152,9 @@ class IndexActionsContextMenuUi extends Component {
|
|||
});
|
||||
items.push({
|
||||
name: intl.formatMessage({
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.flushEntityLabel',
|
||||
defaultMessage: 'Flush {entity}',
|
||||
}, { entity }),
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.flushIndexLabel',
|
||||
defaultMessage: 'Flush {selectedIndexCount, plural, one {index} other {indices} }',
|
||||
}, { selectedIndexCount }),
|
||||
icon: <EuiIcon type="indexFlush" />,
|
||||
onClick: () => {
|
||||
this.closePopoverAndExecute(flushIndices);
|
||||
|
@ -165,9 +163,9 @@ class IndexActionsContextMenuUi extends Component {
|
|||
} else {
|
||||
items.push({
|
||||
name: intl.formatMessage({
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.openEntityLabel',
|
||||
defaultMessage: 'Open {entity}',
|
||||
}, { entity }),
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.openIndexLabel',
|
||||
defaultMessage: 'Open {selectedIndexCount, plural, one {index} other {indices} }',
|
||||
}, { selectedIndexCount }),
|
||||
icon: <EuiIcon type="indexOpen" />,
|
||||
onClick: () => {
|
||||
this.closePopoverAndExecute(openIndices);
|
||||
|
@ -176,9 +174,9 @@ class IndexActionsContextMenuUi extends Component {
|
|||
}
|
||||
items.push({
|
||||
name: intl.formatMessage({
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.deleteEntityLabel',
|
||||
defaultMessage: 'Delete {entity}',
|
||||
}, { entity }),
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.deleteIndexLabel',
|
||||
defaultMessage: 'Delete {selectedIndexCount, plural, one {index} other {indices} }',
|
||||
}, { selectedIndexCount }),
|
||||
icon: <EuiIcon type="trash" />,
|
||||
onClick: () => {
|
||||
this.closePopover();
|
||||
|
@ -218,8 +216,8 @@ class IndexActionsContextMenuUi extends Component {
|
|||
id: 0,
|
||||
title: intl.formatMessage({
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.panelTitle',
|
||||
defaultMessage: '{entityUpper} options',
|
||||
}, { entityUpper }),
|
||||
defaultMessage: '{selectedIndexCount, plural, one {Index} other {Indices} } options',
|
||||
}, { selectedIndexCount }),
|
||||
items
|
||||
};
|
||||
return flattenPanelTree(panelTree);
|
||||
|
@ -264,8 +262,8 @@ class IndexActionsContextMenuUi extends Component {
|
|||
id: 'xpack.idxMgmt.indexActionsMenu.forceMerge.forceMergeSegmentsHelpText',
|
||||
defaultMessage: 'Merge the segments in an index until the number is reduced to this or fewer segments. The default is 1.',
|
||||
});
|
||||
const oneIndexSelected = this.oneIndexSelected();
|
||||
const entity = this.getEntity(oneIndexSelected);
|
||||
const selectedIndexCount = indexNames.length;
|
||||
|
||||
return (
|
||||
<EuiOverlayMask>
|
||||
<EuiConfirmModal
|
||||
|
@ -302,11 +300,9 @@ class IndexActionsContextMenuUi extends Component {
|
|||
<p>
|
||||
<FormattedMessage
|
||||
id="xpack.idxMgmt.indexActionsMenu.forceMerge.forceMergeDescription"
|
||||
defaultMessage="You are about to force merge {oneIndexSelected, plural, one {this} other {these}}"
|
||||
values={{ oneIndexSelected: oneIndexSelected ? 1 : 0 }}
|
||||
defaultMessage="You are about to force merge {selectedIndexCount, plural, one {this index} other {these indices} }:"
|
||||
values={{ selectedIndexCount }}
|
||||
/>
|
||||
{' '}
|
||||
{entity}:
|
||||
</p>
|
||||
<ul>
|
||||
{indexNames.map(indexName => (
|
||||
|
@ -359,29 +355,28 @@ class IndexActionsContextMenuUi extends Component {
|
|||
};
|
||||
|
||||
renderConfirmDeleteModal = () => {
|
||||
const oneIndexSelected = this.oneIndexSelected();
|
||||
const entity = this.getEntity(oneIndexSelected);
|
||||
const { deleteIndices, indexNames, intl } = this.props;
|
||||
const selectedIndexCount = indexNames.length;
|
||||
return (
|
||||
<EuiOverlayMask>
|
||||
<EuiConfirmModal
|
||||
title={
|
||||
intl.formatMessage({
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.deleteEntity.confirmModal.modalTitle',
|
||||
defaultMessage: 'Confirm Delete {entity}',
|
||||
}, { entity })
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.deleteIndex.confirmModal.modalTitle',
|
||||
defaultMessage: 'Confirm delete {selectedIndexCount, plural, one {index} other {indices} }',
|
||||
}, { selectedIndexCount })
|
||||
}
|
||||
onCancel={this.closeConfirmModal}
|
||||
onConfirm={() => this.closePopoverAndExecute(deleteIndices)}
|
||||
cancelButtonText={
|
||||
intl.formatMessage({
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.deleteEntity.confirmModal.cancelButtonText',
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.deleteIndex.confirmModal.cancelButtonText',
|
||||
defaultMessage: 'Cancel',
|
||||
})
|
||||
}
|
||||
confirmButtonText={
|
||||
intl.formatMessage({
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.deleteEntity.confirmModal.confirmButtonText',
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.deleteIndex.confirmModal.confirmButtonText',
|
||||
defaultMessage: 'Confirm',
|
||||
})
|
||||
}
|
||||
|
@ -389,12 +384,10 @@ class IndexActionsContextMenuUi extends Component {
|
|||
<div>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="xpack.idxMgmt.indexActionsMenu.deleteEntity.deleteDescription"
|
||||
defaultMessage="You are about to delete {oneIndexSelected, plural, one {this} other {these}}"
|
||||
values={{ oneIndexSelected: oneIndexSelected ? 1 : 0 }}
|
||||
id="xpack.idxMgmt.indexActionsMenu.deleteIndex.deleteDescription"
|
||||
defaultMessage="You are about to delete {selectedIndexCount, plural, one {this index} other {these indices} }:"
|
||||
values={{ selectedIndexCount }}
|
||||
/>
|
||||
{' '}
|
||||
{entity}:
|
||||
</p>
|
||||
<ul>
|
||||
{indexNames.map(indexName => (
|
||||
|
@ -404,7 +397,7 @@ class IndexActionsContextMenuUi extends Component {
|
|||
<EuiCallOut
|
||||
title={
|
||||
intl.formatMessage({
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.deleteEntity.proceedWithCautionCallOutTitle',
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.deleteIndex.proceedWithCautionCallOutTitle',
|
||||
defaultMessage: 'Proceed with caution!',
|
||||
})
|
||||
}
|
||||
|
@ -413,11 +406,8 @@ class IndexActionsContextMenuUi extends Component {
|
|||
>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="xpack.idxMgmt.indexActionsMenu.deleteEntity.deleteEntityWarningDescription"
|
||||
defaultMessage="
|
||||
This operation cannot be undone. Make sure you have appropriate
|
||||
backups.
|
||||
"
|
||||
id="xpack.idxMgmt.indexActionsMenu.deleteIndex.deleteWarningDescription"
|
||||
defaultMessage="This operation cannot be undone. Make sure you have appropriate backups."
|
||||
/>
|
||||
</p>
|
||||
</EuiCallOut>
|
||||
|
@ -426,43 +416,27 @@ class IndexActionsContextMenuUi extends Component {
|
|||
</EuiOverlayMask>
|
||||
);
|
||||
};
|
||||
oneIndexSelected = () => {
|
||||
return this.props.indexNames.length === 1;
|
||||
};
|
||||
getEntity = oneIndexSelected => {
|
||||
const { intl } = this.props;
|
||||
return oneIndexSelected ? (
|
||||
intl.formatMessage({
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.indexMessage',
|
||||
defaultMessage: 'index'
|
||||
})
|
||||
) : (
|
||||
intl.formatMessage({
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.indicesMessage',
|
||||
defaultMessage: 'indices'
|
||||
})
|
||||
);
|
||||
};
|
||||
render() {
|
||||
const { intl } = this.props;
|
||||
const indexNamesLength = this.props.indexNames.length;
|
||||
const { indexNames, intl } = this.props;
|
||||
const selectedIndexCount = indexNames.length;
|
||||
const {
|
||||
iconSide = 'right',
|
||||
anchorPosition = 'rightUp',
|
||||
label = intl.formatMessage({
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.manageButtonLabel',
|
||||
defaultMessage: 'Manage {indexNamesLength, plural, one {index} other {indices}}',
|
||||
}, { indexNamesLength }),
|
||||
defaultMessage: 'Manage {selectedIndexCount, plural, one {index} other {indices}}',
|
||||
}, { selectedIndexCount }),
|
||||
iconType = 'arrowDown'
|
||||
} = this.props;
|
||||
const panels = this.panels();
|
||||
const oneIndexSelected = this.oneIndexSelected();
|
||||
const entity = this.getEntity(oneIndexSelected);
|
||||
const button = (
|
||||
<EuiButton
|
||||
data-test-subj="indexActionsContextMenuButton"
|
||||
iconSide={iconSide}
|
||||
aria-label={`${entity} options`}
|
||||
aria-label={intl.formatMessage({
|
||||
id: 'xpack.idxMgmt.indexActionsMenu.manageButtonAriaLabel',
|
||||
defaultMessage: '{selectedIndexCount, plural, one {index} other {indices} } options',
|
||||
}, { selectedIndexCount })}
|
||||
onClick={this.onButtonClick}
|
||||
iconType={iconType}
|
||||
fill
|
||||
|
@ -475,7 +449,7 @@ class IndexActionsContextMenuUi extends Component {
|
|||
<div>
|
||||
{this.state.renderConfirmModal ? this.state.renderConfirmModal(this.closeConfirmModal, getHttpClient()) : null}
|
||||
<EuiPopover
|
||||
id={`contextMenu${entity}`}
|
||||
id="contextMenuIndices"
|
||||
button={button}
|
||||
isOpen={this.state.isPopoverOpen}
|
||||
closePopover={this.closePopover}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue