From c7bafd158b59787d1fb9fe9865fe0fc94faf3aee Mon Sep 17 00:00:00 2001 From: Leanid Shutau Date: Fri, 17 Aug 2018 14:29:03 +0300 Subject: [PATCH] Add translations for Netflow tutorial --- .../tutorials/netflow/common_instructions.js | 273 ++++++++++++++---- .../server/tutorials/netflow/elastic_cloud.js | 22 +- .../kibana/server/tutorials/netflow/index.js | 23 +- .../server/tutorials/netflow/on_prem.js | 22 +- .../netflow/on_prem_elastic_cloud.js | 6 +- 5 files changed, 257 insertions(+), 89 deletions(-) diff --git a/src/core_plugins/kibana/server/tutorials/netflow/common_instructions.js b/src/core_plugins/kibana/server/tutorials/netflow/common_instructions.js index 2a7364c0529729..b9d4a43b67a331 100644 --- a/src/core_plugins/kibana/server/tutorials/netflow/common_instructions.js +++ b/src/core_plugins/kibana/server/tutorials/netflow/common_instructions.js @@ -17,40 +17,83 @@ * under the License. */ +/* eslint-disable no-multi-str */ + +import { i18n } from '@kbn/i18n'; + export const COMMON_NETFLOW_INSTRUCTIONS = { CONFIG: { ON_PREM: { OSX: [ { - title: 'Edit the configuration', - textPre: 'Modify `config/logstash.yml` to set the configuration parameters:', - commands: [ - 'modules:', - ' - name: netflow', - ' var.input.udp.port: ', - ], - textPost: 'Where `` is the UDP port on which Logstash will receive Netflow data.' - - } + title: i18n.translate('kbn.server.tutorials.netflow.common.config.onPrem.osxTitle', { + defaultMessage: 'Edit the configuration', + }), + textPre: i18n.translate('kbn.server.tutorials.netflow.common.config.onPrem.osxTextPre', { + defaultMessage: 'Modify {logstashConfigPath} to set the configuration parameters:', + values: { + logstashConfigPath: '`config/logstash.yml`', + }, + }), + commands: ['modules:', ' - name: netflow', ' var.input.udp.port: '], + textPost: i18n.translate( + 'kbn.server.tutorials.netflow.common.config.onPrem.osxTextPost', + { + defaultMessage: + 'Where {udpPort} is the UDP port on which Logstash will receive Netflow data.', + values: { + udpPort: '``', + }, + } + ), + }, ], WINDOWS: [ { - title: 'Edit the configuration', - textPre: 'Modify `config\\logstash.yml` to set the configuration parameters:', - commands: [ - 'modules:', - ' - name: netflow', - ' var.input.udp.port: ', - ], - textPost: 'Where `` is the UDP port on which Logstash will receive Netflow data.' - } - ] + title: i18n.translate('kbn.server.tutorials.netflow.common.config.onPrem.windowsTitle', { + defaultMessage: 'Edit the configuration', + }), + textPre: i18n.translate( + 'kbn.server.tutorials.netflow.common.config.onPrem.windowsTextPre', + { + defaultMessage: 'Modify {logstashConfigPath} to set the configuration parameters:', + values: { + logstashConfigPath: '`config\\logstash.yml`', + }, + } + ), + commands: ['modules:', ' - name: netflow', ' var.input.udp.port: '], + textPost: i18n.translate( + 'kbn.server.tutorials.netflow.common.config.onPrem.windowsTextPost', + { + defaultMessage: + 'Where {udpPort} is the UDP port on which Logstash will receive Netflow data.', + values: { + udpPort: '``', + }, + } + ), + }, + ], }, ON_PREM_ELASTIC_CLOUD: { OSX: [ { - title: 'Edit the configuration', - textPre: 'Modify `config/logstash.yml` to set the configuration parameters:', + title: i18n.translate( + 'kbn.server.tutorials.netflow.common.config.onPremElasticCloud.osxTitle', + { + defaultMessage: 'Edit the configuration', + } + ), + textPre: i18n.translate( + 'kbn.server.tutorials.netflow.common.config.onPremElasticCloud.osxTextPre', + { + defaultMessage: 'Modify {logstashConfigPath} to set the configuration parameters:', + values: { + logstashConfigPath: '`config/logstash.yml`', + }, + } + ), commands: [ 'modules:', ' - name: netflow', @@ -59,15 +102,40 @@ export const COMMON_NETFLOW_INSTRUCTIONS = { ' var.elasticsearch.username: elastic', ' var.elasticsearch.password: ', ], - textPost: 'Where `` is the UDP port on which Logstash will receive Netflow data, ' - + '`` is the URL of Elasticsearch running on Elastic Cloud, and ' - + '`` is the password of the `elastic` user.' - } + textPost: i18n.translate( + 'kbn.server.tutorials.netflow.common.config.onPremElasticCloud.osxTextPost', + { + defaultMessage: + 'Where {udpPort} is the UDP port on which Logstash will receive Netflow data, \ +{esUrl} is the URL of Elasticsearch running on Elastic Cloud, and \ +{password} is the password of the {elastic} user.', + values: { + elastic: '`elastic`', + esUrl: '``', + password: '``', + udpPort: '``', + }, + } + ), + }, ], WINDOWS: [ { - title: 'Edit the configuration', - textPre: 'Modify `config\\logstash.yml` to set the configuration parameters:', + title: i18n.translate( + 'kbn.server.tutorials.netflow.common.config.onPremElasticCloud.windowsTitle', + { + defaultMessage: 'Edit the configuration', + } + ), + textPre: i18n.translate( + 'kbn.server.tutorials.netflow.common.config.onPremElasticCloud.windowsTextPre', + { + defaultMessage: 'Modify {logstashConfigPath} to set the configuration parameters:', + values: { + logstashConfigPath: '`config\\logstash.yml`', + }, + } + ), commands: [ 'modules:', ' - name: netflow', @@ -76,18 +144,42 @@ export const COMMON_NETFLOW_INSTRUCTIONS = { ' var.elasticsearch.username: elastic', ' var.elasticsearch.password: ', ], - textPost: 'Where `` is the UDP port on which Logstash will receive Netflow data, ' - + '`` is the URL of Elasticsearch running on Elastic Cloud, and ' - + '`` is the password of the `elastic` user.' - - } - ] + textPost: i18n.translate( + 'kbn.server.tutorials.netflow.common.config.onPremElasticCloud.windowsTextPost', + { + defaultMessage: + 'Where {udpPort} is the UDP port on which Logstash will receive Netflow data, \ +{esUrl} is the URL of Elasticsearch running on Elastic Cloud, and \ +{password} is the password of the {elastic} user.', + values: { + elastic: '`elastic`', + esUrl: '``', + password: '``', + udpPort: '``', + }, + } + ), + }, + ], }, ELASTIC_CLOUD: { OSX: [ { - title: 'Edit the configuration', - textPre: 'Modify `config/logstash.yml` to set the configuration parameters:', + title: i18n.translate( + 'kbn.server.tutorials.netflow.common.config.elasticCloud.osxTitle', + { + defaultMessage: 'Edit the configuration', + } + ), + textPre: i18n.translate( + 'kbn.server.tutorials.netflow.common.config.elasticCloud.osxTextPre', + { + defaultMessage: 'Modify {logstashConfigPath} to set the configuration parameters:', + values: { + logstashConfigPath: '`config/logstash.yml`', + }, + } + ), commands: [ 'cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"', @@ -96,14 +188,38 @@ export const COMMON_NETFLOW_INSTRUCTIONS = { ' - name: netflow', ' var.input.udp.port: ', ], - textPost: 'Where `` is the UDP port on which Logstash will receive Netflow data and ' - + '`` is the password of the `elastic` user.' - } + textPost: i18n.translate( + 'kbn.server.tutorials.netflow.common.config.elasticCloud.osxTextPost', + { + defaultMessage: + 'Where {udpPort} is the UDP port on which Logstash will receive Netflow data and \ +{password} is the password of the {elastic} user.', + values: { + elastic: '`elastic`', + password: '``', + udpPort: '``', + }, + } + ), + }, ], WINDOWS: [ { - title: 'Edit the configuration', - textPre: 'Modify `config\\logstash.yml` to set the configuration parameters:', + title: i18n.translate( + 'kbn.server.tutorials.netflow.common.config.elasticCloud.windowsTitle', + { + defaultMessage: 'Edit the configuration', + } + ), + textPre: i18n.translate( + 'kbn.server.tutorials.netflow.common.config.elasticCloud.windowsTextPre', + { + defaultMessage: 'Modify {logstashConfigPath} to set the configuration parameters:', + values: { + logstashConfigPath: '`config\\logstash.yml`', + }, + } + ), commands: [ 'cloud.id: "{config.cloud.id}"', 'cloud.auth: "elastic:"', @@ -112,34 +228,63 @@ export const COMMON_NETFLOW_INSTRUCTIONS = { ' - name: netflow', ' var.input.udp.port: ', ], - textPost: 'Where `` is the UDP port on which Logstash will receive Netflow data and ' - + '`` is the password of the `elastic` user.' - } - ] - } + textPost: i18n.translate( + 'kbn.server.tutorials.netflow.common.config.elasticCloud.windowsTextPost', + { + defaultMessage: + 'Where {udpPort} is the UDP port on which Logstash will receive Netflow data and \ +{password} is the password of the {elastic} user.', + values: { + elastic: '`elastic`', + password: '``', + udpPort: '``', + }, + } + ), + }, + ], + }, }, SETUP: { OSX: [ { - title: 'Run the Netflow module', - textPre: 'Run:', - commands: [ - './bin/logstash --modules netflow --setup', - ], - textPost: 'The `--setup` option creates a `netflow-*` index pattern in Elasticsearch and imports' + - ' Kibana dashboards and visualizations. Omit this option for subsequent runs to avoid overwriting existing dashboards.' - } + title: i18n.translate('kbn.server.tutorials.netflow.common.setup.osxTitle', { + defaultMessage: 'Run the Netflow module', + }), + textPre: i18n.translate('kbn.server.tutorials.netflow.common.setup.osxTextPre', { + defaultMessage: 'Run:', + }), + commands: ['./bin/logstash --modules netflow --setup'], + textPost: i18n.translate('kbn.server.tutorials.netflow.common.setup.osxTextPost', { + defaultMessage: + 'The {setupOption} option creates a {netflowPrefix} index pattern in Elasticsearch and imports \ +Kibana dashboards and visualizations. Omit this option for subsequent runs to avoid overwriting existing dashboards.', + values: { + setupOption: '`--setup`', + netflowPrefix: '`netflow-*`', + }, + }), + }, ], WINDOWS: [ { - title: 'Run the Netflow module', - textPre: 'Run:', - commands: [ - 'bin\\logstash --modules netflow --setup', - ], - textPost: 'The `--setup` option creates a `netflow-*` index pattern in Elasticsearch and imports' + - ' Kibana dashboards and visualizations. Omit this option for subsequent runs to avoid overwriting existing dashboards.' - } - ] - } + title: i18n.translate('kbn.server.tutorials.netflow.common.setup.windowsTitle', { + defaultMessage: 'Run the Netflow module', + }), + textPre: i18n.translate('kbn.server.tutorials.netflow.common.setup.windowsTextPre', { + defaultMessage: 'Run:', + }), + commands: ['bin\\logstash --modules netflow --setup'], + textPost: i18n.translate('kbn.server.tutorials.netflow.common.setup.windowsTextPost', { + defaultMessage: + 'The {setupOption} option creates a {netflowPrefix} index pattern in Elasticsearch and imports \ +Kibana dashboards and visualizations. Omit this option for subsequent runs to avoid overwriting existing dashboards.', + values: { + setupOption: '`--setup`', + netflowPrefix: '`netflow-*`', + }, + }), + }, + ], + }, }; diff --git a/src/core_plugins/kibana/server/tutorials/netflow/elastic_cloud.js b/src/core_plugins/kibana/server/tutorials/netflow/elastic_cloud.js index 21e396bb9db280..90b9a6e20f93a6 100644 --- a/src/core_plugins/kibana/server/tutorials/netflow/elastic_cloud.js +++ b/src/core_plugins/kibana/server/tutorials/netflow/elastic_cloud.js @@ -17,6 +17,8 @@ * under the License. */ +import { i18n } from '@kbn/i18n'; + import { INSTRUCTION_VARIANT } from '../../../common/tutorials/instruction_variant'; import { LOGSTASH_INSTRUCTIONS } from '../../../common/tutorials/logstash_instructions'; import { COMMON_NETFLOW_INSTRUCTIONS } from './common_instructions'; @@ -25,25 +27,27 @@ import { COMMON_NETFLOW_INSTRUCTIONS } from './common_instructions'; export const ELASTIC_CLOUD_INSTRUCTIONS = { instructionSets: [ { - title: 'Getting Started', + title: i18n.translate('kbn.server.tutorials.netflow.elasticCloudInstructions.title', { + defaultMessage: 'Getting Started', + }), instructionVariants: [ { id: INSTRUCTION_VARIANT.OSX, instructions: [ ...LOGSTASH_INSTRUCTIONS.INSTALL.OSX, ...COMMON_NETFLOW_INSTRUCTIONS.CONFIG.ELASTIC_CLOUD.OSX, - ...COMMON_NETFLOW_INSTRUCTIONS.SETUP.OSX - ] + ...COMMON_NETFLOW_INSTRUCTIONS.SETUP.OSX, + ], }, { id: INSTRUCTION_VARIANT.WINDOWS, instructions: [ ...LOGSTASH_INSTRUCTIONS.INSTALL.WINDOWS, ...COMMON_NETFLOW_INSTRUCTIONS.CONFIG.ELASTIC_CLOUD.WINDOWS, - ...COMMON_NETFLOW_INSTRUCTIONS.SETUP.WINDOWS - ] - } - ] - } - ] + ...COMMON_NETFLOW_INSTRUCTIONS.SETUP.WINDOWS, + ], + }, + ], + }, + ], }; diff --git a/src/core_plugins/kibana/server/tutorials/netflow/index.js b/src/core_plugins/kibana/server/tutorials/netflow/index.js index e634282acc5650..2bffeecae51008 100644 --- a/src/core_plugins/kibana/server/tutorials/netflow/index.js +++ b/src/core_plugins/kibana/server/tutorials/netflow/index.js @@ -17,6 +17,10 @@ * under the License. */ +/* eslint-disable no-multi-str */ + +import { i18n } from '@kbn/i18n'; + import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; import { ON_PREM_INSTRUCTIONS } from './on_prem'; import { ELASTIC_CLOUD_INSTRUCTIONS } from './elastic_cloud'; @@ -27,15 +31,22 @@ export function netflowSpecProvider() { id: 'netflow', name: 'Netflow', category: TUTORIAL_CATEGORY.SECURITY, - shortDescription: 'Collect Netflow records sent by a Netflow exporter.', - longDescription: 'The Logstash Netflow module collects and parses network flow data, ' + - ' indexes the events into Elasticsearch, and installs a suite of Kibana dashboards.' + - ' This module support Netflow Version 5 and 9.' + - ' [Learn more]({config.docs.logstash}/netflow-module.html).', + shortDescription: i18n.translate('kbn.server.tutorials.netflow.tutorialShortDescription', { + defaultMessage: 'Collect Netflow records sent by a Netflow exporter.', + }), + longDescription: i18n.translate('kbn.server.tutorials.netflow.tutorialLongDescription', { + defaultMessage: + 'The Logstash Netflow module collects and parses network flow data, \ +indexes the events into Elasticsearch, and installs a suite of Kibana dashboards. \ +This module support Netflow Version 5 and 9. [Learn more]({linkUrl}).', + values: { + linkUrl: '{config.docs.logstash}/netflow-module.html', + }, + }), completionTimeMinutes: 10, //previewImagePath: 'kibana-apache.png', TODO onPrem: ON_PREM_INSTRUCTIONS, elasticCloud: ELASTIC_CLOUD_INSTRUCTIONS, - onPremElasticCloud: ON_PREM_ELASTIC_CLOUD_INSTRUCTIONS + onPremElasticCloud: ON_PREM_ELASTIC_CLOUD_INSTRUCTIONS, }; } diff --git a/src/core_plugins/kibana/server/tutorials/netflow/on_prem.js b/src/core_plugins/kibana/server/tutorials/netflow/on_prem.js index 5b0ecbbaac2c70..f3850d78a267c0 100644 --- a/src/core_plugins/kibana/server/tutorials/netflow/on_prem.js +++ b/src/core_plugins/kibana/server/tutorials/netflow/on_prem.js @@ -17,6 +17,8 @@ * under the License. */ +import { i18n } from '@kbn/i18n'; + import { INSTRUCTION_VARIANT } from '../../../common/tutorials/instruction_variant'; import { LOGSTASH_INSTRUCTIONS } from '../../../common/tutorials/logstash_instructions'; import { COMMON_NETFLOW_INSTRUCTIONS } from './common_instructions'; @@ -25,25 +27,27 @@ import { COMMON_NETFLOW_INSTRUCTIONS } from './common_instructions'; export const ON_PREM_INSTRUCTIONS = { instructionSets: [ { - title: 'Getting Started', + title: i18n.translate('kbn.server.tutorials.netflow.onPremInstructions.title', { + defaultMessage: 'Getting Started', + }), instructionVariants: [ { id: INSTRUCTION_VARIANT.OSX, instructions: [ ...LOGSTASH_INSTRUCTIONS.INSTALL.OSX, ...COMMON_NETFLOW_INSTRUCTIONS.CONFIG.ON_PREM.OSX, - ...COMMON_NETFLOW_INSTRUCTIONS.SETUP.OSX - ] + ...COMMON_NETFLOW_INSTRUCTIONS.SETUP.OSX, + ], }, { id: INSTRUCTION_VARIANT.WINDOWS, instructions: [ ...LOGSTASH_INSTRUCTIONS.INSTALL.WINDOWS, ...COMMON_NETFLOW_INSTRUCTIONS.CONFIG.ON_PREM.WINDOWS, - ...COMMON_NETFLOW_INSTRUCTIONS.SETUP.WINDOWS - ] - } - ] - } - ] + ...COMMON_NETFLOW_INSTRUCTIONS.SETUP.WINDOWS, + ], + }, + ], + }, + ], }; diff --git a/src/core_plugins/kibana/server/tutorials/netflow/on_prem_elastic_cloud.js b/src/core_plugins/kibana/server/tutorials/netflow/on_prem_elastic_cloud.js index 0e5cb74064f804..20c66246cee430 100644 --- a/src/core_plugins/kibana/server/tutorials/netflow/on_prem_elastic_cloud.js +++ b/src/core_plugins/kibana/server/tutorials/netflow/on_prem_elastic_cloud.js @@ -17,6 +17,8 @@ * under the License. */ +import { i18n } from '@kbn/i18n'; + import { INSTRUCTION_VARIANT } from '../../../common/tutorials/instruction_variant'; import { LOGSTASH_INSTRUCTIONS } from '../../../common/tutorials/logstash_instructions'; import { @@ -29,7 +31,9 @@ import { COMMON_NETFLOW_INSTRUCTIONS } from './common_instructions'; export const ON_PREM_ELASTIC_CLOUD_INSTRUCTIONS = { instructionSets: [ { - title: 'Getting Started', + title: i18n.translate('kbn.server.tutorials.netflow.onPremElasticCloudInstructions.title', { + defaultMessage: 'Getting Started', + }), instructionVariants: [ { id: INSTRUCTION_VARIANT.OSX,