From d557976f7922ebf2138d5e8fc35832830e0e2968 Mon Sep 17 00:00:00 2001 From: amirfefer Date: Sun, 7 Oct 2018 14:16:08 +0000 Subject: [PATCH] Fixes #25135 - use i18n from webpack --- webpack/__mocks__/foremanReact/common/I18n.js | 5 +++++ webpack/components/MultiSelect/index.js | 2 +- webpack/components/Search/index.js | 2 +- webpack/components/SelectOrg/SetOrganization.js | 1 + webpack/components/WithOrganization/withOrganization.js | 1 + webpack/containers/Application/config.js | 1 + webpack/move_to_foreman/common/helpers.js | 1 + .../components/common/ConfirmDialog/ConfirmDialog.js | 1 + webpack/move_to_foreman/components/common/Dialog/Dialog.js | 1 + .../move_to_foreman/components/common/EmptyState/index.js | 1 + .../components/common/ModalProgressBar/ModalProgressBar.js | 2 +- .../components/EnabledRepository/EnabledRepository.js | 2 +- .../RepositorySetRepository/RepositorySetRepository.js | 2 +- webpack/scenes/RedHatRepositories/helpers.js | 2 +- .../scenes/Subscriptions/Details/SubscriptionAttributes.js | 2 ++ .../Subscriptions/Details/SubscriptionDetailAssociations.js | 1 + .../scenes/Subscriptions/Details/SubscriptionDetailInfo.js | 1 + .../Subscriptions/Details/SubscriptionDetailProduct.js | 1 + webpack/scenes/Subscriptions/Details/SubscriptionDetails.js | 1 + .../scenes/Subscriptions/Manifest/DeleteManifestModalText.js | 2 ++ .../Subscriptions/Manifest/ManifestHistoryTableSchema.js | 1 + webpack/scenes/Subscriptions/SubscriptionConstants.js | 2 ++ webpack/scenes/Subscriptions/SubscriptionValidations.js | 1 + webpack/scenes/Subscriptions/SubscriptionsPage.js | 1 + .../UpstreamSubscriptions/UpstreamSubscriptionsPage.js | 1 + .../UpstreamSubscriptionsTableSchema.js | 1 + .../SubscriptionsTable/EntitlementsInlineEditFormatter.js | 2 +- .../components/SubscriptionsTable/SubscriptionsTable.js | 2 +- webpack/scenes/Tasks/helpers.js | 1 + 29 files changed, 36 insertions(+), 8 deletions(-) create mode 100644 webpack/__mocks__/foremanReact/common/I18n.js diff --git a/webpack/__mocks__/foremanReact/common/I18n.js b/webpack/__mocks__/foremanReact/common/I18n.js new file mode 100644 index 00000000000..5a9fb5c253d --- /dev/null +++ b/webpack/__mocks__/foremanReact/common/I18n.js @@ -0,0 +1,5 @@ +export { sprintf } from 'jed'; + +export const translate = s => s; + +export const ngettext = s => s; diff --git a/webpack/components/MultiSelect/index.js b/webpack/components/MultiSelect/index.js index 08d5468218d..2db0f2bc5c2 100644 --- a/webpack/components/MultiSelect/index.js +++ b/webpack/components/MultiSelect/index.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; - +import { translate as __ } from 'foremanReact/common/I18n'; import { FormGroup, ControlLabel } from 'react-bootstrap'; import BootstrapSelect from '../../move_to_pf/react-bootstrap-select'; diff --git a/webpack/components/Search/index.js b/webpack/components/Search/index.js index 923de4fb2f5..5d5c8fc58b1 100644 --- a/webpack/components/Search/index.js +++ b/webpack/components/Search/index.js @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import { ControlLabel } from 'react-bootstrap'; import PropTypes from 'prop-types'; - +import { translate as __ } from 'foremanReact/common/I18n'; import TypeAhead from '../../move_to_pf/TypeAhead/TypeAhead'; import api from '../../services/api'; import { stringIncludes } from './helpers'; diff --git a/webpack/components/SelectOrg/SetOrganization.js b/webpack/components/SelectOrg/SetOrganization.js index ac39eeabc23..2415f989f19 100644 --- a/webpack/components/SelectOrg/SetOrganization.js +++ b/webpack/components/SelectOrg/SetOrganization.js @@ -1,5 +1,6 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; +import { translate as __ } from 'foremanReact/common/I18n'; import { Form, Button } from 'patternfly-react'; import { withRouter } from 'react-router'; import { bindActionCreators } from 'redux'; diff --git a/webpack/components/WithOrganization/withOrganization.js b/webpack/components/WithOrganization/withOrganization.js index 124fc52c9e8..a4117766cd1 100644 --- a/webpack/components/WithOrganization/withOrganization.js +++ b/webpack/components/WithOrganization/withOrganization.js @@ -1,5 +1,6 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; +import { translate as __ } from 'foremanReact/common/I18n'; import { get } from 'lodash'; import SetOrganization from '../SelectOrg/SetOrganization'; import titleWithCaret from '../../helpers/caret'; diff --git a/webpack/containers/Application/config.js b/webpack/containers/Application/config.js index 02b0eb33551..846111f7154 100644 --- a/webpack/containers/Application/config.js +++ b/webpack/containers/Application/config.js @@ -1,3 +1,4 @@ +import { translate as __ } from 'foremanReact/common/I18n'; import Repos from '../../scenes/RedHatRepositories'; import Subscriptions from '../../scenes/Subscriptions'; import UpstreamSubscriptions from '../../scenes/Subscriptions/UpstreamSubscriptions/index'; diff --git a/webpack/move_to_foreman/common/helpers.js b/webpack/move_to_foreman/common/helpers.js index faef13cf8ff..8ee8908af19 100644 --- a/webpack/move_to_foreman/common/helpers.js +++ b/webpack/move_to_foreman/common/helpers.js @@ -1,3 +1,4 @@ +import { translate as __ } from 'foremanReact/common/I18n'; import { addToast } from 'foremanReact/redux/actions/toasts'; import { SUBSCRIPTIONS_QUANTITIES_FAILURE } from '../../scenes/Subscriptions/SubscriptionConstants'; diff --git a/webpack/move_to_foreman/components/common/ConfirmDialog/ConfirmDialog.js b/webpack/move_to_foreman/components/common/ConfirmDialog/ConfirmDialog.js index 6cd53f6f67f..5b174206563 100644 --- a/webpack/move_to_foreman/components/common/ConfirmDialog/ConfirmDialog.js +++ b/webpack/move_to_foreman/components/common/ConfirmDialog/ConfirmDialog.js @@ -1,5 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; +import { translate as __ } from 'foremanReact/common/I18n'; import { Button } from 'patternfly-react'; import Dialog from '../Dialog'; diff --git a/webpack/move_to_foreman/components/common/Dialog/Dialog.js b/webpack/move_to_foreman/components/common/Dialog/Dialog.js index 1e74eea6561..6487aa57e70 100644 --- a/webpack/move_to_foreman/components/common/Dialog/Dialog.js +++ b/webpack/move_to_foreman/components/common/Dialog/Dialog.js @@ -1,5 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; +import { translate as __ } from 'foremanReact/common/I18n'; import { Button, Modal, Icon } from 'patternfly-react'; const Dialog = (props) => { diff --git a/webpack/move_to_foreman/components/common/EmptyState/index.js b/webpack/move_to_foreman/components/common/EmptyState/index.js index 707e4cb116f..8ca8d3648f1 100644 --- a/webpack/move_to_foreman/components/common/EmptyState/index.js +++ b/webpack/move_to_foreman/components/common/EmptyState/index.js @@ -1,6 +1,7 @@ /* eslint-disable */ import React from 'react'; import { EmptyState as PfEmptyState, Button } from 'patternfly-react'; +import { translate as __ } from 'foremanReact/common/I18n'; import { LinkContainer } from 'react-router-bootstrap'; const EmptyState = (props) => { diff --git a/webpack/move_to_foreman/components/common/ModalProgressBar/ModalProgressBar.js b/webpack/move_to_foreman/components/common/ModalProgressBar/ModalProgressBar.js index 3b402f6648e..5f3b2461b11 100644 --- a/webpack/move_to_foreman/components/common/ModalProgressBar/ModalProgressBar.js +++ b/webpack/move_to_foreman/components/common/ModalProgressBar/ModalProgressBar.js @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Modal, ProgressBar } from 'patternfly-react'; -import { sprintf } from 'jed'; +import { sprintf } from 'foremanReact/common/I18n'; const ModalProgressBar = (props) => { const { show, container, task } = props; diff --git a/webpack/scenes/RedHatRepositories/components/EnabledRepository/EnabledRepository.js b/webpack/scenes/RedHatRepositories/components/EnabledRepository/EnabledRepository.js index 4df9c214f14..951568a5688 100644 --- a/webpack/scenes/RedHatRepositories/components/EnabledRepository/EnabledRepository.js +++ b/webpack/scenes/RedHatRepositories/components/EnabledRepository/EnabledRepository.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { ListView } from 'patternfly-react'; -import { sprintf } from 'jed'; +import { sprintf } from 'foremanReact/common/I18n'; import RepositoryTypeIcon from '../RepositoryTypeIcon'; diff --git a/webpack/scenes/RedHatRepositories/components/RepositorySetRepository/RepositorySetRepository.js b/webpack/scenes/RedHatRepositories/components/RepositorySetRepository/RepositorySetRepository.js index 5a7f198643e..c1899728c1e 100644 --- a/webpack/scenes/RedHatRepositories/components/RepositorySetRepository/RepositorySetRepository.js +++ b/webpack/scenes/RedHatRepositories/components/RepositorySetRepository/RepositorySetRepository.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import cx from 'classnames'; import { ListView, Spinner, OverlayTrigger, Tooltip, Icon, FieldLevelHelp } from 'patternfly-react'; -import { sprintf } from 'jed'; +import { sprintf } from 'foremanReact/common/I18n'; import { yStream } from '../RepositorySetRepositoriesHelpers'; import { notify } from '../../../../move_to_foreman/foreman_toast_notifications'; import '../../index.scss'; diff --git a/webpack/scenes/RedHatRepositories/helpers.js b/webpack/scenes/RedHatRepositories/helpers.js index 4527ceb8bb5..9dd6279ea5e 100644 --- a/webpack/scenes/RedHatRepositories/helpers.js +++ b/webpack/scenes/RedHatRepositories/helpers.js @@ -1,6 +1,6 @@ import React from 'react'; import { ListView } from 'patternfly-react'; -import { sprintf } from 'jed'; +import { sprintf } from 'foremanReact/common/I18n'; import PaginationRow from '../../components/PaginationRow/index'; import RepositorySet from './components/RepositorySet'; diff --git a/webpack/scenes/Subscriptions/Details/SubscriptionAttributes.js b/webpack/scenes/Subscriptions/Details/SubscriptionAttributes.js index a5c1329ca99..0b66de2bc92 100644 --- a/webpack/scenes/Subscriptions/Details/SubscriptionAttributes.js +++ b/webpack/scenes/Subscriptions/Details/SubscriptionAttributes.js @@ -1,3 +1,5 @@ +import { translate as __ } from 'foremanReact/common/I18n'; + export default { name: __('Name'), description: __('Description'), diff --git a/webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js b/webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js index d2e081cc83f..949e8a7cb03 100644 --- a/webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js +++ b/webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js @@ -1,6 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Table } from 'react-bootstrap'; +import { translate as __ } from 'foremanReact/common/I18n'; import helpers from '../../../move_to_foreman/common/helpers.js'; const SubscriptionDetailAssociations = ({ subscriptionDetails }) => { diff --git a/webpack/scenes/Subscriptions/Details/SubscriptionDetailInfo.js b/webpack/scenes/Subscriptions/Details/SubscriptionDetailInfo.js index 32c28a9c03e..246502d714d 100644 --- a/webpack/scenes/Subscriptions/Details/SubscriptionDetailInfo.js +++ b/webpack/scenes/Subscriptions/Details/SubscriptionDetailInfo.js @@ -1,6 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Table } from 'react-bootstrap'; +import { translate as __ } from 'foremanReact/common/I18n'; import subscriptionAttributes from './SubscriptionAttributes'; const SubscriptionDetailInfo = ({ subscriptionDetails }) => { diff --git a/webpack/scenes/Subscriptions/Details/SubscriptionDetailProduct.js b/webpack/scenes/Subscriptions/Details/SubscriptionDetailProduct.js index b0917b57b37..fccbb803a14 100644 --- a/webpack/scenes/Subscriptions/Details/SubscriptionDetailProduct.js +++ b/webpack/scenes/Subscriptions/Details/SubscriptionDetailProduct.js @@ -1,6 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Row, Col } from 'patternfly-react'; +import { translate as __ } from 'foremanReact/common/I18n'; const SubscriptionDetailProduct = ({ content }) => ( diff --git a/webpack/scenes/Subscriptions/Details/SubscriptionDetails.js b/webpack/scenes/Subscriptions/Details/SubscriptionDetails.js index ab7580d8273..af5627834c8 100644 --- a/webpack/scenes/Subscriptions/Details/SubscriptionDetails.js +++ b/webpack/scenes/Subscriptions/Details/SubscriptionDetails.js @@ -1,5 +1,6 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; +import { translate as __ } from 'foremanReact/common/I18n'; import { Nav, NavItem, TabPane, TabContent, TabContainer, Grid, Row, Col } from 'patternfly-react'; import BreadcrumbsBar from 'foremanReact/components/BreadcrumbBar'; import SubscriptionDetailInfo from './SubscriptionDetailInfo'; diff --git a/webpack/scenes/Subscriptions/Manifest/DeleteManifestModalText.js b/webpack/scenes/Subscriptions/Manifest/DeleteManifestModalText.js index 04789eeca32..5faad7c79eb 100644 --- a/webpack/scenes/Subscriptions/Manifest/DeleteManifestModalText.js +++ b/webpack/scenes/Subscriptions/Manifest/DeleteManifestModalText.js @@ -1,3 +1,5 @@ +import { translate as __ } from 'foremanReact/common/I18n'; + const question = __('Are you sure you want to delete the manifest?'); const note = __(`Note: Deleting a subscription manifest is STRONGLY discouraged. Deleting a manifest will:`); diff --git a/webpack/scenes/Subscriptions/Manifest/ManifestHistoryTableSchema.js b/webpack/scenes/Subscriptions/Manifest/ManifestHistoryTableSchema.js index 657150ebae5..5fd9b884d0c 100644 --- a/webpack/scenes/Subscriptions/Manifest/ManifestHistoryTableSchema.js +++ b/webpack/scenes/Subscriptions/Manifest/ManifestHistoryTableSchema.js @@ -1,3 +1,4 @@ +import { translate as __ } from 'foremanReact/common/I18n'; import { headerFormatter, cellFormatter } from '../../../move_to_foreman/components/common/table'; export const columns = [ diff --git a/webpack/scenes/Subscriptions/SubscriptionConstants.js b/webpack/scenes/Subscriptions/SubscriptionConstants.js index d3ac25c89c3..0deb5aa7f7b 100644 --- a/webpack/scenes/Subscriptions/SubscriptionConstants.js +++ b/webpack/scenes/Subscriptions/SubscriptionConstants.js @@ -1,3 +1,5 @@ +import { translate as __ } from 'foremanReact/common/I18n'; + export const SUBSCRIPTIONS_REQUEST = 'SUBSCRIPTIONS_REQUEST'; export const SUBSCRIPTIONS_SUCCESS = 'SUBSCRIPTIONS_SUCCESS'; export const SUBSCRIPTIONS_FAILURE = 'SUBSCRIPTIONS_FAILURE'; diff --git a/webpack/scenes/Subscriptions/SubscriptionValidations.js b/webpack/scenes/Subscriptions/SubscriptionValidations.js index a4f8ef83348..757c7a0de48 100644 --- a/webpack/scenes/Subscriptions/SubscriptionValidations.js +++ b/webpack/scenes/Subscriptions/SubscriptionValidations.js @@ -1,3 +1,4 @@ +import { translate as __ } from 'foremanReact/common/I18n'; import { filterRHSubscriptions } from './SubscriptionHelpers.js'; export const validateQuantity = (quantity, availableQuantity) => { diff --git a/webpack/scenes/Subscriptions/SubscriptionsPage.js b/webpack/scenes/Subscriptions/SubscriptionsPage.js index 33c4b0fd8ac..9ea69d390e6 100644 --- a/webpack/scenes/Subscriptions/SubscriptionsPage.js +++ b/webpack/scenes/Subscriptions/SubscriptionsPage.js @@ -1,6 +1,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import Immutable from 'seamless-immutable'; +import { translate as __ } from 'foremanReact/common/I18n'; import { isEmpty, isEqual } from 'lodash'; import { LinkContainer } from 'react-router-bootstrap'; import { Grid, Row, Col, Form, FormGroup } from 'react-bootstrap'; diff --git a/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsPage.js b/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsPage.js index 36bed2eef4b..8027dcca6f1 100644 --- a/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsPage.js +++ b/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsPage.js @@ -1,6 +1,7 @@ import React, { Component } from 'react'; import ReactDOMServer from 'react-dom/server'; import _ from 'lodash'; +import { translate as __ } from 'foremanReact/common/I18n'; import PropTypes from 'prop-types'; import { LinkContainer } from 'react-router-bootstrap'; import { Grid, Row, Col } from 'react-bootstrap'; diff --git a/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsTableSchema.js b/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsTableSchema.js index 5dd23d61090..e67000e5bee 100644 --- a/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsTableSchema.js +++ b/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsTableSchema.js @@ -1,5 +1,6 @@ import React from 'react'; import { FormGroup, FormControl, ControlLabel, HelpBlock } from 'react-bootstrap'; +import { translate as __ } from 'foremanReact/common/I18n'; import helpers from '../../../move_to_foreman/common/helpers'; import { headerFormatter, diff --git a/webpack/scenes/Subscriptions/components/SubscriptionsTable/EntitlementsInlineEditFormatter.js b/webpack/scenes/Subscriptions/components/SubscriptionsTable/EntitlementsInlineEditFormatter.js index 72871fc525b..daa802293b1 100644 --- a/webpack/scenes/Subscriptions/components/SubscriptionsTable/EntitlementsInlineEditFormatter.js +++ b/webpack/scenes/Subscriptions/components/SubscriptionsTable/EntitlementsInlineEditFormatter.js @@ -1,5 +1,5 @@ import React from 'react'; -import { sprintf } from 'jed'; +import { sprintf } from 'foremanReact/common/I18n'; import { Table, FormControl, FormGroup, HelpBlock, Spinner } from 'patternfly-react'; import { validateQuantity } from '../../SubscriptionValidations'; import { KEY_CODES } from '../../../../move_to_foreman/common/helpers'; diff --git a/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTable.js b/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTable.js index 73b5e0d88ca..890b5e0ce71 100644 --- a/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTable.js +++ b/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTable.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -import { sprintf } from 'jed'; +import { sprintf } from 'foremanReact/common/I18n'; import { cloneDeep, findIndex, isEqual } from 'lodash'; import { Table } from 'patternfly-react'; import { LoadingState } from '../../../../move_to_pf/LoadingState'; diff --git a/webpack/scenes/Tasks/helpers.js b/webpack/scenes/Tasks/helpers.js index 14b7b06c8fe..300a72134af 100644 --- a/webpack/scenes/Tasks/helpers.js +++ b/webpack/scenes/Tasks/helpers.js @@ -1,4 +1,5 @@ import React from 'react'; +import { translate as __ } from 'foremanReact/common/I18n'; import helpers from '../../move_to_foreman/common/helpers'; import { notify } from '../../move_to_foreman/foreman_toast_notifications';