[i18n] APM translations for KueryBar (#27495) (#28569)

* Translations for KueryBar

* Fix code review comments

* Use i18n.translate

* Refactoring
This commit is contained in:
Maryia Lapata 2019-01-14 10:22:55 +03:00 committed by GitHub
parent 72026bf5db
commit ddb34705ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 11 deletions

View file

@ -9,6 +9,7 @@ import PropTypes from 'prop-types';
import Suggestions from './Suggestions';
import ClickOutside from './ClickOutside';
import { EuiFieldSearch, EuiProgress } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
const KEY_CODES = {
LEFT: 37,
@ -166,7 +167,17 @@ export class Typeahead extends Component {
style={{
backgroundImage: 'none'
}}
placeholder="Search transactions and errors... (E.g. transaction.duration.us > 300000 AND context.response.status_code >= 400)"
placeholder={i18n.translate(
'xpack.apm.kueryBar.searchPlaceholder',
{
defaultMessage:
'Search transactions and errors… (E.g. {queryExample})',
values: {
queryExample:
'transaction.duration.us > 300000 AND context.response.status_code >= 400'
}
}
)}
inputRef={node => {
if (node) {
this.inputRef = node;

View file

@ -25,6 +25,8 @@ import {
import styled from 'styled-components';
import { getBoolFilter } from './get_bool_filter';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
const Container = styled.div`
margin-bottom: 10px;
@ -112,16 +114,24 @@ class KueryBarView extends Component {
style={{ display: 'inline-block', marginTop: '10px' }}
title={
<div>
There&#39;s no APM index pattern with the title &#34;
{apmIndexPatternTitle}
&#34; available. To use the Query bar, please choose to import
the APM index pattern via the{' '}
<KibanaLink
pathname={'/app/kibana'}
hash={`/home/tutorial/apm`}
>
Setup Instructions.
</KibanaLink>
<FormattedMessage
id="xpack.apm.kueryBar.indexPatternMissingWarningMessage"
defaultMessage="There's no APM index pattern with the title {apmIndexPatternTitle} available. To use the Query bar, please choose to import the APM index pattern via the {setupInstructionsLink}."
values={{
apmIndexPatternTitle: `"${apmIndexPatternTitle}"`,
setupInstructionsLink: (
<KibanaLink
pathname={'/app/kibana'}
hash={`/home/tutorial/apm`}
>
{i18n.translate(
'xpack.apm.kueryBar.setupInstructionsLinkLabel',
{ defaultMessage: 'Setup Instructions' }
)}
</KibanaLink>
)
}}
/>
</div>
}
color="warning"