Skip to content
This repository has been archived by the owner on Sep 19, 2021. It is now read-only.

Deprecate src/config/locales/i18n.js #1886

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/Form/Accordion/Accordion.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'

import { i18n } from 'config'
import i18n from 'util/i18n'
import ValidationElement from 'components/Form/ValidationElement'
import Branch from 'components/Form/Branch'
import Show from 'components/Form/Show'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Form/Branch/Branch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import PropTypes from 'prop-types'
import classnames from 'classnames'

import { i18n } from 'config'
import i18n from 'util/i18n'
import Field from 'components/Form/Field'
import Radio from 'components/Form/Radio'
import RadioGroup from 'components/Form/RadioGroup'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Form/Comments/Comments.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { i18n } from '../../../config'
import i18n from 'util/i18n'
import Textarea from '../Textarea'
import ValidationElement from '../ValidationElement'

Expand Down
4 changes: 2 additions & 2 deletions src/components/Form/Consent/Consent.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { connect } from 'react-redux'
import { i18n } from 'config'
import i18n from 'util/i18n'
import { updateApplication } from 'actions/ApplicationActions'
import Modal from 'components/Form/Modal'

Expand Down Expand Up @@ -31,7 +31,7 @@ export class Consent extends React.Component {
show={this.props.settings.consented !== 'Yes'}
className="consent-content">
<div>
<div className="consent-legal">{i18n.m2('consent.contents')}</div>
<div className="consent-legal">{i18n.m('consent.contents')}</div>
<button
name="consent"
className="consent-acceptance"
Expand Down
6 changes: 3 additions & 3 deletions src/components/Form/Country/Country.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react'
import { i18n } from '../../../config'
import i18n from 'util/i18n'
import ValidationElement from '../ValidationElement'
import Show from '../Show'
import Dropdown from '../Dropdown'
import MultipleDropdown from '../MultipleDropdown'
import countries from './countries'

export default class Country extends ValidationElement {
constructor(props) {
Expand All @@ -13,8 +14,7 @@ export default class Country extends ValidationElement {
showComents: props.showComments
}

this.countries = i18n.value('countries')

this.countries = countries
this.update = this.update.bind(this)
this.updateSingleCountry = this.updateSingleCountry.bind(this)
this.updateMultipleCountries = this.updateMultipleCountries.bind(this)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const countries = {
const countries = {
unitedStates: { value: 'United States', text: 'USA' },
afghanistan: { value: 'Afghanistan', text: 'Afghanistan' },
akrotiriSovereignBaseArea: {
Expand Down Expand Up @@ -331,3 +331,5 @@ export const countries = {
zambia: { value: 'Zambia', text: 'Zambia' },
zimbabwe: { value: 'Zimbabwe', text: 'Zimbabwe' }
}

export default countries
2 changes: 1 addition & 1 deletion src/components/Form/Currency/Currency.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { i18n } from '../../../config'
import i18n from 'util/i18n'
import Number from '../Number'

/**
Expand Down
1 change: 0 additions & 1 deletion src/components/Form/DateControl/DateControl.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react'
import { connect } from 'react-redux'
import { i18n } from '../../../config'
import ValidationElement from '../ValidationElement'
import Number from '../Number'
import Checkbox from '../Checkbox'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Form/EyeColor/EyeColor.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { i18n } from '../../../config'
import i18n from 'util/i18n'
import ValidationElement from '../ValidationElement'
import Svg from '../Svg'
import Radio from '../Radio'
Expand Down
15 changes: 7 additions & 8 deletions src/components/Form/Field/Field.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import React from 'react'
import classnames from 'classnames'

import { i18n } from 'config'
import { i18n } from 'config/locales/i18n'

import ValidationElement, { newGuid } from 'components/Form/ValidationElement'
import Svg from 'components/Form/Svg'
Expand All @@ -19,8 +19,6 @@ const renderMessage = (id, messageString, titleString) => {
&& note.indexOf(noteId) > -1
) {
note = ''
} else {
note = <em>{note}</em>
}

const messageId = `${id}.message`
Expand All @@ -30,17 +28,19 @@ const renderMessage = (id, messageString, titleString) => {
&& message.indexOf(messageId) > -1
) {
message = ''
} else {
message = <span>{message}</span>
}

const title = titleString || i18n.t(`${id}.title`)

return (
<div key={newGuid()} data-i18n={id}>
<h5 className="usa-alert-heading">{title}</h5>
{message}
{note}
{message && (
<span>{message}</span>
)}
{note && (
<em>{note}</em>
)}
</div>
)
}
Expand Down Expand Up @@ -325,7 +325,6 @@ export default class Field extends ValidationElement {

helpMessage() {
const { help, helpMessage, helpTitle } = this.props

if (this.state.helpActive && help) {
return (
<div className="usa-alert usa-alert-info" role="alert">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import ValidationElement from '../ValidationElement'
import { i18n } from '../../../config'
import i18n from 'util/i18n'
import { alphaNumericRegEx } from '../../../validators/helpers'
import RadioGroup from '../RadioGroup'
import Radio from '../Radio'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Form/HairColor/HairColor.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { i18n } from '../../../config'
import i18n from 'util/i18n'
import ValidationElement from '../ValidationElement'
import Svg from '../Svg'
import Radio from '../Radio'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Form/Height/Height.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { i18n } from '../../../config'
import i18n from 'util/i18n'
import ValidationElement from '../ValidationElement'
import Number from '../Number'

Expand Down
2 changes: 1 addition & 1 deletion src/components/Form/Introduction/Introduction.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { connect } from 'react-redux'
import * as formTypes from 'constants/formTypes'
import { i18n } from '../../../config'
import i18n from 'util/i18n'
import { updateApplication } from '../../../actions/ApplicationActions'
import { logout } from '../../../actions/AuthActions'
import Branch from '../Branch'
Expand Down
Loading