- data from gpx, without any cleaning
+ {t('activities:data from gpx, without any cleaning')}
) : (
- 'No data to display'
+ t('activities:No data to display')
)}
)
diff --git a/fittrackee_client/src/components/Activity/ActivityDisplay/ActivityDetails.jsx b/fittrackee_client/src/components/Activity/ActivityDisplay/ActivityDetails.jsx
index c9697797..1c0ceb3b 100644
--- a/fittrackee_client/src/components/Activity/ActivityDisplay/ActivityDetails.jsx
+++ b/fittrackee_client/src/components/Activity/ActivityDisplay/ActivityDetails.jsx
@@ -3,13 +3,13 @@ import React from 'react'
import ActivityWeather from './ActivityWeather'
export default function ActivityDetails(props) {
- const { activity } = props
+ const { activity, t } = props
const withPauses = activity.pauses !== '0:00:00' && activity.pauses !== null
return (
- Duration: {activity.moving}
+ {t('activities:Duration')}: {activity.moving}
{activity.records &&
activity.records.find(r => r.record_type === 'LD') && (
@@ -18,14 +18,14 @@ export default function ActivityDetails(props) {
)}
{withPauses && (
-
- (pauses: {activity.pauses}, total duration: {activity.duration})
+
({t('activities:pauses')}: {activity.pauses},{' '}
+ {t('activities:total duration')}: {activity.duration})
)}
- Distance: {activity.distance} km
+ {t('activities:Distance')}: {activity.distance} km
{activity.records &&
activity.records.find(r => r.record_type === 'FD') && (
@@ -35,7 +35,7 @@ export default function ActivityDetails(props) {
- Average speed: {activity.ave_speed} km/h
+ {t('activities:Average speed')}: {activity.ave_speed} km/h
{activity.records &&
activity.records.find(r => r.record_type === 'AS') && (
@@ -43,7 +43,7 @@ export default function ActivityDetails(props) {
)}
- Max speed : {activity.max_speed} km/h
+ {t('activities:Max. speed')}: {activity.max_speed} km/h
{activity.records &&
activity.records.find(r => r.record_type === 'MS') && (
@@ -54,20 +54,20 @@ export default function ActivityDetails(props) {
{activity.min_alt && activity.max_alt && (
- Min altitude: {activity.min_alt}m
+ {t('activities:Min. altitude')}: {activity.min_alt}m
- Max altitude: {activity.max_alt}m
+ {t('activities:Max. altitude')}: {activity.max_alt}m
)}
{activity.ascent && activity.descent && (
- Ascent: {activity.ascent}m
+ {t('activities:Ascent')}: {activity.ascent}m
- Descent: {activity.descent}m
+ {t('activities:Descent')}: {activity.descent}m
)}
-
+
)
}
diff --git a/fittrackee_client/src/components/Activity/ActivityDisplay/ActivityNoMap.jsx b/fittrackee_client/src/components/Activity/ActivityDisplay/ActivityNoMap.jsx
index de77c969..44e6f715 100644
--- a/fittrackee_client/src/components/Activity/ActivityDisplay/ActivityNoMap.jsx
+++ b/fittrackee_client/src/components/Activity/ActivityDisplay/ActivityNoMap.jsx
@@ -1,5 +1,8 @@
import React from 'react'
-export default function ActivityNoMap() {
- return
Notes
-
{notes ? notes : 'No notes'}
+
+ {notes ? notes : t('activities:No notes')}
+
diff --git a/fittrackee_client/src/components/Activity/ActivityDisplay/ActivitySegments.jsx b/fittrackee_client/src/components/Activity/ActivityDisplay/ActivitySegments.jsx
index 6a5abdbd..8ccb6cc0 100644
--- a/fittrackee_client/src/components/Activity/ActivityDisplay/ActivitySegments.jsx
+++ b/fittrackee_client/src/components/Activity/ActivityDisplay/ActivitySegments.jsx
@@ -2,13 +2,13 @@ import React from 'react'
import { Link } from 'react-router-dom'
export default function ActivitySegments(props) {
- const { segments } = props
+ const { segments, t } = props
return (
- Segments
+ {t('activities:Segments')}
{segments.map((segment, index) => (
@@ -21,9 +21,10 @@ export default function ActivitySegments(props) {
to={`/activities/${segment.activity_id}/segment/${index +
1}`}
>
- segment {index + 1}
+ {t('activities:segment')} {index + 1}
{' '}
- ({segment.distance} km, duration: {segment.duration})
+ ({t('activities:distance')}: {segment.distance} km,{' '}
+ {t('activities:duration')}: {segment.duration})
))}
diff --git a/fittrackee_client/src/components/Activity/ActivityDisplay/ActivityWeather.jsx b/fittrackee_client/src/components/Activity/ActivityDisplay/ActivityWeather.jsx
index 26fc98be..d6e7aa1e 100644
--- a/fittrackee_client/src/components/Activity/ActivityDisplay/ActivityWeather.jsx
+++ b/fittrackee_client/src/components/Activity/ActivityDisplay/ActivityWeather.jsx
@@ -1,7 +1,7 @@
import React from 'react'
export default function ActivityWeather(props) {
- const { activity } = props
+ const { activity, t } = props
return (
{activity.weather_start && activity.weather_end && (
@@ -10,7 +10,7 @@ export default function ActivityWeather(props) {
|
- Start
+ {t('activities:Start')}
|
- End
+ {t('activities:End')}
{displayModal && (
{
onDeleteActivity(activity.id)
this.displayModal(false)
@@ -102,6 +112,7 @@ class ActivityDisplay extends React.Component {
dataType={dataType}
segmentId={segmentId}
sport={sport}
+ t={t}
title={title}
user={user}
displayModal={() => this.displayModal(true)}
@@ -118,7 +129,7 @@ class ActivityDisplay extends React.Component {
segmentId={segmentId}
/>
) : (
-
+
)}
@@ -128,6 +139,7 @@ class ActivityDisplay extends React.Component {
? activity
: activity.segments[segmentId - 1]
}
+ t={t}
/>
@@ -147,6 +159,7 @@ class ActivityDisplay extends React.Component {
activity={activity}
dataType={dataType}
segmentId={segmentId}
+ t={t}
updateCoordinates={e =>
this.updateCoordinates(e)
}
@@ -160,9 +173,9 @@ class ActivityDisplay extends React.Component {
)}
{dataType === 'activity' && (
<>
-
+
{activity.segments.length > 1 && (
-
+
)}
>
)}
@@ -175,19 +188,21 @@ class ActivityDisplay extends React.Component {
}
}
-export default connect(
- state => ({
- activities: state.activities.data,
- message: state.message,
- sports: state.sports.data,
- user: state.user,
- }),
- dispatch => ({
- loadActivity: activityId => {
- dispatch(getOrUpdateData('getData', 'activities', { id: activityId }))
- },
- onDeleteActivity: activityId => {
- dispatch(deleteActivity(activityId))
- },
- })
-)(ActivityDisplay)
+export default withTranslation()(
+ connect(
+ state => ({
+ activities: state.activities.data,
+ message: state.message,
+ sports: state.sports.data,
+ user: state.user,
+ }),
+ dispatch => ({
+ loadActivity: activityId => {
+ dispatch(getOrUpdateData('getData', 'activities', { id: activityId }))
+ },
+ onDeleteActivity: activityId => {
+ dispatch(deleteActivity(activityId))
+ },
+ })
+ )(ActivityDisplay)
+)
diff --git a/fittrackee_client/src/components/Common/CustomModal.jsx b/fittrackee_client/src/components/Common/CustomModal.jsx
index 58ac9817..d424ded0 100644
--- a/fittrackee_client/src/components/Common/CustomModal.jsx
+++ b/fittrackee_client/src/components/Common/CustomModal.jsx
@@ -1,6 +1,8 @@
import React from 'react'
+import { useTranslation } from 'react-i18next'
export default function CustomModal(props) {
+ const { t } = useTranslation()
return (
@@ -11,7 +13,7 @@ export default function CustomModal(props) {
type="button"
className="close"
aria-label="Close"
- onClick={() => props.close}
+ onClick={() => props.close()}
>
×
@@ -25,14 +27,14 @@ export default function CustomModal(props) {
className="btn btn-primary"
onClick={() => props.confirm()}
>
- Yes
+ {t('common:Yes')}
diff --git a/fittrackee_client/src/components/Common/Stats/StatsChart.jsx b/fittrackee_client/src/components/Common/Stats/StatsChart.jsx
index ed4e38ee..8bdedcc5 100644
--- a/fittrackee_client/src/components/Common/Stats/StatsChart.jsx
+++ b/fittrackee_client/src/components/Common/Stats/StatsChart.jsx
@@ -89,6 +89,7 @@ export default class StatsCharts extends React.PureComponent {
''
)
}
+ name={t(`sports:${s.label}`)}
/>
))}
diff --git a/fittrackee_client/src/components/Dashboard/ActivityCard.jsx b/fittrackee_client/src/components/Dashboard/ActivityCard.jsx
index 487f97b9..2445be71 100644
--- a/fittrackee_client/src/components/Dashboard/ActivityCard.jsx
+++ b/fittrackee_client/src/components/Dashboard/ActivityCard.jsx
@@ -6,7 +6,7 @@ import StaticMap from '../Common/StaticMap'
import { getDateWithTZ } from '../../utils'
export default function ActivityCard(props) {
- const { activity, sports, user } = props
+ const { activity, sports, t, user } = props
return (
@@ -14,7 +14,7 @@ export default function ActivityCard(props) {
{sports
.filter(sport => sport.id === activity.sport_id)
- .map(sport => sport.label)}{' '}
+ .map(sport => t(`sports:${sport.label}`))}{' '}
-{' '}
{format(
getDateWithTZ(activity.activity_date, user.timezone),
@@ -31,8 +31,8 @@ export default function ActivityCard(props) {
)}
- Duration:{' '}
- {activity.moving}
+ {' '}
+ {t('activities:Duration')}: {activity.moving}
{activity.map ? (
@@ -41,8 +41,8 @@ export default function ActivityCard(props) {
) : (
' - '
)}
- Distance:{' '}
- {activity.distance} km
+ {' '}
+ {t('activities:Distance')}: {activity.distance} km
diff --git a/fittrackee_client/src/components/Dashboard/Records.jsx b/fittrackee_client/src/components/Dashboard/Records.jsx
index 4bbb2c43..f6f25269 100644
--- a/fittrackee_client/src/components/Dashboard/Records.jsx
+++ b/fittrackee_client/src/components/Dashboard/Records.jsx
@@ -1,12 +1,13 @@
import React from 'react'
import { Link } from 'react-router-dom'
-import { formatRecord } from '../../utils/activities'
+import { formatRecord, translateSports } from '../../utils/activities'
export default function RecordsCard(props) {
const { records, sports, t, user } = props
+ const translatedSports = translateSports(sports, t)
const recordsBySport = records.reduce((sportList, record) => {
- const sport = sports.find(s => s.id === record.sport_id)
+ const sport = translatedSports.find(s => s.id === record.sport_id)
if (sportList[sport.label] === void 0) {
sportList[sport.label] = {
img: sport.img,
@@ -19,42 +20,44 @@ export default function RecordsCard(props) {
return (
- Personal records
+ {t('activities:Personal records')}
{Object.keys(recordsBySport).length === 0
? t('common:No records.')
- : Object.keys(recordsBySport).map(sportLabel => (
-
-
-
-
-
- {sportLabel}
- |
-
-
-
- {recordsBySport[sportLabel].records.map(rec => (
-
- {rec.record_type} |
- {rec.value} |
-
-
- {rec.activity_date}
-
- |
+ : Object.keys(recordsBySport)
+ .sort()
+ .map(sportLabel => (
+
+
+
+
+
+ {sportLabel}
+ |
- ))}
-
-
- ))}
+
+
+ {recordsBySport[sportLabel].records.map(rec => (
+
+ {t(`activities:${rec.record_type}`)} |
+ {rec.value} |
+
+
+ {rec.activity_date}
+
+ |
+
+ ))}
+
+
+ ))}
)
diff --git a/fittrackee_client/src/components/Dashboard/index.jsx b/fittrackee_client/src/components/Dashboard/index.jsx
index b5ec1ad5..8c42912a 100644
--- a/fittrackee_client/src/components/Dashboard/index.jsx
+++ b/fittrackee_client/src/components/Dashboard/index.jsx
@@ -69,6 +69,7 @@ class DashBoard extends React.Component {
activity={activity}
key={activity.id}
sports={sports}
+ t={t}
user={user}
/>
))
diff --git a/fittrackee_client/src/locales/en/activities.json b/fittrackee_client/src/locales/en/activities.json
index 1c9eec04..08400015 100644
--- a/fittrackee_client/src/locales/en/activities.json
+++ b/fittrackee_client/src/locales/en/activities.json
@@ -1,22 +1,55 @@
{
"Activity Date": "Activity Date",
"Add a workout": "Add a workout",
+ "Are you sure you want to delete this activity?": "Are you sure you want to delete this activity?",
"Ave. speed": "Ave. speed",
+ "Ascent": "Ascent",
"Average speed": "Average speed",
+ "Confirmation": "Confirmation",
+ "data from gpx, without any cleaning": "data from gpx, without any cleaning",
"Date": "Date",
+ "Delete activity": "Delete activity",
+ "Descent": "Descent",
"Distance": "Distance",
+ "distance": "distance",
"Duration": "Duration",
+ "duration": "duration",
"Edit a workout": "Edit a workout",
+ "Edit activity": "Edit activity",
+ "elevation": "elevation",
+ "End": "End",
+ "Farest distance": "Farest distance",
"Filter": "Filter",
"From": "From",
"gpxFile": "gpx file",
+ "Longest duration": "Longest duration",
+ "Max. altitude" : "Max. altitude",
"Max. speed": "Max. speed",
+ "Min. altitude": "Min. altitude",
"no folder inside": "no folder inside",
"files max": "files max",
"max size": "max size",
+ "No data to display": "No data to display",
+ "No Map": "No Map",
+ "No next activity": "No next activity",
+ "No next segment": "No next segment",
+ "No notes": "No notes",
+ "No previous activity": "No previous activity",
+ "No previous segment": "No previous segment",
"Notes": "Notes",
+ "pauses": "pauses",
+ "Personal records": "Personal records",
+ "See next activity": "See next activity",
+ "See next segment": "See next segment",
+ "See previous activity": "See previous activity",
+ "See previous segment": "See previous segment",
+ "segment": "segment",
+ "Segments": "Segments",
+ "speed": "speed",
+ "Start": "Start",
"Title": "Title",
"To": "To",
+ "total duration": "total duration",
"with gpx file": "with gpx file",
"without gpx file": "without gpx file",
"zipFile": "or zip file containing gpx files"
diff --git a/fittrackee_client/src/locales/en/common.json b/fittrackee_client/src/locales/en/common.json
index ce70358d..b30cd8dc 100644
--- a/fittrackee_client/src/locales/en/common.json
+++ b/fittrackee_client/src/locales/en/common.json
@@ -6,6 +6,7 @@
"days": "days",
"Login": "Login",
"Logout": "Logout",
+ "No": "No",
"No records.": "No records.",
"No workouts.": "No workouts.",
"Register": "Register",
@@ -19,5 +20,6 @@
"Workout": "Workout",
"Workouts": "Workouts",
"workout": "workout",
- "workouts": "workouts"
+ "workouts": "workouts",
+ "Yes": "Yes"
}
diff --git a/fittrackee_client/src/locales/fr/activities.json b/fittrackee_client/src/locales/fr/activities.json
index 64501979..74d57e7a 100644
--- a/fittrackee_client/src/locales/fr/activities.json
+++ b/fittrackee_client/src/locales/fr/activities.json
@@ -1,22 +1,55 @@
{
"Activity Date": "Date de l'activité",
"Add a workout": "Ajouter une activité",
+ "Are you sure you want to delete this activity?": "Etes-vous sûr de vouloir supprimer cette activité ?",
"Ave. speed": "Vitesse moyenne",
+ "Ascent": "Dénivelé positif",
"Average speed": "Vitesse moyenne",
+ "Confirmation": "Confirmation",
+ "data from gpx, without any cleaning": "données issues du fichier gpx, sans correction",
"Date": "Date",
+ "Delete activity": "Supprimer l'activité",
+ "Descent": "Dénivelé négatif",
"Distance": "Distance",
+ "distance": "distance",
"Duration": "Durée",
+ "duration": "durée",
"Edit a workout": "Editer une activité",
+ "Edit activity": "Editer une activity",
+ "elevation": "altitude",
+ "End": "Arrivée",
+ "Farest distance": "Distance la + longue",
"Filter": "Filtrer",
"From": "A partir de",
"gpxFile": "fichier gpx",
+ "Longest duration": "Durée la + longue",
+ "Max. altitude" : "Altitude max",
"Max. speed": "Vitesse max",
+ "Min. altitude": "Altitude min",
"no folder inside": "pas de répertoire",
"files max": " fichiers max",
"max size": "taille max",
+ "No data to display": "Pas de données à afficher",
+ "No Map": "Pas de carte",
+ "No next activity": "Pas d'activité suivante",
+ "No next segment": "Pas de segment suivant",
+ "No notes": "Pas de notes",
+ "No previous activity": "Pas d'activité précédente",
+ "No previous segment": "Pas de segment précédent",
"Notes": "Notes",
+ "pauses": "pauses",
+ "Personal records": "Records personnels",
+ "See next activity": "Voir l'activité suivante",
+ "See next segment": "Voir le segment suivant",
+ "See previous activity": "Voir l'activité précédente",
+ "See previous segment": "Voir le segment précédent",
+ "segment": "segment",
+ "Segments": "Segments",
+ "Start": "Départ",
+ "speed": "vitesse",
"Title": "Titre",
"To": "Jusqu'au",
+ "total duration": "durée totale",
"with gpx file": "avec un fichier gpx",
"without gpx file": "sans fichier gpx",
"zipFile": "ou un fichier zip contenant des fichiers gpx"
diff --git a/fittrackee_client/src/locales/fr/common.json b/fittrackee_client/src/locales/fr/common.json
index ee1f8b1a..0e8415be 100644
--- a/fittrackee_client/src/locales/fr/common.json
+++ b/fittrackee_client/src/locales/fr/common.json
@@ -6,6 +6,7 @@
"days": "jours",
"Login": "Se connecter",
"Logout": "Se déconnecter",
+ "No": "Non",
"No records.": "Pas de records.",
"No workouts.": "Pas d'activités.",
"Register": "S'inscrire",
@@ -19,5 +20,6 @@
"Workout": "Activité",
"Workouts": "Activités",
"workout": "activité",
- "workouts": "activités"
+ "workouts": "activités",
+ "Yes": "Oui"
}
diff --git a/fittrackee_client/src/utils/activities.js b/fittrackee_client/src/utils/activities.js
index a0671e83..b90f65eb 100644
--- a/fittrackee_client/src/utils/activities.js
+++ b/fittrackee_client/src/utils/activities.js
@@ -14,10 +14,10 @@ export const activityColors = [
]
export const recordsLabels = [
- { record_type: 'AS', label: 'Avg speed' },
+ { record_type: 'AS', label: 'Ave. speed' },
{ record_type: 'FD', label: 'Farest distance' },
{ record_type: 'LD', label: 'Longest duration' },
- { record_type: 'MS', label: 'Max speed' },
+ { record_type: 'MS', label: 'Max. speed' },
]
export const getGeoJson = gpxContent => {
|