Skip to content

Commit

Permalink
front: refacto some manage train schedule translations
Browse files Browse the repository at this point in the history
Signed-off-by: SharglutDev <[email protected]>
  • Loading branch information
SharglutDev committed Feb 25, 2025
1 parent d56137c commit 59b064f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@
"invalidInitialSpeed": "The initial speed must be rounded to the nearest tenth",
"mandatoryField": "Required field",
"nameLengthLimit": "The name must not exceed 128 characters",
"noCadence": "The cadence must be must be greater than 0",
"noCadenceInput": "Must be > 0",
"noDelta": "The headway between two trains has to be at least one minute.",
"noDeltaInput": "Must be > 0",
"noDepartureTime": "Please enter a departure time",
"noDestination": "The destination is not defined",
"noName": "Please choose a name for the train",
Expand All @@ -37,17 +34,15 @@
"noPathfinding": "Please relaunch the pathfinding",
"noRollingStock": "The train composition is missing",
"noSpeedLimitByTag": "Please choose a composition code",
"noTimeRangeDuration": "The time range duration must be greater than 0",
"noTimeRangeDurationInput": "Must be > 0",
"noTimetable": "Please choose or create a timetable",
"noTrainCount": "The quantity of requested trains must be greater than zero",
"noTrainCountInput": "Must be > 0",
"noTrainStep": "The increment step of the train must be greater than zero",
"noTrainStepInput": "Must be > 0",
"originTimeOutsideWindow": "Departure date must be between {{low}} and {{high}}",
"requiredField": "Required field.",
"softErrorInfra": "The application is unavailable, a server error has occurred, please try again later.",
"The requested train couldn't reach its destination": "The train cannot reach its destination",
"tooLowInput": "Must be > 0",
"tooLowValue": "The {{value}} must be greater than 0",
"trainScheduleTitle": "An error has occurred",
"unableToDeleteTrain": "Impossible to delete the train",
"unableToDuplicateTrain": "Impossible to duplicate the train",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@
"invalidInitialSpeed": "La vitesse initiale doit être arrondie au dixième",
"mandatoryField": "Champ obligatoire",
"nameLengthLimit": "Le nom ne doit pas dépasser 128 caractères",
"noCadence": "La cadence doit être supérieure à 0",
"noCadenceInput": "Doit être > 0",
"noDelta": "L'intervalle entre deux trains doit être d'au moins une minute",
"noDeltaInput": "Doit être > 0",
"noDepartureTime": "Veuillez renseigner une heure de départ",
"noDestination": "La destination n'est pas définie",
"noName": "Veuillez choisir un nom pour le train",
Expand All @@ -37,17 +34,15 @@
"noPathfinding": "Veuillez relancer la recherche d'itinéraire",
"noRollingStock": "La composition de train n'est pas renseignée",
"noSpeedLimitByTag": "Veuillez choisir un code de composition",
"noTimeRangeDuration": "La durée de la plage de répétition doit être supérieure à 0",
"noTimeRangeDurationInput": "Doit être > 0",
"noTimetable": "Veuillez choisir ou créer une grille horaire",
"noTrainCount": "La quantité de trains demandée doit être supérieure à zéro",
"noTrainCountInput": "Doit être > 0",
"noTrainStep": "Le pas d'incrément du nom du train doit être supérieur à zéro",
"noTrainStepInput": "Doit être > 0",
"originTimeOutsideWindow": "La date de départ doit être comprise entre le {{low}} et le {{high}}",
"requiredField": "Champ obligatoire.",
"softErrorInfra": "L'application est indisponible, une erreur serveur est survenue, veuillez réessayer ultérieurement.",
"The requested train couldn't reach its destination": "Le train ne peut pas atteindre sa destination",
"tooLowInput": "Doit être > 0",
"tooLowValue": "La {{value}} doit être supérieure à 0",
"trainScheduleTitle": "Une erreur est survenue",
"unableToDeleteTrain": "Impossible de supprimer le train",
"unableToDuplicateTrain": "Impossible de dupliquer le train",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const PacedTrainSettings = () => {
value={timeRangeDuration}
noMargin
isInvalid={timeRangeDuration < 1}
errorMsg={timeRangeDuration < 1 ? t('errorMessages.noTimeRangeDurationInput') : undefined}
errorMsg={timeRangeDuration < 1 ? t('errorMessages.tooLowInput') : undefined}
min={1}
unit="min"
textRight
Expand All @@ -57,7 +57,7 @@ const PacedTrainSettings = () => {
value={cadence}
noMargin
isInvalid={cadence < 1}
errorMsg={cadence < 1 ? t('errorMessages.noCadenceInput') : undefined}
errorMsg={cadence < 1 ? t('errorMessages.tooLowInput') : undefined}
min={1}
unit="min"
textRight
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default function TrainAddingSettings() {
value={trainStep}
noMargin
isInvalid={trainStep < 1}
errorMsg={trainStep < 1 ? t('errorMessages.noTrainStepInput') : undefined}
errorMsg={trainStep < 1 ? t('errorMessages.tooLowInput') : undefined}
min={1}
sm
/>
Expand All @@ -77,7 +77,7 @@ export default function TrainAddingSettings() {
value={trainCount}
noMargin
isInvalid={trainCount < 1}
errorMsg={trainCount < 1 ? t('errorMessages.noTrainCountInput') : undefined}
errorMsg={trainCount < 1 ? t('errorMessages.tooLowInput') : undefined}
min={1}
sm
/>
Expand All @@ -97,7 +97,7 @@ export default function TrainAddingSettings() {
unit="min"
noMargin
isInvalid={trainDelta < 1}
errorMsg={trainDelta < 1 ? t('errorMessages.noDeltaInput') : undefined}
errorMsg={trainDelta < 1 ? t('errorMessages.tooLowInput') : undefined}
min={1}
sm
textRight
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { TFunction } from 'i18next';
import { compact } from 'lodash';
import type { Dispatch } from 'redux';

Expand All @@ -13,7 +14,7 @@ import formatSchedule from './formatSchedule';

const checkCurrentConfig = (
osrdconf: OperationalStudiesConfState,
t: (arg0: string) => string,
t: TFunction,
dispatch: Dispatch,
// TODO TS2 : remove this when rollingStockName will replace rollingStockId in the store
rollingStockName?: string,
Expand Down Expand Up @@ -138,7 +139,9 @@ const checkCurrentConfig = (
dispatch(
setFailure({
name: t('errorMessages.trainScheduleTitle'),
message: t('errorMessages.noCadence'),
message: t('errorMessages.tooLowValue', {
value: t('pacedTrains.cadence').toLowerCase(),
}),
})
);
}
Expand All @@ -147,7 +150,9 @@ const checkCurrentConfig = (
dispatch(
setFailure({
name: t('errorMessages.trainScheduleTitle'),
message: t('errorMessages.noTimeRangeDuration'),
message: t('errorMessages.tooLowValue', {
value: t('pacedTrains.timeRangeDuration').toLowerCase(),
}),
})
);
}
Expand Down

0 comments on commit 59b064f

Please sign in to comment.