mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[i18n] Translate ML - items grid and item select (#28236)
* Translate item_select * Translate items_grid
This commit is contained in:
parent
0c85bef82b
commit
7c4710b7e2
4 changed files with 32 additions and 4 deletions
|
@ -14,7 +14,7 @@
|
|||
<ui-select-choices
|
||||
repeat="item in mlItemSelect.allItems | filter: { id: $select.search }"
|
||||
>
|
||||
<div ng-if="item.isTag" class="select-item" ng-bind-html="(item.id | highlight: $select.search) +' <small>'+ (mlItemSelect.taggingText === undefined ? '(new item)' : mlItemSelect.taggingText) +'</small>'"></div>
|
||||
<div ng-if="item.isTag" class="select-item" ng-bind-html="(item.id | highlight: $select.search) +' <small>'+ (mlItemSelect.taggingText === undefined ? mlItemSelect.newItemLabel : mlItemSelect.taggingText) +'</small>'"></div>
|
||||
<div ng-if="!item.isTag" class="select-item" >
|
||||
<div ng-bind-html="item.id | highlight: $select.search"></div>
|
||||
<small ng-if="item.extra!==undefined">
|
||||
|
|
|
@ -10,6 +10,7 @@ import template from './item_select.html';
|
|||
|
||||
import { InitAfterBindingsWorkaround } from 'ui/compat';
|
||||
import { uiModules } from 'ui/modules';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
const module = uiModules.get('apps/ml');
|
||||
|
||||
module.directive('mlItemSelect', function () {
|
||||
|
@ -28,6 +29,10 @@ module.directive('mlItemSelect', function () {
|
|||
controllerAs: 'mlItemSelect',
|
||||
bindToController: true,
|
||||
controller: class MlItemSelectController extends InitAfterBindingsWorkaround {
|
||||
constructor() {
|
||||
this.newItemLabel = i18n.translate('xpack.ml.itemSelect.newItemLabel', { defaultMessage: '(new item)' });
|
||||
}
|
||||
|
||||
initAfterBindings($scope) {
|
||||
this.$scope = $scope;
|
||||
this.selectedItems = [];
|
||||
|
|
|
@ -22,6 +22,8 @@ import {
|
|||
|
||||
import { ItemsGridPagination } from './items_grid_pagination';
|
||||
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
|
||||
export function ItemsGrid({
|
||||
numberColumns,
|
||||
totalItemCount,
|
||||
|
@ -39,7 +41,18 @@ export function ItemsGrid({
|
|||
<EuiFlexGroup justifyContent="spaceAround">
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiText>
|
||||
<h4>{(totalItemCount === 0) ? 'No items have been added' : 'No matching items'}</h4>
|
||||
<h4>{(totalItemCount === 0) ? (
|
||||
<FormattedMessage
|
||||
id="xpack.ml.itemsGrid.noItemsAddedTitle"
|
||||
defaultMessage="No items have been added"
|
||||
/>
|
||||
) : (
|
||||
<FormattedMessage
|
||||
id="xpack.ml.itemsGrid.noMatchingItemsTitle"
|
||||
defaultMessage="No matching items"
|
||||
/>
|
||||
)}
|
||||
</h4>
|
||||
</EuiText>
|
||||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
|
|
|
@ -24,6 +24,8 @@ import {
|
|||
EuiPopover,
|
||||
} from '@elastic/eui';
|
||||
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
|
||||
|
||||
function getContextMenuItemIcon(menuItemSetting, itemsPerPage) {
|
||||
return (menuItemSetting === itemsPerPage) ? 'check' : 'empty';
|
||||
|
@ -77,7 +79,11 @@ export class ItemsGridPagination extends Component {
|
|||
iconSide="right"
|
||||
onClick={this.onButtonClick}
|
||||
>
|
||||
Items per page: {itemsPerPage}
|
||||
<FormattedMessage
|
||||
id="xpack.ml.itemsGrid.itemsPerPageButtonLabel"
|
||||
defaultMessage="Items per page: {itemsPerPage}"
|
||||
values={{ itemsPerPage }}
|
||||
/>
|
||||
</EuiButtonEmpty>
|
||||
);
|
||||
|
||||
|
@ -90,7 +96,11 @@ export class ItemsGridPagination extends Component {
|
|||
icon={getContextMenuItemIcon(pageSize, itemsPerPage)}
|
||||
onClick={() => {this.onChangeItemsPerPage(pageSize);}}
|
||||
>
|
||||
{pageSize} items
|
||||
<FormattedMessage
|
||||
id="xpack.ml.itemsGrid.itemsCountLabel"
|
||||
defaultMessage="{pageSize} items"
|
||||
values={{ pageSize }}
|
||||
/>
|
||||
</EuiContextMenuItem>
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue