Client - use namespaces for i18n

This commit is contained in:
Sam
2019-09-08 11:35:30 +02:00
parent 8473f6652c
commit c83351ea1f
7 changed files with 42 additions and 32 deletions

View File

@@ -38,7 +38,7 @@ class NavBar extends React.PureComponent {
pathname: '/',
}}
>
{t('Dashboard')}
{t('common:Dashboard')}
</Link>
</li>
{isAuthenticated && (
@@ -61,7 +61,7 @@ class NavBar extends React.PureComponent {
pathname: '/activities/statistics',
}}
>
{t('Statistics')}
{t('common:Statistics')}
</Link>
</li>
)}
@@ -73,7 +73,7 @@ class NavBar extends React.PureComponent {
pathname: '/activities/add',
}}
>
<strong>{t('Add workout')}</strong>
<strong>{t('common:Add workout')}</strong>
</Link>
</li>
)}
@@ -102,7 +102,7 @@ class NavBar extends React.PureComponent {
pathname: '/register',
}}
>
{t('Register')}
{t('common:Register')}
</Link>
</li>
)}
@@ -114,7 +114,7 @@ class NavBar extends React.PureComponent {
pathname: '/login',
}}
>
{t('Login')}
{t('common:Login')}
</Link>
</li>
)}
@@ -145,7 +145,7 @@ class NavBar extends React.PureComponent {
pathname: '/logout',
}}
>
{t('Logout')}
{t('common:Logout')}
</Link>
</li>
)}

View File

@@ -7,13 +7,13 @@ import { isRegistrationAllowed } from '../../utils'
export default function Form(props) {
const { t } = useTranslation()
const pageTitle = `${props.formType
const pageTitle = `common:${props.formType
.charAt(0)
.toUpperCase()}${props.formType.slice(1)}`
return (
<div>
<Helmet>
<title>FitTrackee - {t(props.formType)}</title>
<title>FitTrackee - {t(`user:${props.formType}`)}</title>
</Helmet>
<h1 className="page-title">{t(pageTitle)}</h1>
<div className="container">
@@ -46,7 +46,7 @@ export default function Form(props) {
<input
className="form-control input-lg"
name="username"
placeholder={t('Enter a username')}
placeholder={t('user:Enter a username')}
required
type="text"
value={props.userForm.username}
@@ -58,7 +58,7 @@ export default function Form(props) {
<input
className="form-control input-lg"
name="email"
placeholder={t('Enter an email address')}
placeholder={t('user:Enter an email address')}
required
type="email"
value={props.userForm.email}
@@ -69,7 +69,7 @@ export default function Form(props) {
<input
className="form-control input-lg"
name="password"
placeholder={t('Enter a password')}
placeholder={t('user:Enter a password')}
required
type="password"
value={props.userForm.password}
@@ -81,7 +81,7 @@ export default function Form(props) {
<input
className="form-control input-lg"
name="password_conf"
placeholder={t('Enter the password confirmation')}
placeholder={t('user:Enter the password confirmation')}
required
type="password"
value={props.userForm.password_conf}