diff --git a/docs/departures.md b/docs/departures.md index 9930b5ad..6008b524 100644 --- a/docs/departures.md +++ b/docs/departures.md @@ -28,7 +28,8 @@ With `opt`, you can override the default options, which look like this: direction: null, // only show departures heading to this station duration: 10, // show departures for the next n minutes stationLines: false, // parse & expose lines of the station? - remarks: true // parse & expose hints & warnings? + remarks: true, // parse & expose hints & warnings? + language: 'en' // language to get results in } ``` diff --git a/docs/journeys.md b/docs/journeys.md index 1e7868a2..9cabaeda 100644 --- a/docs/journeys.md +++ b/docs/journeys.md @@ -67,7 +67,8 @@ With `opt`, you can override the default options, which look like this: polylines: false, // return a shape for each leg? remarks: true, // parse & expose hints & warnings? // Consider walking to nearby stations at the beginning of a journey? - startWithWalking: true + startWithWalking: true, + language: 'en' // language to get results in } ``` diff --git a/docs/locations.md b/docs/locations.md index 8337823d..3d961b0b 100644 --- a/docs/locations.md +++ b/docs/locations.md @@ -12,6 +12,7 @@ With `opt`, you can override the default options, which look like this: , addresses: true , poi: true // points of interest , stationLines: false // parse & expose lines of the station? + , language: 'en' // language to get results in } ``` diff --git a/docs/nearby.md b/docs/nearby.md index c75d0f03..21eac15e 100644 --- a/docs/nearby.md +++ b/docs/nearby.md @@ -11,7 +11,8 @@ With `opt`, you can override the default options, which look like this: distance: null, // maximum walking distance in meters poi: false, // return points of interest? stations: true, // return stations? - stationLines: false // parse & expose lines of the station? + stationLines: false, // parse & expose lines of the station? + language: 'en' // language to get results in } ``` diff --git a/docs/radar.md b/docs/radar.md index d10077ac..8dea87e4 100644 --- a/docs/radar.md +++ b/docs/radar.md @@ -11,7 +11,8 @@ With `opt`, you can override the default options, which look like this: results: 256, // maximum number of vehicles duration: 30, // compute frames for the next n seconds frames: 3, // nr of frames to compute - polylines: false // return a track shape for each vehicle? + polylines: false, // return a track shape for each vehicle? + language: 'en' // language to get results in } ``` diff --git a/docs/station.md b/docs/station.md index db780f5b..f8d46f47 100644 --- a/docs/station.md +++ b/docs/station.md @@ -23,7 +23,8 @@ With `opt`, you can override the default options, which look like this: ```js { - stationLines: false // parse & expose lines of the station? + stationLines: false, // parse & expose lines of the station? + language: 'en' // language to get results in } ## Response diff --git a/docs/trip.md b/docs/trip.md index 3122dd81..000359d4 100644 --- a/docs/trip.md +++ b/docs/trip.md @@ -29,7 +29,8 @@ With `opt`, you can override the default options, which look like this: when: new Date(), stopovers: true, // return stations on the way? polyline: false, // return a shape for the trip? - remarks: true // parse & expose hints & warnings? + remarks: true, // parse & expose hints & warnings? + language: 'en' // language to get results in } ``` diff --git a/lib/request.js b/lib/request.js index 6cedd1ca..1261a180 100644 --- a/lib/request.js +++ b/lib/request.js @@ -12,7 +12,10 @@ const {fetch} = require('fetch-ponyfill')({Promise}) const md5 = input => createHash('md5').update(input).digest() const request = (profile, opt, data) => { - const body = profile.transformReqBody({lang: 'en', svcReqL: [data]}) + const body = profile.transformReqBody({ + lang: opt.language || 'en', + svcReqL: [data] + }) const req = profile.transformReq({ method: 'post', // todo: CORS? referrer policy?