Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add translations to skeleton #242

Open
wants to merge 1 commit into
base: next-generation
Choose a base branch
from
Open
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
add translations to skeleton
  • Loading branch information
alexgul4enko committed May 28, 2020
commit 84352ccb690bc4d11eb20f4f4f1f3c91f347e57e
7 changes: 7 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,12 @@
"react/prop-types": ["error"],
"react/require-default-props": ["error"],
"react/display-name": ["off", { "ignoreTranspilerName": true }]
},
"globals": {
"gettext": "readonly",
"pgettext": "readonly",
"ngettext": "readonly",
"npgettext": "readonly",
"interpolate": "readonly"
}
}
19 changes: 14 additions & 5 deletions src/app/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { CheckCache } from '@ds-frontend/cache'
import { hot } from 'react-hot-loader/root'
import routes from './routes'
import PropTypes from 'prop-types'
import { TranslateProvider } from '@ds-frontend/i18n'
import api from 'api'

AppProvider.propTypes = {
store: PropTypes.object.isRequired,
Expand All @@ -13,11 +15,18 @@ AppProvider.propTypes = {

function AppProvider({ store, history }) {
return (
<Provider store={store}>
<CheckCache>
<Router history={history} routes={routes}/>
</CheckCache>
</Provider>
<TranslateProvider
defaultLanguage="en"
storage={localStorage}
url="jsi18n"
api={api}
>
<Provider store={store}>
<CheckCache>
<Router history={history} routes={routes}/>
</CheckCache>
</Provider>
</TranslateProvider>
)
}

Expand Down
11 changes: 7 additions & 4 deletions src/app/pages/auth/login/LoginView.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ LoginView.defaultProps = {
valid: true,
}

// ussage with variables
const title = gettext('Login')

export default function LoginView({ handleSubmit, submitting, valid }) {
return (
<form onSubmit={handleSubmit} className={classNames.login}>
<h2>Login</h2>
<TextField name="email" label="Email" type="email" />
<TextField name="password" label="Password" type="password" />
<button disabled={submitting || !valid }>Login</button>
<h2>{title}</h2>
<TextField name="email" label={gettext('Email')} type="email" />
<TextField name="password" label={gettext('Password')} type="password" />
<button disabled={submitting || !valid }>{gettext('Login')}</button>
</form>
)
}
2 changes: 2 additions & 0 deletions webpack.config.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
proxy,
sentry,
babel,
i18n,
} from './presets'

module.exports = createConfig([
Expand Down Expand Up @@ -128,6 +129,7 @@ module.exports = createConfig([
react(),
sentry(),
// sass(),
i18n(),
styles(),
// postcss(),
assets(),
Expand Down