Skip to content

Commit

Permalink
Extract internationalization from react components to function calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
justinkambic committed Sep 13, 2019
1 parent f319091 commit d9b2ae5
Showing 1 changed file with 13 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -6,18 +6,17 @@

import React from 'react';
import { EuiButton, EuiButtonEmpty, EuiIconTip, EuiInMemoryTable, EuiLink } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
import { PIPELINE_LIST } from './constants';

function getColumns(openPipeline, clonePipeline) {
return [
{
field: 'id',
name: (
<FormattedMessage
id="xpack.logstash.pipelinesTable.idColumnLabel"
defaultMessage="Id"
/>
name: i18n.translate(
'xpack.logstash.pipelinesTable.idColumnLabel',
{ defaultMessage: 'Id' }
),
sortable: true,
render: (id, { isCentrallyManaged }) => {
@@ -39,34 +38,28 @@ function getColumns(openPipeline, clonePipeline) {
},
{
field: 'description',
name: (
<FormattedMessage
id="xpack.logstash.pipelinesTable.descriptionColumnLabel"
defaultMessage="Description"
/>
name: i18n.translate(
'xpack.logstash.pipelinesTable.descriptionColumnLabel',
{ defaultMessage: 'Description' }
),
render: description => <span data-test-subj="cellDescription">{description}</span>,
sortable: true,
truncateText: true,
},
{
field: 'lastModifiedHumanized',
name: (
<FormattedMessage
id="xpack.logstash.pipelinesTable.lastModifiedColumnLabel"
defaultMessage="Last Modified"
/>
name: i18n.translate(
'xpack.logstash.pipelinesTable.lastModifiedColumnLabel',
{ defaultMessage: 'Last modified' }
),
render: lastModified => <span data-test-subj="cellLastModified">{lastModified}</span>,
sortable: ({ lastModified }) => lastModified.valueOf(),
},
{
field: 'username',
name: (
<FormattedMessage
id="xpack.logstash.pipelinesTable.modifiedByColumnLabel"
defaultMessage="Modified By"
/>
name: i18n.translate(
'xpack.logstash.pipelinesTable.modifiedByColumnLabel',
{ defaultMessage: 'Modified by' }
),
render: username => <span data-test-subj="cellUsername">{username}</span>,
sortable: true,

0 comments on commit d9b2ae5

Please sign in to comment.