Skip to content

Commit

Permalink
language option with default 'en'
Browse files Browse the repository at this point in the history
  • Loading branch information
derhuerst committed Jul 9, 2018
1 parent c80f355 commit 0199749
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 7 deletions.
3 changes: 2 additions & 1 deletion docs/departures.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
```

Expand Down
3 changes: 2 additions & 1 deletion docs/journeys.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
```

Expand Down
1 change: 1 addition & 0 deletions docs/locations.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
```

Expand Down
3 changes: 2 additions & 1 deletion docs/nearby.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
```

Expand Down
3 changes: 2 additions & 1 deletion docs/radar.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
```

Expand Down
3 changes: 2 additions & 1 deletion docs/station.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion docs/trip.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
```

Expand Down
5 changes: 4 additions & 1 deletion lib/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down

0 comments on commit 0199749

Please sign in to comment.