From 668f34e8860186fe63ac91a56d748e469c613007 Mon Sep 17 00:00:00 2001 From: e-halinen Date: Tue, 31 Oct 2023 14:56:01 +0200 Subject: [PATCH 1/2] #26114: Add language choices into the print button on timetable rendering --- src/components/timetable/timetable.js | 26 +++++++++++++------ .../timetable/timetableContainer.js | 3 +++ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/components/timetable/timetable.js b/src/components/timetable/timetable.js index a23564e0..5243d3f8 100644 --- a/src/components/timetable/timetable.js +++ b/src/components/timetable/timetable.js @@ -58,13 +58,21 @@ const getNotes = (notes, symbols) => { return parsedNotes; }; -const PrintButton = props => ( -
- -
-); +const PrintButton = lang => { + const PRINT_TEXT = { + fi: 'TULOSTA AIKATAULU', + sv: 'UTSKRIVA TIDTABEL', + en: 'PRINT SCHEDULE', + }; + + return ( +
+ +
+ ); +}; class Timetable extends Component { constructor(props) { @@ -134,7 +142,7 @@ class Timetable extends Component { )} - {this.props.showPrintButton ? : ''} + {this.props.showPrintButton ? : ''} )} {this.props.showValidityPeriod && ( @@ -233,6 +241,7 @@ Timetable.defaultProps = { addressFi: null, showAddressInfo: true, showPrintButton: false, + lang: 'fi', }; Timetable.propTypes = { @@ -264,6 +273,7 @@ Timetable.propTypes = { showAddressInfo: PropTypes.bool, showPrintButton: PropTypes.bool, combinedDays: PropTypes.object.isRequired, + lang: PropTypes.string, }; export default Timetable; diff --git a/src/components/timetable/timetableContainer.js b/src/components/timetable/timetableContainer.js index e3089a09..367978d9 100644 --- a/src/components/timetable/timetableContainer.js +++ b/src/components/timetable/timetableContainer.js @@ -408,6 +408,7 @@ const propsMapper = mapProps(props => { hasDepartures: departures.length > 0, showAddressInfo: props.showAddressInfo, showPrintButton: props.showPrintButton, + lang: props.lang, }; }); @@ -429,6 +430,7 @@ TimetableContainer.defaultProps = { showStopInformation: false, showAddressInfo: true, showPrintButton: false, + lang: 'fi', }; TimetableContainer.propTypes = { @@ -449,6 +451,7 @@ TimetableContainer.propTypes = { showAddressInfo: PropTypes.bool, showPrintButton: PropTypes.bool, combinedDays: PropTypes.object, + lang: PropTypes.string, }; export default TimetableContainer; From 492b3617adc33c16e171acce24d3188bf91a03c4 Mon Sep 17 00:00:00 2001 From: e-halinen Date: Tue, 31 Oct 2023 14:57:23 +0200 Subject: [PATCH 2/2] Change SV text --- src/components/timetable/timetable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/timetable/timetable.js b/src/components/timetable/timetable.js index 5243d3f8..2f9eb347 100644 --- a/src/components/timetable/timetable.js +++ b/src/components/timetable/timetable.js @@ -61,7 +61,7 @@ const getNotes = (notes, symbols) => { const PrintButton = lang => { const PRINT_TEXT = { fi: 'TULOSTA AIKATAULU', - sv: 'UTSKRIVA TIDTABEL', + sv: 'SKRIV UT TIDTABEL', en: 'PRINT SCHEDULE', };