From ae36ee8a9270540cea2b0bea70b0f7c46a1818ef Mon Sep 17 00:00:00 2001 From: Zog Date: Wed, 7 Feb 2018 09:23:20 +0100 Subject: Refs #4126 @6h; Add i18n to JS --- .../vehicle_journeys/components/ConfirmModal.js | 6 +++--- app/javascript/vehicle_journeys/components/Filters.js | 18 +++++++++--------- .../vehicle_journeys/components/VehicleJourney.js | 10 +++++----- .../vehicle_journeys/components/VehicleJourneys.js | 18 +++++++++--------- .../components/tools/EditVehicleJourney.js | 2 +- 5 files changed, 27 insertions(+), 27 deletions(-) (limited to 'app/javascript') diff --git a/app/javascript/vehicle_journeys/components/ConfirmModal.js b/app/javascript/vehicle_journeys/components/ConfirmModal.js index 3bfc852fb..75e8a3932 100644 --- a/app/javascript/vehicle_journeys/components/ConfirmModal.js +++ b/app/javascript/vehicle_journeys/components/ConfirmModal.js @@ -7,7 +7,7 @@ export default function ConfirmModal({dispatch, modal, onModalAccept, onModalCan
-

Voulez-vous valider vos modifications avant de changer de page?

+

