Client - use namespaces for i18n
This commit is contained in:
		@@ -38,7 +38,7 @@ class NavBar extends React.PureComponent {
 | 
				
			|||||||
                          pathname: '/',
 | 
					                          pathname: '/',
 | 
				
			||||||
                        }}
 | 
					                        }}
 | 
				
			||||||
                      >
 | 
					                      >
 | 
				
			||||||
                        {t('Dashboard')}
 | 
					                        {t('common:Dashboard')}
 | 
				
			||||||
                      </Link>
 | 
					                      </Link>
 | 
				
			||||||
                    </li>
 | 
					                    </li>
 | 
				
			||||||
                    {isAuthenticated && (
 | 
					                    {isAuthenticated && (
 | 
				
			||||||
@@ -61,7 +61,7 @@ class NavBar extends React.PureComponent {
 | 
				
			|||||||
                            pathname: '/activities/statistics',
 | 
					                            pathname: '/activities/statistics',
 | 
				
			||||||
                          }}
 | 
					                          }}
 | 
				
			||||||
                        >
 | 
					                        >
 | 
				
			||||||
                          {t('Statistics')}
 | 
					                          {t('common:Statistics')}
 | 
				
			||||||
                        </Link>
 | 
					                        </Link>
 | 
				
			||||||
                      </li>
 | 
					                      </li>
 | 
				
			||||||
                    )}
 | 
					                    )}
 | 
				
			||||||
@@ -73,7 +73,7 @@ class NavBar extends React.PureComponent {
 | 
				
			|||||||
                            pathname: '/activities/add',
 | 
					                            pathname: '/activities/add',
 | 
				
			||||||
                          }}
 | 
					                          }}
 | 
				
			||||||
                        >
 | 
					                        >
 | 
				
			||||||
                          <strong>{t('Add workout')}</strong>
 | 
					                          <strong>{t('common:Add workout')}</strong>
 | 
				
			||||||
                        </Link>
 | 
					                        </Link>
 | 
				
			||||||
                      </li>
 | 
					                      </li>
 | 
				
			||||||
                    )}
 | 
					                    )}
 | 
				
			||||||
@@ -102,7 +102,7 @@ class NavBar extends React.PureComponent {
 | 
				
			|||||||
                            pathname: '/register',
 | 
					                            pathname: '/register',
 | 
				
			||||||
                          }}
 | 
					                          }}
 | 
				
			||||||
                        >
 | 
					                        >
 | 
				
			||||||
                          {t('Register')}
 | 
					                          {t('common:Register')}
 | 
				
			||||||
                        </Link>
 | 
					                        </Link>
 | 
				
			||||||
                      </li>
 | 
					                      </li>
 | 
				
			||||||
                    )}
 | 
					                    )}
 | 
				
			||||||
@@ -114,7 +114,7 @@ class NavBar extends React.PureComponent {
 | 
				
			|||||||
                            pathname: '/login',
 | 
					                            pathname: '/login',
 | 
				
			||||||
                          }}
 | 
					                          }}
 | 
				
			||||||
                        >
 | 
					                        >
 | 
				
			||||||
                          {t('Login')}
 | 
					                          {t('common:Login')}
 | 
				
			||||||
                        </Link>
 | 
					                        </Link>
 | 
				
			||||||
                      </li>
 | 
					                      </li>
 | 
				
			||||||
                    )}
 | 
					                    )}
 | 
				
			||||||
