Client - use namespaces for i18n
This commit is contained in:
		@@ -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>
 | 
			
		||||
                    )}
 | 
			
		||||
 
 | 
			
		||||
@@ -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}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,8 +2,10 @@ import i18n from 'i18next'
 | 
			
		||||
import LanguageDetector from 'i18next-browser-languagedetector'
 | 
			
		||||
import XHR from 'i18next-xhr-backend'
 | 
			
		||||
 | 
			
		||||
import EnTranslations from './locales/en/translations.json'
 | 
			
		||||
import FrTranslations from './locales/fr/translations.json'
 | 
			
		||||
import EnCommonTranslations from './locales/en/common.json'
 | 
			
		||||
import EnUserTranslations from './locales/en/user.json'
 | 
			
		||||
import FrCommonTranslations from './locales/fr/common.json'
 | 
			
		||||
import FrUserTranslations from './locales/fr/user.json'
 | 
			
		||||
 | 
			
		||||
i18n
 | 
			
		||||
  .use(XHR)
 | 
			
		||||
@@ -18,14 +20,16 @@ i18n
 | 
			
		||||
    },
 | 
			
		||||
    resources: {
 | 
			
		||||
      en: {
 | 
			
		||||
        translations: EnTranslations,
 | 
			
		||||
        common: EnCommonTranslations,
 | 
			
		||||
        user: EnUserTranslations,
 | 
			
		||||
      },
 | 
			
		||||
      fr: {
 | 
			
		||||
        translations: FrTranslations,
 | 
			
		||||
        common: FrCommonTranslations,
 | 
			
		||||
        user: FrUserTranslations,
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
    ns: ['translations'],
 | 
			
		||||
    defaultNS: 'translations',
 | 
			
		||||
    ns: ['common'],
 | 
			
		||||
    defaultNS: 'common',
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
export default i18n
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								fittrackee_client/src/locales/en/common.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								fittrackee_client/src/locales/en/common.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
{
 | 
			
		||||
  "Dashboard": "Dashboard",
 | 
			
		||||
  "Workouts": "Workouts",
 | 
			
		||||
  "Statistics": "Statistics",
 | 
			
		||||
  "Add workout": "Add workout",
 | 
			
		||||
  "Register": "Register",
 | 
			
		||||
  "Login": "Login",
 | 
			
		||||
  "Logout": "Logout",
 | 
			
		||||
  "Submit": "Submit"
 | 
			
		||||
}
 | 
			
		||||
@@ -1,15 +1,8 @@
 | 
			
		||||
{
 | 
			
		||||
  "Dashboard": "Dashboard",
 | 
			
		||||
  "Workouts": "Workouts",
 | 
			
		||||
  "Statistics": "Statistics",
 | 
			
		||||
  "Add workout": "Add workout",
 | 
			
		||||
  "Register": "Register",
 | 
			
		||||
  "Login": "Login",
 | 
			
		||||
  "Logout": "Logout",
 | 
			
		||||
  "login": "login",
 | 
			
		||||
  "register": "register",
 | 
			
		||||
  "Enter a username": "Enter a username",
 | 
			
		||||
  "Enter an email address": "Enter an email address",
 | 
			
		||||
  "Enter a password": "Enter a password",
 | 
			
		||||
  "Enter the password confirmation": "Enter the password confirmation",
 | 
			
		||||
  "Submit": "Submit"
 | 
			
		||||
  "Enter the password confirmation": "Enter the password confirmation"
 | 
			
		||||
}
 | 
			
		||||
@@ -6,10 +6,5 @@
 | 
			
		||||
  "Register": "S'inscrire",
 | 
			
		||||
  "Login": "Se connecter",
 | 
			
		||||
  "Logout": "Se déconnecter",
 | 
			
		||||
  "login": "se connecter",
 | 
			
		||||
  "Enter a username": "Saisir un nom",
 | 
			
		||||
  "Enter an email address": "Saisir une adresse e-mail",
 | 
			
		||||
  "Enter a password": "Saisir un mot de passe",
 | 
			
		||||
  "Enter the password confirmation": "Confirmer le mot de passe",
 | 
			
		||||
  "Submit": "Valider"
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										8
									
								
								fittrackee_client/src/locales/fr/user.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								fittrackee_client/src/locales/fr/user.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
{
 | 
			
		||||
  "login": "se connecter",
 | 
			
		||||
  "register": "s'nscrire",
 | 
			
		||||
  "Enter a username": "Saisir un nom",
 | 
			
		||||
  "Enter an email address": "Saisir une adresse e-mail",
 | 
			
		||||
  "Enter a password": "Saisir un mot de passe",
 | 
			
		||||
  "Enter the password confirmation": "Confirmer le mot de passe"
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user