{I18n.t('vehicle_journeys.vehicle_journeys_matrix.modal_confirm')}

) -} +} ConfirmModal.propTypes = { vehicleJourneys: PropTypes.array.isRequired, modal: PropTypes.object.isRequired, onModalAccept: PropTypes.func.isRequired, onModalCancel: PropTypes.func.isRequired -} \ No newline at end of file +} diff --git a/app/javascript/vehicle_journeys/components/Filters.js b/app/javascript/vehicle_journeys/components/Filters.js index 2bd912e3e..f8697c930 100644 --- a/app/javascript/vehicle_journeys/components/Filters.js +++ b/app/javascript/vehicle_journeys/components/Filters.js @@ -46,10 +46,10 @@ export default function Filters({filters, pagination, missions, onFilter, onRese
{/* Plage horaire */}
- +
- +
- +
- +
@@ -122,7 +122,7 @@ export default function Filters({filters, pagination, missions, onFilter, onRese
{/* Switch avec/sans calendrier */}
- +
diff --git a/app/javascript/vehicle_journeys/components/VehicleJourney.js b/app/javascript/vehicle_journeys/components/VehicleJourney.js index 99a458f50..4a9432231 100644 --- a/app/javascript/vehicle_journeys/components/VehicleJourney.js +++ b/app/javascript/vehicle_journeys/components/VehicleJourney.js @@ -23,7 +23,7 @@ export default class VehicleJourney extends Component { let ttURL = refURL + '/time_tables/' + tt.id return ( - + ) } @@ -32,7 +32,7 @@ export default class VehicleJourney extends Component { let ttURL = refURL + '/purchase_windows/' + tt.id return ( - + ) } @@ -65,7 +65,7 @@ export default class VehicleJourney extends Component { } >
{this.props.value.short_id || '-'}
-
{this.props.value.published_journey_name && this.props.value.published_journey_name != "non renseigné" ? this.props.value.published_journey_name : '-'}
+
{this.props.value.published_journey_name && this.props.value.published_journey_name != I18n.t('undefined') ? this.props.value.published_journey_name : '-'}
{this.props.value.journey_pattern.short_id || '-'}
{this.props.value.company ? this.props.value.company.name : '-'}
@@ -100,7 +100,7 @@ export default class VehicleJourney extends Component {
{this.props.filters.toggleArrivals && -
+
}
-
+
{(this.props.status.fetchSuccess == false) && (
- Erreur : - la récupération des missions a rencontré un problème. Rechargez la page pour tenter de corriger le problème. + {I18n.tc("error")} + {I18n.t("vehicle_journeys.vehicle_journeys_matrix.fetching_error")}
)} { this.vehicleJourneysList().errors && this.vehicleJourneysList().errors.length && _.some(this.vehicleJourneysList(), 'errors') && (
- Erreur : + {I18n.tc("error")} {this.vehicleJourneysList().map((vj, index) => vj.errors && vj.errors.map((err, i) => { return ( @@ -129,12 +129,12 @@ export default class VehicleJourneys extends Component {
0) ? '' : ' no_result')}>
-
ID course
-
Nom course
-
ID mission
-
Transporteur
-
Calendriers
- { this.hasFeature('purchase_windows') &&
Calendriers Commerciaux
} +
{I18n.attribute_name("vehicle_journey", "id")}
+
{I18n.attribute_name("vehicle_journey", "name")}
+
{I18n.attribute_name("vehicle_journey", "journey_pattern_id")}
+
{I18n.model_name("company")}
+
{I18n.model_name("time_table", "plural": true)}
+ { this.hasFeature('purchase_windows') &&
{I18n.model_name("purchase_window", "plural": true)}
}
{this.stopPoints().map((sp, i) =>{ return ( diff --git a/app/javascript/vehicle_journeys/components/tools/EditVehicleJourney.js b/app/javascript/vehicle_journeys/components/tools/EditVehicleJourney.js index f6a0e3c61..bcfd4eb41 100644 --- a/app/javascript/vehicle_journeys/components/tools/EditVehicleJourney.js +++ b/app/javascript/vehicle_journeys/components/tools/EditVehicleJourney.js @@ -128,7 +128,7 @@ export default class EditVehicleJourney extends Component {
-- cgit v1.2.3 From c20f034b60d39a4bcb56cd61f3fa314c64a8736c Mon Sep 17 00:00:00 2001 From: Zog Date: Wed, 7 Feb 2018 11:12:04 +0100 Subject: Refs #4126 @2h; Add more translations --- app/javascript/vehicle_journeys/components/Navigate.js | 5 ++--- .../vehicle_journeys/components/ToggleArrivals.js | 2 +- app/javascript/vehicle_journeys/components/Tools.js | 4 ++-- .../components/tools/EditVehicleJourney.js | 18 +++++++++--------- .../components/tools/VehicleJourneyInfoButton.js | 4 ++-- 5 files changed, 16 insertions(+), 17 deletions(-) (limited to 'app/javascript') diff --git a/app/javascript/vehicle_journeys/components/Navigate.js b/app/javascript/vehicle_journeys/components/Navigate.js index 0158b8392..24843babc 100644 --- a/app/javascript/vehicle_journeys/components/Navigate.js +++ b/app/javascript/vehicle_journeys/components/Navigate.js @@ -17,8 +17,7 @@ export default function Navigate({ dispatch, vehicleJourneys, pagination, status if(status.fetchSuccess == true) { return (
- Liste des horaires {minVJ} à {maxVJ} sur {pagination.totalCount} - + {I18n.t("vehicle_journeys.vehicle_journeys_matrix.pagination", {minVJ, maxVJ, total:pagination.totalCount})}
{e.preventDefault()}}> + {I18n.t('vehicle_journeys.vehicle_journeys_matrix.selected_journeys', {count: actions.getSelected(vehicleJourneys).length})} +
) } diff --git a/app/javascript/vehicle_journeys/components/tools/EditVehicleJourney.js b/app/javascript/vehicle_journeys/components/tools/EditVehicleJourney.js index bcfd4eb41..d3c01f154 100644 --- a/app/javascript/vehicle_journeys/components/tools/EditVehicleJourney.js +++ b/app/javascript/vehicle_journeys/components/tools/EditVehicleJourney.js @@ -59,7 +59,7 @@ export default class EditVehicleJourney extends Component {
-

Informations

+

{I18n.t('vehicle_journeys.form.infos')}

×
@@ -69,7 +69,7 @@ export default class EditVehicleJourney extends Component {
- +
- +
- +
- +
- +
- +
- + +
- +
) } } -- cgit v1.2.3 From 2f895a1ee52922565b7ca1a0c00defe68f40aebd Mon Sep 17 00:00:00 2001 From: Zog Date: Mon, 12 Feb 2018 09:33:53 +0100 Subject: Refs #5888; Fix I18n in JS --- app/javascript/routes/components/BSelect2.js | 2 +- app/javascript/routes/components/OlMap.js | 24 +++++++++++----------- app/javascript/routes/components/StopPoint.js | 12 +++++------ app/javascript/routes/components/StopPointList.js | 8 ++++---- app/javascript/time_tables/actions/index.js | 12 +++++------ .../time_tables/components/ConfirmModal.js | 10 ++++----- .../time_tables/components/ErrorModal.js | 6 +++--- app/javascript/time_tables/components/Metas.js | 12 +++++------ .../time_tables/components/PeriodForm.js | 14 ++++++------- .../time_tables/components/TagsSelect2.js | 2 +- app/javascript/time_tables/components/Timetable.js | 8 ++++---- 11 files changed, 55 insertions(+), 55 deletions(-) (limited to 'app/javascript') diff --git a/app/javascript/routes/components/BSelect2.js b/app/javascript/routes/components/BSelect2.js index 158deaa17..035bce155 100644 --- a/app/javascript/routes/components/BSelect2.js +++ b/app/javascript/routes/components/BSelect2.js @@ -85,7 +85,7 @@ class BSelect2 extends Component{ onSelect={ this.props.onSelect } ref='newSelect' options={{ - placeholder: this.context.I18n.routes.edit.select2.placeholder, + placeholder: this.context.I18n.t("routes.edit.select2.placeholder"), allowClear: true, language: 'fr', /* Doesn't seem to work... :( */ theme: 'bootstrap', diff --git a/app/javascript/routes/components/OlMap.js b/app/javascript/routes/components/OlMap.js index 056bddbcb..4beb02872 100644 --- a/app/javascript/routes/components/OlMap.js +++ b/app/javascript/routes/components/OlMap.js @@ -115,40 +115,40 @@ export default class OlMap extends Component{ {this.props.value.olMap.json.name}

- {this.context.I18n.routes.edit.stop_point_type} : + {this.context.I18n.t('routes.edit.map.stop_point_type')} : {this.props.value.olMap.json.area_type}

- {this.context.I18n.routes.edit.short_name} : + {this.context.I18n.t('routes.edit.map.short_name')} : {this.props.value.olMap.json.short_name}

- {this.context.I18n.id_reflex} : + {this.context.I18n.t('id_reflex')} : {this.props.value.olMap.json.user_objectid}

-

{this.context.I18n.routes.edit.map.coordinates} :

+

{this.context.I18n.t('routes.edit.map.coordinates')} :

- {this.context.I18n.routes.edit.map.proj}.: WSG84
- {this.context.I18n.routes.edit.map.lat}.: {this.props.value.olMap.json.latitude}
- {this.context.I18n.routes.edit.map.lon}.: {this.props.value.olMap.json.longitude} + {this.context.I18n.t('routes.edit.map.proj')}.: WSG84
+ {this.context.I18n.t('routes.edit.map.lat')}.: {this.props.value.olMap.json.latitude}
+ {this.context.I18n.t('routes.edit.map.lon')}.: {this.props.value.olMap.json.longitude}

- {this.context.I18n.routes.edit.map.postal_code} : + {this.context.I18n.t('routes.edit.map.postal_code')} : {this.props.value.olMap.json.zip_code}

- {this.context.I18n.routes.edit.map.city} : + {this.context.I18n.t('routes.edit.map.city')} : {this.props.value.olMap.json.city_name}

- {this.context.I18n.routes.edit.map.comment} : + {this.context.I18n.t('routes.edit.map.comment')} : {this.props.value.olMap.json.comment}

{(this.props.value.stoparea_id != this.props.value.olMap.json.stoparea_id) &&(
{this.props.onUpdateViaOlMap(this.props.index, this.props.value.olMap.json)}} - >{this.context.I18n.actions.select}
+ >{this.context.I18n.t('actions.select')}
)}
@@ -162,7 +162,7 @@ export default class OlMap extends Component{ } } -OlMap.PropTypes = { +OlMap.propTypes = { } OlMap.contextTypes = { diff --git a/app/javascript/routes/components/StopPoint.js b/app/javascript/routes/components/StopPoint.js index 2d47e802b..af51a6bb4 100644 --- a/app/javascript/routes/components/StopPoint.js +++ b/app/javascript/routes/components/StopPoint.js @@ -18,15 +18,15 @@ export default function StopPoint(props, {I18n}) {
@@ -77,7 +77,7 @@ export default function StopPoint(props, {I18n}) { ) } -StopPoint.PropTypes = { +StopPoint.propTypes = { onToggleMap: PropTypes.func.isRequired, onToggleEdit: PropTypes.func.isRequired, onDeleteClick: PropTypes.func.isRequired, @@ -93,4 +93,4 @@ StopPoint.PropTypes = { StopPoint.contextTypes = { I18n: PropTypes.object -} \ No newline at end of file +} diff --git a/app/javascript/routes/components/StopPointList.js b/app/javascript/routes/components/StopPointList.js index b39fa0c9c..b227abdea 100644 --- a/app/javascript/routes/components/StopPointList.js +++ b/app/javascript/routes/components/StopPointList.js @@ -10,22 +10,22 @@ export default function StopPointList({ stopPoints, onDeleteClick, onMoveUpClick
- +
- +
- +
- +
diff --git a/app/javascript/time_tables/actions/index.js b/app/javascript/time_tables/actions/index.js index 4a36ec4e1..98b9eab4b 100644 --- a/app/javascript/time_tables/actions/index.js +++ b/app/javascript/time_tables/actions/index.js @@ -8,7 +8,7 @@ const I18n = clone(window, "I18n") const actions = { weekDays: (index) => { - return range(1, 8).map(n => I18n.time_tables.edit.metas.days[n]) + return range(1, 8).map(n => I18n.t('time_tables.edit.metas.days')[n]) }, strToArrayDayTypes: (str) =>{ return actions.weekDays().map(day => str.indexOf(day) !== -1) @@ -155,7 +155,7 @@ const actions = { type : 'CLOSE_MODAL' }), monthName(strDate) { - let monthList = range(1,13).map(n => I18n.calendars.months[n]) + let monthList = range(1,13).map(n => I18n.t('calendars.months.'+ n )) let date = new Date(strDate) return monthList[date.getUTCMonth()] }, @@ -225,7 +225,7 @@ const actions = { let period = periods[i] if (index !== i && !period.deleted) { if (new Date(period.period_start) <= end && new Date(period.period_end) >= start) { - error = I18n.time_tables.edit.error_submit.periods_overlaps + error = I18n.t('time_tables.edit.error_submit.periods_overlaps') break } } @@ -239,7 +239,7 @@ const actions = { for (let day of in_days) { if (start <= new Date(day.date) && end >= new Date(day.date)) { - error = I18n.time_tables.edit.error_submit.dates_overlaps + error = I18n.t('time_tables.edit.error_submit.dates_overlaps') break } } @@ -316,9 +316,9 @@ const actions = { errorModalMessage: (errorKey) => { switch (errorKey) { case "withoutPeriodsWithDaysTypes": - return I18n.time_tables.edit.error_modal.withoutPeriodsWithDaysTypes + return I18n.t('time_tables.edit.error_modal.withoutPeriodsWithDaysTypes') case "withPeriodsWithoutDayTypes": - return I18n.time_tables.edit.error_modal.withPeriodsWithoutDayTypes + return I18n.t('time_tables.edit.error_modal.withPeriodsWithoutDayTypes') default: return errorKey diff --git a/app/javascript/time_tables/components/ConfirmModal.js b/app/javascript/time_tables/components/ConfirmModal.js index 845e7ed1b..4e8583bc0 100644 --- a/app/javascript/time_tables/components/ConfirmModal.js +++ b/app/javascript/time_tables/components/ConfirmModal.js @@ -9,11 +9,11 @@ export default function ConfirmModal({dispatch, modal, onModalAccept, onModalCan
-

{I18n.time_tables.edit.confirm_modal.title}

+

{I18n.t('time_tables.edit.confirm_modal.title')}

-

{I18n.time_tables.edit.confirm_modal.message}

+

{I18n.t('time_tables.edit.confirm_modal.message')}

@@ -23,7 +23,7 @@ export default function ConfirmModal({dispatch, modal, onModalAccept, onModalCan type='button' onClick={() => { onModalCancel(modal.confirmModal.callback) }} > - {I18n.cancel} + {I18n.t('cancel')}
@@ -49,4 +49,4 @@ ConfirmModal.propTypes = { ConfirmModal.contextTypes = { I18n: PropTypes.object -} \ No newline at end of file +} diff --git a/app/javascript/time_tables/components/ErrorModal.js b/app/javascript/time_tables/components/ErrorModal.js index 543177e54..8af12f1d1 100644 --- a/app/javascript/time_tables/components/ErrorModal.js +++ b/app/javascript/time_tables/components/ErrorModal.js @@ -10,7 +10,7 @@ export default function ErrorModal({dispatch, modal, onModalClose}, {I18n}) {
-

{I18n.time_tables.edit.error_modal.title}

+

{I18n.t('time_tables.edit.error_modal.title')}

@@ -24,7 +24,7 @@ export default function ErrorModal({dispatch, modal, onModalClose}, {I18n}) { type='button' onClick={() => { onModalClose() }} > - {I18n.back} + {I18n.t('back')}
@@ -41,4 +41,4 @@ ErrorModal.propTypes = { ErrorModal.contextTypes = { I18n: PropTypes.object -} \ No newline at end of file +} diff --git a/app/javascript/time_tables/components/Metas.js b/app/javascript/time_tables/components/Metas.js index 3c6848d27..08a6e26fe 100644 --- a/app/javascript/time_tables/components/Metas.js +++ b/app/javascript/time_tables/components/Metas.js @@ -13,7 +13,7 @@ export default function Metas({metas, onUpdateDayTypes, onUpdateComment, onUpdat {/* comment (name) */}
- +
@@ -124,7 +124,7 @@ export default function PeriodForm({modal, timetable, metas, onOpenAddPeriodForm className='btn btn-outline-primary' onClick={onOpenAddPeriodForm} > - {I18n.time_tables.actions.add_period} + {I18n.t('time_tables.actions.add_period')}
} @@ -132,7 +132,7 @@ export default function PeriodForm({modal, timetable, metas, onOpenAddPeriodForm
- ) + ) } PeriodForm.propTypes = { @@ -147,4 +147,4 @@ PeriodForm.propTypes = { PeriodForm.contextTypes = { I18n: PropTypes.object -} \ No newline at end of file +} diff --git a/app/javascript/time_tables/components/TagsSelect2.js b/app/javascript/time_tables/components/TagsSelect2.js index dc3739d58..43cf59fdf 100644 --- a/app/javascript/time_tables/components/TagsSelect2.js +++ b/app/javascript/time_tables/components/TagsSelect2.js @@ -40,7 +40,7 @@ export default class TagsSelect2 extends Component { allowClear: true, theme: 'bootstrap', width: '100%', - placeholder: this.context.I18n.time_tables.edit.select2.tag.placeholder, + placeholder: this.context.I18n.t('time_tables.edit.select2.tag.placeholder'), ajax: { url: origin + path + '/tags.json', dataType: 'json', diff --git a/app/javascript/time_tables/components/Timetable.js b/app/javascript/time_tables/components/Timetable.js index c44f2a134..991f31435 100644 --- a/app/javascript/time_tables/components/Timetable.js +++ b/app/javascript/time_tables/components/Timetable.js @@ -31,11 +31,11 @@ export default class Timetable extends Component {
-
{this.context.I18n.time_tables.synthesis}
+
{this.context.I18n.t('time_tables.edit.synthesis')}
-
{this.context.I18n.time_tables.edit.day_types}
-
{this.context.I18n.time_tables.edit.periods}
-
{this.context.I18n.time_tables.edit.exceptions}
+
{this.context.I18n.t('time_tables.edit.day_types')}
+
{this.context.I18n.t('time_tables.edit.periods')}
+
{this.context.I18n.t('time_tables.edit.exceptions')}
-- cgit v1.2.3