@@ -145,7 +145,7 @@ class NavBar extends React.PureComponent {
 | 
				
			|||||||
                            pathname: '/logout',
 | 
					                            pathname: '/logout',
 | 
				
			||||||
                          }}
 | 
					                          }}
 | 
				
			||||||
                        >
 | 
					                        >
 | 
				
			||||||
                          {t('Logout')}
 | 
					                          {t('common:Logout')}
 | 
				
			||||||
                        </Link>
 | 
					                        </Link>
 | 
				
			||||||
                      </li>
 | 
					                      </li>
 | 
				
			||||||
                    )}
 | 
					                    )}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,13 +7,13 @@ import { isRegistrationAllowed } from '../../utils'
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export default function Form(props) {
 | 
					export default function Form(props) {
 | 
				
			||||||
  const { t } = useTranslation()
 | 
					  const { t } = useTranslation()
 | 
				
			||||||
  const pageTitle = `${props.formType
 | 
					  const pageTitle = `common:${props.formType
 | 
				
			||||||
    .charAt(0)
 | 
					    .charAt(0)
 | 
				
			||||||
    .toUpperCase()}${props.formType.slice(1)}`
 | 
					    .toUpperCase()}${props.formType.slice(1)}`
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <div>
 | 
					    <div>
 | 
				
			||||||
      <Helmet>
 | 
					      <Helmet>
 | 
				
			||||||
        <title>FitTrackee - {t(props.formType)}</title>
 | 
					        <title>FitTrackee - {t(`user:${props.formType}`)}</title>
 | 
				
			||||||
      </Helmet>
 | 
					      </Helmet>
 | 
				
			||||||
      <h1 className="page-title">{t(pageTitle)}</h1>
 | 
					      <h1 className="page-title">{t(pageTitle)}</h1>
 | 
				
			||||||
      <div className="container">
 | 
					      <div className="container">
 | 
				
			||||||
@@ -46,7 +46,7 @@ export default function Form(props) {
 | 
				
			|||||||
                    <input
 | 
					                    <input
 | 
				
			||||||
                      className="form-control input-lg"
 | 
					                      className="form-control input-lg"
 | 
				
			||||||
                      name="username"
 | 
					                      name="username"
 | 
				
			||||||
                      placeholder={t('Enter a username')}
 | 
					                      placeholder={t('user:Enter a username')}
 | 
				
			||||||
                      required
 | 
					                      required
 | 
				
			||||||
                      type="text"
 | 
					                      type="text"
 | 
				
			||||||
                      value={props.userForm.username}
 | 
					                      value={props.userForm.username}
 | 
				
			||||||
@@ -58,7 +58,7 @@ export default function Form(props) {
 | 
				
			|||||||
                  <input
 | 
					                  <input
 | 
				
			||||||
                    className="form-control input-lg"
 | 
					                    className="form-control input-lg"
 | 
				
			||||||
                    name="email"
 | 
					                    name="email"
 | 
				
			||||||
                    placeholder={t('Enter an email address')}
 | 
					                    placeholder={t('user:Enter an email address')}
 | 
				
			||||||
                    required
 | 
					                    required
 | 
				
			||||||
                    type="email"
 | 
					                    type="email"
 | 
				
			||||||
                    value={props.userForm.email}
 | 
					                    value={props.userForm.email}
 | 
				
			||||||
@@ -69,7 +69,7 @@ export default function Form(props) {
 | 
				
			|||||||
                  <input
 | 
					                  <input
 | 
				
			||||||
                    className="form-control input-lg"
 | 
					                    className="form-control input-lg"
 | 
				
			||||||
                    name="password"
 | 
					                    name="password"
 | 
				
			||||||
                    placeholder={t('Enter a password')}
 | 
					                    placeholder={t('user:Enter a password')}
 | 
				
			||||||
                    required
 | 
					                    required
 | 
				
			||||||
                    type="password"
 | 
					                    type="password"
 | 
				
			||||||
                    value={props.userForm.password}
 | 
					                    value={props.userForm.password}
 | 
				
			||||||
@@ -81,7 +81,7 @@ export default function Form(props) {
 | 
				
			|||||||
                    <input
 | 
					                    <input
 | 
				
			||||||
                      className="form-control input-lg"
 | 
					                      className="form-control input-lg"
 | 
				
			||||||
                      name="password_conf"
 | 
					                      name="password_conf"
 | 
				
			||||||
                      placeholder={t('Enter the password confirmation')}
 | 
					                      placeholder={t('user:Enter the password confirmation')}
 | 
				
			||||||
                      required
 | 
					                      required
 | 
				
			||||||
                      type="password"
 | 
					                      type="password"
 | 
				
			||||||
                      value={props.userForm.password_conf}
 | 
					                      value={props.userForm.password_conf}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,8 +2,10 @@ import i18n from 'i18next'
 | 
				
			|||||||
import LanguageDetector from 'i18next-browser-languagedetector'
 | 
					import LanguageDetector from 'i18next-browser-languagedetector'
 | 
				
			||||||
import XHR from 'i18next-xhr-backend'
 | 
					import XHR from 'i18next-xhr-backend'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import EnTranslations from './locales/en/translations.json'
 | 
					import EnCommonTranslations from './locales/en/common.json'
 | 
				
			||||||
import FrTranslations from './locales/fr/translations.json'
 | 
					import EnUserTranslations from './locales/en/user.json'
 | 
				
			||||||
 | 
					import FrCommonTranslations from './locales/fr/common.json'
 | 
				
			||||||
 | 
					import FrUserTranslations from './locales/fr/user.json'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
i18n
 | 
					i18n
 | 
				
			||||||
  .use(XHR)
 | 
					  .use(XHR)
 | 
				
			||||||
@@ -18,14 +20,16 @@ i18n
 | 
				
			|||||||
    },
 | 
					    },
 | 
				
			||||||
    resources: {
 | 
					    resources: {
 | 
				
			||||||
      en: {
 | 
					      en: {
 | 
				
			||||||
        translations: EnTranslations,
 | 
					        common: EnCommonTranslations,
 | 
				
			||||||
 | 
					        user: EnUserTranslations,
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      fr: {
 | 
					      fr: {
 | 
				
			||||||
        translations: FrTranslations,
 | 
					        common: FrCommonTranslations,
 | 
				
			||||||
 | 
					        user: FrUserTranslations,
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    ns: ['translations'],
 | 
					    ns: ['common'],
 | 
				
			||||||
    defaultNS: 'translations',
 | 
					    defaultNS: 'common',
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default i18n
 | 
					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",
 | 
					  "login": "login",
 | 
				
			||||||
 | 
					  "register": "register",
 | 
				
			||||||
  "Enter a username": "Enter a username",
 | 
					  "Enter a username": "Enter a username",
 | 
				
			||||||
  "Enter an email address": "Enter an email address",
 | 
					  "Enter an email address": "Enter an email address",
 | 
				
			||||||
  "Enter a password": "Enter a password",
 | 
					  "Enter a password": "Enter a password",
 | 
				
			||||||
  "Enter the password confirmation": "Enter the password confirmation",
 | 
					  "Enter the password confirmation": "Enter the password confirmation"
 | 
				
			||||||
  "Submit": "Submit"
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -6,10 +6,5 @@
 | 
				
			|||||||
  "Register": "S'inscrire",
 | 
					  "Register": "S'inscrire",
 | 
				
			||||||
  "Login": "Se connecter",
 | 
					  "Login": "Se connecter",
 | 
				
			||||||
  "Logout": "Se dé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"
 | 
					  "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