Skip to content

Commit

Permalink
Fixes #25135 - use i18n from webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
amirfefer committed Oct 16, 2018
1 parent 72786f3 commit d557976
Show file tree
Hide file tree
Showing 29 changed files with 36 additions and 8 deletions.
5 changes: 5 additions & 0 deletions webpack/__mocks__/foremanReact/common/I18n.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export { sprintf } from 'jed';

export const translate = s => s;

export const ngettext = s => s;
2 changes: 1 addition & 1 deletion webpack/components/MultiSelect/index.js
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
2 changes: 1 addition & 1 deletion webpack/components/Search/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
1 change: 1 addition & 0 deletions webpack/components/SelectOrg/SetOrganization.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
1 change: 1 addition & 0 deletions webpack/components/WithOrganization/withOrganization.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
1 change: 1 addition & 0 deletions webpack/containers/Application/config.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
1 change: 1 addition & 0 deletions webpack/move_to_foreman/common/helpers.js
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
1 change: 1 addition & 0 deletions webpack/move_to_foreman/components/common/Dialog/Dialog.js
Original file line number Diff line number Diff line change
@@ -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) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion webpack/scenes/RedHatRepositories/helpers.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { translate as __ } from 'foremanReact/common/I18n';

export default {
name: __('Name'),
description: __('Description'),
Expand Down
Original file line number Diff line number Diff line change
@@ -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 }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 }) => (
<Row key={content.id}>
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
Original file line number Diff line number Diff line change
@@ -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:`);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { translate as __ } from 'foremanReact/common/I18n';
import { headerFormatter, cellFormatter } from '../../../move_to_foreman/components/common/table';

export const columns = [
Expand Down
2 changes: 2 additions & 0 deletions webpack/scenes/Subscriptions/SubscriptionConstants.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
1 change: 1 addition & 0 deletions webpack/scenes/Subscriptions/SubscriptionValidations.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { translate as __ } from 'foremanReact/common/I18n';
import { filterRHSubscriptions } from './SubscriptionHelpers.js';

export const validateQuantity = (quantity, availableQuantity) => {
Expand Down
1 change: 1 addition & 0 deletions webpack/scenes/Subscriptions/SubscriptionsPage.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
1 change: 1 addition & 0 deletions webpack/scenes/Tasks/helpers.js
Original file line number Diff line number Diff line change
@@ -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';

Expand Down

0 comments on commit d557976

Please sign in to comment.