Skip to content

Commit

Permalink
refactor(ExceptionDate): i18n exception date
Browse files Browse the repository at this point in the history
  • Loading branch information
philip-cline committed Jul 11, 2023
1 parent 8b74659 commit fb3d19e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
4 changes: 4 additions & 0 deletions i18n/english.yml
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,10 @@ components:
createStop: Right-click a location on map to create a new stop
editSchedules: Edit schedules
name: Name
ExceptionDate:
addRange: Add range
dateRemoved: ⓘ Date has been removed. Date entered is already included in an existing range or single date!
selectDate: Select date
ExceptionDateRange:
andOtherErrors: ...and %errors% other errors
deleteEndDate: Delete end date
Expand Down
4 changes: 4 additions & 0 deletions i18n/german.yml
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,10 @@ components:
auf eine Örtlickeit in der Karte
editSchedules: Abfahrzeiten erstellen
name: Name
ExceptionDate:
addRange: Add range
dateRemoved: ⓘ Date has been removed. Date entered is already included in an existing range or single date!
selectDate: Select date
ExceptionDateRange:
andOtherErrors: ...and %errors% other errors
deleteEndDate: Delete end date
Expand Down
4 changes: 4 additions & 0 deletions i18n/polish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,10 @@ components:
createStop: Right-click a location on map to create a new stop
editSchedules: Edit schedules
name: Name
ExceptionDate:
addRange: Add range
dateRemoved: ⓘ Date has been removed. Date entered is already included in an existing range or single date!
selectDate: Select date
ExceptionDateRange:
andOtherErrors: ...and %errors% other errors
deleteEndDate: Delete end date
Expand Down
9 changes: 6 additions & 3 deletions lib/editor/components/ExceptionDate.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {toast} from 'react-toastify'
import {updateActiveGtfsEntity} from '../actions/active'
import type {ScheduleException} from '../../types'
import type {EditorValidationIssue} from '../util/validation'
import { getComponentMessages } from '../../common/util/config'

import {sortDates} from './ExceptionDateRange'

Expand All @@ -34,6 +35,8 @@ export const inputStyleProps = {
}

export default class ExceptionDate extends Component<Props, State> {
messages = getComponentMessages('ExceptionDate')

_addRange = () => {
const {activeComponent, activeEntity, index, updateActiveGtfsEntity} = this.props
const dates = [...activeEntity.dates]
Expand Down Expand Up @@ -63,7 +66,7 @@ export default class ExceptionDate extends Component<Props, State> {
if (dates.some(date => date === newDate && date !== 'Invalid date')) {
dates.splice(index, 1)
toast.warn(
`ⓘ Date has been removed. Date entered is already included in an existing range or single date!`,
this.messages('dateRemoved'),
{
position: 'top-right',
autoClose: 4000,
Expand Down Expand Up @@ -105,7 +108,7 @@ export default class ExceptionDate extends Component<Props, State> {
}

if (!date) {
dateTimeProps.defaultText = 'Select date'
dateTimeProps.defaultText = this.messages('selectDate')
}
return (
<FormGroup
Expand Down Expand Up @@ -142,7 +145,7 @@ export default class ExceptionDate extends Component<Props, State> {
padding: '4'
}}
>
Add range
{this.messages('addRange')}
</Button>
<Button
bsStyle='danger'
Expand Down

0 comments on commit fb3d19e

Please sign in to comment.